[Xfce4-commits] r30273 - xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager

Nick Schermer nick at xfce.org
Sat Jul 11 12:40:28 CEST 2009


Author: nick
Date: 2009-07-11 10:40:28 +0000 (Sat, 11 Jul 2009)
New Revision: 30273

Modified:
   xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/Makefile.am
   xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/main.c
   xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-settings-manager-dialog.c
   xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-text-renderer.c
Log:
Port settings manager to 4ui.


Modified: xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/Makefile.am
===================================================================
--- xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/Makefile.am	2009-07-11 10:32:18 UTC (rev 30272)
+++ xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/Makefile.am	2009-07-11 10:40:28 UTC (rev 30273)
@@ -21,7 +21,7 @@
 xfce4_settings_manager_CFLAGS = \
 	$(GTK_CFLAGS) \
 	$(LIBXFCE4UTIL_CFLAGS) \
-	$(LIBXFCEGUI4_CFLAGS) \
+	$(LIBXFCE4UI_CFLAGS) \
 	$(XFCONF_CFLAGS) \
 	$(EXO_CFLAGS)
 
@@ -32,7 +32,7 @@
 xfce4_settings_manager_LDADD = \
 	$(GTK_LIBS) \
 	$(LIBXFCE4UTIL_LIBS) \
-	$(LIBXFCEGUI4_LIBS) \
+	$(LIBXFCE4UI_LIBS) \
 	$(XFCONF_LIBS) \
 	$(EXO_LIBS)
 

Modified: xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/main.c
===================================================================
--- xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/main.c	2009-07-11 10:32:18 UTC (rev 30272)
+++ xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/main.c	2009-07-11 10:40:28 UTC (rev 30273)
@@ -97,7 +97,8 @@
 
     gtk_main();
 
-    gtk_widget_destroy(dialog);
+    if(GTK_IS_WIDGET(dialog))
+        gtk_widget_destroy(dialog);
 
     xfconf_shutdown();
 

Modified: xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-settings-manager-dialog.c
===================================================================
--- xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-settings-manager-dialog.c	2009-07-11 10:32:18 UTC (rev 30272)
+++ xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-settings-manager-dialog.c	2009-07-11 10:40:28 UTC (rev 30273)
@@ -35,7 +35,7 @@
 #include <gtk/gtk.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
 #include <exo/exo.h>
 #include <xfconf/xfconf.h>
 
@@ -124,14 +124,12 @@
                                                           XfceSettingsManagerDialog *dialog);
 static GtkWidget *xfce_settings_manager_dialog_recreate_socket(XfceSettingsManagerDialog *dialog);
 #endif
-#if GTK_CHECK_VERSION(2, 12, 0)
 static gboolean xfce_settings_manager_dialog_query_tooltip(GtkWidget *widget,
                                                            gint x,
                                                            gint y,
                                                            gboolean keyboard_tip,
                                                            GtkTooltip *tooltip,
                                                            gpointer data);
-#endif
 
 
 G_DEFINE_TYPE(XfceSettingsManagerDialog, xfce_settings_manager_dialog, XFCE_TYPE_TITLED_DIALOG)
@@ -210,12 +208,10 @@
     g_signal_connect(G_OBJECT(dialog->icon_view), "item-activated",
                      G_CALLBACK(xfce_settings_manager_dialog_item_activated),
                      dialog);
-#if GTK_CHECK_VERSION(2, 12, 0)
     g_object_set(G_OBJECT(dialog->icon_view), "has-tooltip", TRUE, NULL);
     g_signal_connect(G_OBJECT(dialog->icon_view), "query-tooltip",
                      G_CALLBACK(xfce_settings_manager_dialog_query_tooltip),
                      NULL);
-#endif
 
     render = gtk_cell_renderer_pixbuf_new();
     gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dialog->icon_view), render, 
@@ -540,7 +536,7 @@
 {
     XfceSettingsManagerDialog *dialog = user_data;
     GtkTreeIter iter;
-    gchar *exec = NULL, *name, *comment, *icon_name, *primary;
+    gchar *exec = NULL, *name, *comment, *icon_name;
     gboolean snotify = FALSE;
 #ifdef ENABLE_PLUGGABLE_DIALOGS
     gboolean pluggable = FALSE;
@@ -590,19 +586,16 @@
                                   gtk_socket_get_id(GTK_SOCKET(dialog->socket)));
 
         /* Try to spawn the dialog */
