[Xfce4-commits] <xfce-utils:master> Port to libxfce4ui.

Nick Schermer noreply at xfce.org
Tue Jan 5 16:24:01 CET 2010


Updating branch refs/heads/master
         to 9e86cab5a43685af349f5bcdeb5196e1354d9e71 (commit)
       from d365f6f09a0f5ea6a86b6c76ba1b0b34f3588397 (commit)

commit 9e86cab5a43685af349f5bcdeb5196e1354d9e71
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Oct 20 17:11:49 2009 +0200

    Port to libxfce4ui.

 configure.in.in         |    2 +-
 xfce4-about/Makefile.am |    4 ++--
 xfce4-about/info.c      |   28 +++++++++++++++++-----------
 xfrun/Makefile.am       |    4 ++--
 xfrun/xfrun-dbus.c      |   16 ++++++++--------
 xfrun/xfrun-dialog.c    |   16 +++++++++-------
 xfrun/xfrun-dialog.h    |    2 +-
 xfrun/xfrun.c           |    3 +--
 8 files changed, 41 insertions(+), 34 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index b1509b5..80ea83b 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -99,7 +99,7 @@ XDT_I18N([@LINGUAS@])
 dnl Check for required packages
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.6.0])
-XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.6.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.7.0])
 
 dnl check for dbus and libdbus-glib
 AM_CONDITIONAL([HAVE_DBUS], [test "x$DBUS_FOUND" = "xyes"])
diff --git a/xfce4-about/Makefile.am b/xfce4-about/Makefile.am
index e386b77..57f3030 100644
--- a/xfce4-about/Makefile.am
+++ b/xfce4-about/Makefile.am
@@ -25,12 +25,12 @@ xfce4_about_SOURCES =							\
 	info.c
 
 xfce4_about_CFLAGS =							\
-	@LIBXFCEGUI4_CFLAGS@						\
+	@LIBXFCE4UI_CFLAGS@						\
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
 	-DDATADIR=\"$(datadir)/xfce4\"
 
 xfce4_about_LDADD =							\
-	@LIBXFCEGUI4_LIBS@
+	@LIBXFCE4UI_LIBS@
 
 EXTRA_DIST = 								\
 	$(about_DATA)
diff --git a/xfce4-about/info.c b/xfce4-about/info.c
index e4275b5..32503af 100644
--- a/xfce4-about/info.c
+++ b/xfce4-about/info.c
@@ -46,7 +46,7 @@
 #endif
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #define SEARCHPATH	(DATADIR G_DIR_SEPARATOR_S "%F.%L:"	\
                          DATADIR G_DIR_SEPARATOR_S "%F.%l:"	\
@@ -66,7 +66,15 @@ static GtkWidget *info;
 static void
 info_help_cb (GtkWidget * w, gpointer data)
 {
-  xfce_exec ("xfhelp4", FALSE, FALSE, NULL);
+  GError *error = NULL;
+
+  if (!gdk_spawn_command_line_on_screen (gtk_widget_get_screen (w),
+                                         "xfhelp4", &error)) {
+    xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (w)),
+                            error, "The command \"%s\" failed to run:",
+                            "xfhelp4");
+    g_error_free (error);
+  }
 }
 
 static gchar *
@@ -194,7 +202,8 @@ add_credits_page (GtkNotebook * notebook, const gchar * name, gboolean hscrollin
   file_authors = fopen (authors_filename, "r");
 
   if (!file_authors) {
-    xfce_err ("%s%s", _("Unable to load "), authors_filename);
+    xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (notebook))),
+                            NULL, _("Unable to load the file %s"), authors_filename);
     g_free (authors_filename);
     return;
   }
