Update copyrights everywhere.
[lxde/lxpanel.git] / src / plugins / volumealsa / volumealsa.c
index 7bee208..ffc932e 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2008 LxDE Developers, see the file AUTHORS for details.
+ * Copyright (c) 2008-2014 LxDE Developers, see the file AUTHORS for details.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ typedef struct {
 
     /* Graphics. */
     GtkWidget * plugin;                                /* Back pointer to the widget */
-    Panel * panel;                             /* Back pointer to panel */
+    LXPanel * panel;                           /* Back pointer to panel */
     GtkWidget * tray_icon;                     /* Displayed image */
     GtkWidget * popup_window;                  /* Top level window for popup */
     GtkWidget * volume_scale;                  /* Scale for volume */
@@ -329,11 +329,11 @@ static void volumealsa_update_display(VolumeALSAPlugin * vol)
     volumealsa_update_current_icon(vol);
 
     /* Change icon, fallback to default icon if theme doesn't exsit */
-    if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
+    if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
     {
-        if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
+        if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
         {
-            panel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
+            lxpanel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
         }
     }
 
@@ -358,15 +358,9 @@ static void volumealsa_update_display(VolumeALSAPlugin * vol)
 
 
 /* Handler for "button-press-event" signal on main widget. */
-static gboolean volumealsa_button_press_event(GtkWidget * widget, GdkEventButton * event, Panel * panel)
+static gboolean volumealsa_button_press_event(GtkWidget * widget, GdkEventButton * event, LXPanel * panel)
 {
-    VolumeALSAPlugin * vol;
-
-    /* Standard right-click handling. */
-    if (lxpanel_plugin_button_press_event(widget, event, panel))
-        return TRUE;
-
-    vol = lxpanel_plugin_get_data(widget);
+    VolumeALSAPlugin * vol = lxpanel_plugin_get_data(widget);
 
     /* Left-click.  Show or hide the popup window. */
     if (event->button == 1)
@@ -408,11 +402,11 @@ static void volumealsa_popup_map(GtkWidget * widget, VolumeALSAPlugin * vol)
 
 static void volumealsa_theme_change(GtkWidget * widget, VolumeALSAPlugin * vol)
 {
-    if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
+    if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
     {
-        if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
+        if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
         {
-            panel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
+            lxpanel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
         }
     }
 }
@@ -473,7 +467,7 @@ static void volumealsa_build_popup_window(GtkWidget *p)
     gtk_window_set_default_size(GTK_WINDOW(vol->popup_window), 80, 140);
     gtk_window_set_skip_taskbar_hint(GTK_WINDOW(vol->popup_window), TRUE);
     gtk_window_set_skip_pager_hint(GTK_WINDOW(vol->popup_window), TRUE);
-    gtk_window_set_type_hint(GTK_WINDOW(vol->popup_window), GDK_WINDOW_TYPE_HINT_DIALOG);
+    gtk_window_set_type_hint(GTK_WINDOW(vol->popup_window), GDK_WINDOW_TYPE_HINT_UTILITY);
 
     /* Connect signals. */
     g_signal_connect(G_OBJECT(vol->popup_window), "focus-out-event", G_CALLBACK(volumealsa_popup_focus_out), vol);
@@ -484,7 +478,7 @@ static void volumealsa_build_popup_window(GtkWidget *p)
     gtk_container_set_border_width (GTK_CONTAINER(scrolledwindow), 0);
     gtk_widget_show(scrolledwindow);
     gtk_container_add(GTK_CONTAINER(vol->popup_window), scrolledwindow);
-    GTK_WIDGET_UNSET_FLAGS(scrolledwindow, GTK_CAN_FOCUS);
+    gtk_widget_set_can_focus(scrolledwindow, FALSE);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
     gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_SHADOW_NONE);
 
@@ -523,7 +517,7 @@ static void volumealsa_build_popup_window(GtkWidget *p)
 }
 
 /* Plugin constructor. */
-static GtkWidget *volumealsa_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *volumealsa_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate and initialize plugin context and set into Plugin private data pointer. */
     VolumeALSAPlugin * vol = g_new0(VolumeALSAPlugin, 1);
@@ -580,10 +574,8 @@ static void volumealsa_destructor(gpointer user_data)
 
 /* Callback when the configuration dialog is to be shown. */
 
-static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *volumealsa_configure(LXPanel *panel, GtkWidget *p)
 {
-    GdkScreen *screen = gdk_screen_get_default();
-    GError *error = NULL;
     const gchar *command_line = NULL;
 
     if (g_find_program_in_path("pulseaudio"))
@@ -623,9 +615,8 @@ static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *pa
 
     if (command_line)
     {
-        gdk_spawn_command_line_on_screen(screen,
-                                         command_line,
-                                         &error);
+        fm_launch_command_simple(NULL, NULL, G_APP_INFO_CREATE_NONE,
+                                 command_line, NULL);
     }
     else
     {
@@ -634,17 +625,11 @@ static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *pa
                       NULL);
     }
 
-    if (error)
-    {
-        g_print("%s\n", error->message);
-        g_free (error);
-    }
-
     return NULL;
 }
 
 /* Callback when panel configuration changes. */
-static void volumealsa_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void volumealsa_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     /* Do a full redraw. */
     volumealsa_update_display(lxpanel_plugin_get_data(p));