-        if(!xfce_exec_on_screen (gtk_widget_get_screen(GTK_WIDGET(iconview)), 
-                                 command, FALSE, snotify, &error))
+        if(!xfce_spawn_command_line_on_screen(gtk_widget_get_screen(GTK_WIDGET(iconview)),
+                                              exec, FALSE, snotify, &error))
         {
             /* Spawning failed, go back to the overview */
             xfce_settings_manager_dialog_recreate_socket(dialog);
             xfce_settings_manager_dialog_reset_view(dialog, TRUE);
 
             /* Notify the user that there has been a problem */
-            primary = g_strdup_printf(_("Unable to start \"%s\""), exec);
-            xfce_message_dialog(GTK_WINDOW(dialog), _("Xfce Settings Manager"),
-                                GTK_STOCK_DIALOG_ERROR, primary, error->message,
-                                GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL);
-            g_free(primary);
+            xfce_dialog_show_error(GTK_WINDOW(dialog), error,
+                _("Unable to start \"%s\""), exec);
             g_error_free(error);
         }
 
@@ -613,15 +606,12 @@
         xfce_settings_manager_dialog_reset_view(dialog, TRUE);
 
         /* Try to spawn the dialog */
-        if (!xfce_exec_on_screen(gtk_widget_get_screen(GTK_WIDGET(iconview)),
-                                 exec, FALSE, snotify, &error))
+        if (!xfce_spawn_command_line_on_screen(gtk_widget_get_screen(GTK_WIDGET(iconview)),
+                                               exec, FALSE, snotify, &error))
         {
             /* Notify the user that there has been a problem */
-            primary = g_strdup_printf(_("Unable to start \"%s\""), exec);
-            xfce_message_dialog(GTK_WINDOW(dialog), _("Xfce Settings Manager"),
-                                GTK_STOCK_DIALOG_ERROR, primary, error->message,
-                                GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL);
-            g_free(primary);
+            xfce_dialog_show_error(GTK_WINDOW(dialog), error,
+                _("Unable to start \"%s\""), exec);
             g_error_free(error);
         }
 #ifdef ENABLE_PLUGGABLE_DIALOGS
@@ -668,8 +658,7 @@
     if(!gdk_spawn_command_line_on_screen(gtk_widget_get_screen(button), 
                                          command, &error))
     {
-        xfce_err(_("Failed to open the documentation. Reason: %s"), 
-                 error->message);
+        xfce_dialog_show_error (NULL, error, _("Failed to open the documentation"));
         g_error_free(error);
     }
 
@@ -792,7 +781,8 @@
     return FALSE;
 }
 
-#if GTK_CHECK_VERSION(2, 12, 0)
+
+
 static gboolean
 xfce_settings_manager_dialog_query_tooltip(GtkWidget *widget,
                                            gint x,
@@ -828,9 +818,9 @@
 
     return TRUE;
 }
-#endif
 
 
+
 GtkWidget *
 xfce_settings_manager_dialog_new(void)
 {

Modified: xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-text-renderer.c
===================================================================
--- xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-text-renderer.c	2009-07-11 10:32:18 UTC (rev 30272)
+++ xfce4-settings/branches/migration-to-4ui/xfce4-settings-manager/xfce-text-renderer.c	2009-07-11 10:40:28 UTC (rev 30273)
@@ -449,11 +449,7 @@
 {
   XfceTextRenderer *text_renderer = XFCE_TEXT_RENDERER (renderer);
   GtkStateType      state;
-#if !GTK_CHECK_VERSION(2,8,0)
-  GdkPoint          points[8];
-#else
   cairo_t          *cr;
-#endif
   gint              x0, x1, y0, y1;
   gint              text_width;
   gint              text_height;
@@ -531,7 +527,6 @@
       x1 = x0 + text_width;
       y1 = y0 + text_height;
 
-#if GTK_CHECK_VERSION(2,8,0)
       /* Cairo produces nicer results than using a polygon
        * and so we use it directly if possible.
        */
@@ -548,20 +543,6 @@
       gdk_cairo_set_source_color (cr, &widget->style->base[state]);
       cairo_fill (cr);
       cairo_destroy (cr);
-#else
-      /* calculate a (more or less rounded) polygon */
-      points[0].x = x0 + 2; points[0].y = y0;
-      points[1].x = x1 - 2; points[1].y = y0;
-      points[2].x = x1;     points[2].y = y0 + 2;
-      points[3].x = x1;     points[3].y = y1 - 2;
-      points[4].x = x1 - 2; points[4].y = y1;
-      points[5].x = x0 + 2; points[5].y = y1;
-      points[6].x = x0;     points[6].y = y1 - 2;
-      points[7].x = x0;     points[7].y = y0 + 2;
-
-      /* render the indicator */
-      gdk_draw_polygon (window, widget->style->base_gc[state], TRUE, points, G_N_ELEMENTS (points));
-#endif
     }
 
   /* draw the focus indicator */




More information about the Xfce4-commits mailing list