@@ -372,7 +381,9 @@ add_page (GtkNotebook * notebook, const gchar * name, const gchar * filename, gb
   }
 
   if (err != NULL) {
-    xfce_err ("%s", err->message);
+    xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (notebook))),
+                            err, _("Unable to load the file %s"),
+                            filename);
     g_error_free (err);
   }
   else {
@@ -412,7 +423,6 @@ main (int argc, char **argv)
   GtkWidget *buttonbox;
   GtkWidget *info_ok_button;
   GtkWidget *info_help_button;
-  GdkPixbuf *logo_pb;
 
   if(argc >= 2 && !strcmp (argv[1], "--xfce-version")) {
 #ifdef RELEASE_LABEL
@@ -431,11 +441,7 @@ main (int argc, char **argv)
   gtk_window_set_title (GTK_WINDOW (info), _("About Xfce 4"));
   xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (info), _("Copyright 2002-2009 by Olivier Fourdan"));
   gtk_dialog_set_has_separator (GTK_DIALOG (info), FALSE);
-  gtk_window_stick (GTK_WINDOW (info));
-
-  logo_pb = xfce_themed_icon_load ("xfce4-logo", 48);
-  gtk_window_set_icon (GTK_WINDOW (info), logo_pb);
-  g_object_unref (logo_pb);
+  gtk_window_set_icon_name (GTK_WINDOW (info), "xfce4-logo");
 
   vbox = gtk_vbox_new (FALSE, BORDER);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER);
@@ -478,7 +484,7 @@ main (int argc, char **argv)
   g_signal_connect (info_ok_button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
   g_signal_connect (info_help_button, "clicked", G_CALLBACK (info_help_cb), NULL);
 
-  xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (info));
+  xfce_gtk_window_center_on_active_screen (GTK_WINDOW (info));
   gtk_widget_show (info);
 
   gtk_main ();
diff --git a/xfrun/Makefile.am b/xfrun/Makefile.am
index 046d39e..65c88bd 100644
--- a/xfrun/Makefile.am
+++ b/xfrun/Makefile.am
@@ -20,13 +20,13 @@ xfrun4_CFLAGS = \
 	-DLOCALEDIR=\"$(localedir)\" \
 	-DDBUS_API_SUBJECT_TO_CHANGE \
 	@LIBXFCE4UTIL_CFLAGS@ \
-	@LIBXFCEGUI4_CFLAGS@ \
+	@LIBXFCE4UI_CFLAGS@ \
 	@GTK_CFLAGS@ \
 	@DBUS_CFLAGS@
 
 xfrun4_LDADD = \
 	@LIBXFCE4UTIL_LIBS@ \
-	@LIBXFCEGUI4_LIBS@ \
+	@LIBXFCE4UI_LIBS@ \
 	@GTK_LIBS@ \
 	@DBUS_LIBS@
 
diff --git a/xfrun/xfrun-dbus.c b/xfrun/xfrun-dbus.c
index 0799c22..e26f3dd 100644
--- a/xfrun/xfrun-dbus.c
+++ b/xfrun/xfrun-dbus.c
@@ -28,6 +28,10 @@
 #include <string.h>
 #endif
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
@@ -37,9 +41,9 @@
 #endif
 
 #include <gtk/gtk.h>
