]> git.sesse.net Git - vlc/blobdiff - plugins/gnome/gnome_callbacks.c
* Ported Glide and MGA plugins to the new module API. MGA never worked,
[vlc] / plugins / gnome / gnome_callbacks.c
index d3cfc91ed65cb9050fe94825d1f9253be3a7dfb0..53bb37631c4d6e9868a4ea5a904218b603190d1e 100644 (file)
@@ -20,6 +20,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define MODULE_NAME gnome
+#include "modules_inner.h"
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
@@ -37,6 +40,7 @@
 
 #include "interface.h"
 #include "intf_plst.h"
+#include "intf_msg.h"
 
 #include "gnome_sys.h"
 #include "gnome_callbacks.h"
@@ -99,14 +103,7 @@ on_menubar_playlist_activate           (GtkMenuItem     *menuitem,
                              "p_intf", p_intf );
     }
     gtk_widget_show( p_intf->p_sys->p_playlist );
-}
-
-
-void
-on_menubar_plugins_activate            (GtkMenuItem     *menuitem,
-                                        gpointer         user_data)
-{
-
+    gdk_window_raise( p_intf->p_sys->p_playlist->window );
 }
 
 
@@ -131,6 +128,7 @@ on_menubar_about_activate              (GtkMenuItem     *menuitem,
                              "p_intf", p_intf );
     }
     gtk_widget_show( p_intf->p_sys->p_about );
+    gdk_window_raise( p_intf->p_sys->p_about->window );
 }
 
 
@@ -177,7 +175,7 @@ on_toolbar_play_clicked                (GtkButton       *button,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_PLAY );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
     }
 }
 
@@ -190,7 +188,7 @@ on_toolbar_pause_clicked               (GtkButton       *button,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_PAUSE );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
     }
 }
 
@@ -208,6 +206,7 @@ on_toolbar_playlist_clicked            (GtkButton       *button,
                              "p_intf", p_intf );
     }
     gtk_widget_show( p_intf->p_sys->p_playlist );
+    gdk_window_raise( p_intf->p_sys->p_playlist->window );
 }
 
 
@@ -249,7 +248,7 @@ on_popup_play_activate                 (GtkMenuItem     *menuitem,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_PLAY );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
     }
 }
 
@@ -262,7 +261,7 @@ on_popup_pause_activate                (GtkMenuItem     *menuitem,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_PAUSE );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
     }
 }
 
@@ -354,6 +353,7 @@ on_popup_about_activate                (GtkMenuItem     *menuitem,
                              "p_intf", p_intf );
     }
     gtk_widget_show( p_intf->p_sys->p_about );
+    gdk_window_raise( p_intf->p_sys->p_about->window );
 }
 
 
@@ -383,7 +383,7 @@ on_popup_slow_activate                 (GtkMenuItem     *menuitem,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_SLOWER );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
     }
 }
 
@@ -396,7 +396,7 @@ on_popup_fast_activate                 (GtkMenuItem     *menuitem,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_FASTER );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
     }
 }
 
@@ -409,7 +409,7 @@ on_toolbar_slow_clicked                (GtkButton       *button,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_SLOWER );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
     }
 }
 
@@ -422,7 +422,165 @@ on_toolbar_fast_clicked                (GtkButton       *button,
 
     if( p_intf->p_input != NULL )
     {
-        input_SetRate( p_intf->p_input, INPUT_RATE_FASTER );
+        input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
+    }
+}
+
+
+gboolean
+on_hscale_button_release_event         (GtkWidget       *widget,
+                                        GdkEventButton  *event,
+                                        gpointer         user_data)
+{
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
+
+    GtkAdjustment *p_adj = gtk_range_get_adjustment( GTK_RANGE(widget) );
+    off_t i_seek;
+
+    vlc_mutex_lock( &p_intf->p_sys->change_lock );
+
+    if( p_intf->p_input != NULL )
+    {
+        i_seek = (p_adj->value *
+                  p_intf->p_input->stream.pp_areas[0]->i_size) / 100;
+        input_Seek( p_intf->p_input, i_seek );
+    }
+    p_intf->p_sys->b_scale_isfree = 1;
+
+    vlc_mutex_unlock( &p_intf->p_sys->change_lock );
+
+    return FALSE;
+}
+
+
+gboolean
+on_hscale_button_press_event           (GtkWidget       *widget,
+                                        GdkEventButton  *event,
+                                        gpointer         user_data)
+{
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
+
+    vlc_mutex_lock( &p_intf->p_sys->change_lock );
+    p_intf->p_sys->b_scale_isfree = 0;
+    vlc_mutex_unlock( &p_intf->p_sys->change_lock );
+
+    return FALSE;
+}
+
+
+
+void
+on_intf_modules_destroy                (GtkObject       *object,
+                                        gpointer         user_data)
+{
+
+}
+
+
+void
+on_modules_ok_clicked                  (GtkButton       *button,
+                                        gpointer         user_data)
+{
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
+
+    gtk_widget_hide( p_intf->p_sys->p_modules );
+
+}
+
+
+void
+on_modules_apply_clicked               (GtkButton       *button,
+                                        gpointer         user_data)
+{
+
+}
+
+
+void
+on_modules_cancel_clicked              (GtkButton       *button,
+                                        gpointer         user_data)
+{
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
+
+    gtk_widget_hide( p_intf->p_sys->p_modules );
+}
+
+
+void
+on_playlist_ok_clicked                 (GtkButton       *button,
+                                        gpointer         user_data)
+{
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_playlist" );
+
+    gtk_widget_hide( p_intf->p_sys->p_playlist );
+}
+
+
+void
+on_menubar_modules_activate            (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+
+    if( !GTK_IS_WIDGET( p_intf->p_sys->p_modules ) )
+    {
+        p_intf->p_sys->p_modules = create_intf_modules();
+        gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_modules ),
+                             "p_intf", p_intf );
+    }
+    gtk_widget_show( p_intf->p_sys->p_modules );
+    gdk_window_raise( p_intf->p_sys->p_modules->window );
+}
+
+
+void
+on_intf_window_drag_data_received      (GtkWidget       *widget,
+                                        GdkDragContext  *drag_context,
+                                        gint             x,
+                                        gint             y,
+                                        GtkSelectionData *data,
+                                        guint            info,
+                                        guint            time,
+                                        gpointer         user_data)
+{
+    char *psz_text = data->data;
+    int i_len      = strlen( psz_text );
+
+    switch( info )
+    {
+    case DROP_ACCEPT_TEXT_PLAIN: /* FIXME: handle multiple files */
+
+        if( i_len < 1 )
+        {
+            return;
+        }
+
+        /* get rid of ' ' at the end */
+        *( psz_text + i_len - 1 ) = 0;
+
+        intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
+        intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
+
+        break;
+
+    case DROP_ACCEPT_TEXT_URI_LIST: /* FIXME: handle multiple files */
+
+        if( i_len < 2 )
+        {
+            return;
+        }
+
+        /* get rid of \r\n at the end */
+        *( psz_text + i_len - 2 ) = 0;
+
+        intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
+        intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
+        break;
+
+    default:
+
+        intf_ErrMsg( "intf error: unknown dropped type");
+        break;
     }
 }