[Xfce4-commits] <xfce4-mount-plugin:master> Port to libxfce4ui [wip]

Landry Breuil noreply at xfce.org
Tue Apr 10 19:26:05 CEST 2012


Updating branch refs/heads/master
         to 16759c995da007db32c67fa6bdbaf1f6aa7b6618 (commit)
       from d91c15bb1cb5ffa64e8c97e3bc95bb4b91182444 (commit)

commit 16759c995da007db32c67fa6bdbaf1f6aa7b6618
Author: Landry Breuil <landry at xfce.org>
Date:   Tue Apr 10 18:57:05 2012 +0200

    Port to libxfce4ui [wip]
    
    The icon size is wrong, i'll see what i can do

 panel-plugin/Makefile.am    |    6 +++---
 panel-plugin/devices.c      |   11 +++++------
 panel-plugin/mount-plugin.c |   14 ++++++--------
 panel-plugin/mount-plugin.h |    3 ---
 4 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 0cd803a..ca36c7a 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -14,12 +14,12 @@ libmount_la_SOURCES =                                \
 libmount_la_CFLAGS =			         \
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"               \
 	@LIBXFCE4PANEL_CFLAGS@				\
-	@LIBXFCEGUI4_CFLAGS@
+	@LIBXFCE4UI_CFLAGS@
 
-libmount_LIBADD =                                \
+libmount_la_LIBADD =                                \
 	@SOLLIBS@                                   			\
 	@LIBXFCE4PANEL_LIBS@				\
-	@LIBXFCEGUI4_LIBS@
+	@LIBXFCE4UI_LIBS@
 
 libmount_la_LDFLAGS = \
 	-avoid-version \
diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c
index 99b52e8..ffdd115 100644
--- a/panel-plugin/devices.c
+++ b/panel-plugin/devices.c
@@ -40,8 +40,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/xfce-exec.h>
-#include <libxfcegui4/dialogs.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include "devices.h"
 
@@ -266,9 +265,9 @@ disk_mount (t_disk *pdisk, char *on_mount_cmd, char* mount_command, gboolean eje
         g_printf ("cmd: '%s'\n", cmd);
         #endif
 
-        val = xfce_exec (cmd, FALSE, FALSE, &error);
+        val = xfce_spawn_command_line_on_screen(gdk_screen_get_default(), cmd, FALSE, TRUE, &error);
         if (!val)
-            xfce_err (_("Mount Plugin: Error executing command."));
+            xfce_dialog_show_error (NULL, error, g_strconcat ("%s Cause:%%s", _("Mount Plugin: Error executing command.")));
 
         g_free(cmd);
         g_free(tmp);
@@ -314,10 +313,10 @@ disk_umount (t_disk *pdisk, char* umount_command, gboolean synchronous, gboolean
         g_printf ("cmd: '%s'\n", tmp);
         #endif
 
-        val = xfce_exec_sync (tmp, FALSE, FALSE, &error);
+        val = xfce_spawn_command_line_on_screen(gdk_screen_get_default(), tmp, FALSE, TRUE, &error);
 
         if  (!val) {
-            xfce_err (_("Mount Plugin: Error executing command."));
+            xfce_dialog_show_error (NULL, error, g_strconcat ("%s Cause:%%s", _("Mount Plugin: Error executing command.")));
             retval = ERROR;
         }
 
diff --git a/panel-plugin/mount-plugin.c b/panel-plugin/mount-plugin.c
index d6f6449..ef2f221 100644
--- a/panel-plugin/mount-plugin.c
+++ b/panel-plugin/mount-plugin.c
@@ -23,6 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #include <stdlib.h>
 
 #include "mount-plugin.h"
+#include <libxfce4ui/libxfce4ui.h>
 
 #ifdef LIBXFCE4PANEL_CHECK_VERSION
 #if LIBXFCE4PANEL_CHECK_VERSION (4,9,0)
@@ -92,12 +93,12 @@ on_activate_disk_display (GtkWidget *widget, t_disk * disk)
 static void
 mounter_set_size (XfcePanelPlugin *plugin, int size, t_mounter *mt)
 {
+   GtkWidget* image;
    /* shrink the gtk button's image to new size -*/
 #ifdef HAS_PANEL_49
    size /= xfce_panel_plugin_get_nrows (plugin);
 #endif
    gtk_widget_set_size_request (GTK_WIDGET(mt->button), size, size);
-
 }
 
 /**
@@ -563,8 +564,8 @@ create_mounter_control (XfcePanelPlugin *plugin)
 
     g_assert (mounter->icon!=NULL);
 
-    mounter->button_pb = gdk_pixbuf_new_from_file (mounter->icon, NULL);
-    mounter->button = xfce_iconbutton_new_from_pixbuf (mounter->button_pb);
+    mounter->button = gtk_button_new ();
+    gtk_button_set_image (GTK_BUTTON(mounter->button), xfce_panel_image_new_from_source (mounter->icon));
     gtk_button_set_relief (GTK_BUTTON(mounter->button), GTK_RELIEF_NONE);
 
     gtk_tooltips_set_tip (tooltips, GTK_WIDGET(mounter->button), _("devices"),
@@ -650,8 +651,7 @@ mounter_apply_options (t_mounter_dialog *md)
                    "%s/icons/hicolor/scalable/apps/xfce-mount.svg",
                    PACKAGE_DATA_DIR );
 
-       mt->button_pb = gdk_pixbuf_new_from_file (mt->icon, NULL);
-       xfce_iconbutton_set_pixbuf (XFCE_ICONBUTTON(mt->button), mt->button_pb);
+    gtk_button_set_image (GTK_BUTTON(mt->button), xfce_panel_image_new_from_source (mt->icon));
 
     TRACE ("leaves mounter_apply_options");
 }
@@ -1057,9 +1057,7 @@ mount_construct (XfcePanelPlugin *plugin)
 
     mounter_read_config (plugin, mounter);
 
-    mounter->button_pb = gdk_pixbuf_new_from_file (mounter->icon, NULL);
-       xfce_iconbutton_set_pixbuf (XFCE_ICONBUTTON(mounter->button),
-                                   mounter->button_pb);
+    gtk_button_set_image (GTK_BUTTON(mounter->button), xfce_panel_image_new_from_source (mounter->icon));
 
 #ifdef HAS_PANEL_49
     xfce_panel_plugin_set_small (plugin, TRUE);
diff --git a/panel-plugin/mount-plugin.h b/panel-plugin/mount-plugin.h
index a3ab916..8b230a3 100644
--- a/panel-plugin/mount-plugin.h
+++ b/panel-plugin/mount-plugin.h
@@ -36,8 +36,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 #include <gtk/gtk.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
-#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
 
 #include <string.h>
 
@@ -75,7 +73,6 @@ typedef struct
     gboolean eject_drives;
     gboolean showed_fstab_dialog;
     GtkWidget *button;
-    GdkPixbuf *button_pb;
     GtkWidget *menu;
     GPtrArray *pdisks; /* contains pointers to struct t_disk */
 } t_mounter;


More information about the Xfce4-commits mailing list