-
+#include <gdk/gdkx.h>
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
@@ -134,7 +138,6 @@ xfrun_handle_dbus_message(DBusConnection *connection,
             dbus_error_free(&derror);
         } else {
             GdkDisplay *gdpy;
-            GdkScreen *gscreen = NULL;
             
             gdpy = xfrun_find_or_open_display(display_name);
             if(!gdpy) {
@@ -147,8 +150,6 @@ xfrun_handle_dbus_message(DBusConnection *connection,
             } else {
                 GtkWidget *dialog;
                 
-                gscreen = gdk_display_get_default_screen(gdpy);
-                
                 if(!strlen(run_argument))
                     run_argument = NULL;
                 
@@ -172,8 +173,7 @@ xfrun_handle_dbus_message(DBusConnection *connection,
                 }
                 
                 /* this handles setting the dialog to the right screen */
-                xfce_gtk_window_center_on_monitor(GTK_WINDOW(dialog),
-                                                  gscreen, 0);
+                xfce_gtk_window_center_on_active_screen(GTK_WINDOW(dialog));
                 xfrun_dialog_select_text(XFRUN_DIALOG(dialog));
                 gtk_widget_show(dialog);
             
@@ -393,7 +393,7 @@ main(int argc,
                                               TRUE);
             g_signal_connect(G_OBJECT(fallback_dialog), "destroy",
                              G_CALLBACK(gtk_main_quit), NULL);
-            xfce_gtk_window_center_on_monitor_with_pointer(GTK_WINDOW(fallback_dialog));
+            xfce_gtk_window_center_on_active_screen(GTK_WINDOW(fallback_dialog));
             gtk_widget_show(fallback_dialog);
             
             gtk_main();
diff --git a/xfrun/xfrun-dialog.c b/xfrun/xfrun-dialog.c
index 92aee3c..14ab6c6 100644
--- a/xfrun/xfrun-dialog.c
+++ b/xfrun/xfrun-dialog.c
@@ -36,7 +36,8 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include "xfrun-dialog.h"
 
@@ -77,6 +78,7 @@ enum
     XFRUN_N_COLS,
 };
 
+
 static void xfrun_dialog_set_property(GObject *object,
                                       guint property_id,
                                       const GValue *value,
@@ -203,7 +205,7 @@ xfrun_dialog_init(XfrunDialog *dialog)
     g_signal_connect_swapped(G_OBJECT(btn), "clicked",
                              G_CALLBACK(xfrun_dialog_delete_event), dialog);
     
-    btn = xfce_create_mixed_button(GTK_STOCK_EXECUTE, _("_Run"));
+    btn = xfce_gtk_button_new_mixed(GTK_STOCK_EXECUTE, _("_Run"));
     gtk_widget_show(btn);
     gtk_box_pack_end(GTK_BOX(bbox), btn, FALSE, FALSE, 0);
     GTK_WIDGET_SET_FLAGS(btn, GTK_CAN_DEFAULT);
@@ -525,11 +527,11 @@ xfrun_run_clicked(GtkWidget *widget,
         g_shell_parse_argv(cmdline, &argc, &argv, &error);
     }
     
-    if(argv && xfce_gdk_spawn_on_screen(gscreen,
-                                        dialog->priv->working_directory,
-                                        argv, NULL, G_SPAWN_SEARCH_PATH,
-                                        xfrun_spawn_child_setup, NULL, NULL,
-                                        &error))
+    if(argv && gdk_spawn_on_screen(gscreen,
+                                   dialog->priv->working_directory,
+                                   argv, NULL, G_SPAWN_SEARCH_PATH,
+                                   xfrun_spawn_child_setup, NULL, NULL,
+                                   &error))
     {
         xfrun_add_to_history(cmdline, in_terminal);
         xfrun_dialog_delete_event(GTK_WIDGET(dialog), NULL);
diff --git a/xfrun/xfrun-dialog.h b/xfrun/xfrun-dialog.h
index a28994d..bb64c17 100644
--- a/xfrun/xfrun-dialog.h
+++ b/xfrun/xfrun-dialog.h
@@ -49,7 +49,7 @@ struct _XfrunDialogClass
     void (*closed)(XfrunDialog *dialog);
 };
 
-GType xfrun_dialog_get_type                        () G_GNUC_CONST;
+GType xfrun_dialog_get_type                        (void) G_GNUC_CONST;
 
 GtkWidget *xfrun_dialog_new                        (const gchar *run_argument);
 
diff --git a/xfrun/xfrun.c b/xfrun/xfrun.c
index f17380d..9fe6adc 100644
--- a/xfrun/xfrun.c
+++ b/xfrun/xfrun.c
@@ -29,7 +29,6 @@
 #include <gtk/gtk.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
 
 #include "xfrun-dialog.h"
 
@@ -58,7 +57,7 @@ main(int argc,
     }
     
     dialog = xfrun_dialog_new(run_argument);
-    xfce_gtk_window_center_on_monitor_with_pointer(GTK_WINDOW(dialog));
+    xfce_gtk_window_center_on_active_screen(GTK_WINDOW(dialog));
     gtk_widget_show(dialog);
     g_signal_connect(G_OBJECT(dialog), "closed",
                      G_CALLBACK(gtk_main_quit), NULL);



More information about the Xfce4-commits mailing list