[Xfce4-commits] <xfce4-clipman-plugin:master> Make compiler happy

Mike Massonnet noreply at xfce.org
Sat Dec 19 14:58:01 CET 2009


Updating branch refs/heads/master
         to 9842554f3fb37fa2fa49fce5662f0fcecde61f76 (commit)
       from 3805c9f3cac01dfcfd875d262363bf85cdad39d2 (commit)

commit 9842554f3fb37fa2fa49fce5662f0fcecde61f76
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sat Dec 19 14:47:34 2009 +0100

    Make compiler happy
    
    Ran the code with debug on and fixed all the warnings.

 daemon/gsd-clipboard-manager.c        |   21 +++++-------
 panel-plugin/actions.c                |   56 +++++++++++++++++----------------
 panel-plugin/collector.c              |    4 +--
 panel-plugin/history.c                |    4 +--
 panel-plugin/main-status-icon.c       |    8 +---
 panel-plugin/menu.c                   |    4 +--
 panel-plugin/plugin.c                 |   11 +++---
 panel-plugin/plugin.h                 |    4 +-
 panel-plugin/xfce4-clipman-settings.c |   44 ++++++++++++++------------
 9 files changed, 75 insertions(+), 81 deletions(-)

diff --git a/daemon/gsd-clipboard-manager.c b/daemon/gsd-clipboard-manager.c
index d36f839..494bb44 100644
--- a/daemon/gsd-clipboard-manager.c
+++ b/daemon/gsd-clipboard-manager.c
@@ -33,6 +33,8 @@
 
 #define GSD_CLIPBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManagerPrivate))
 
+G_DEFINE_TYPE (GsdClipboardManager, gsd_clipboard_manager, G_TYPE_OBJECT)
+
 struct GsdClipboardManagerPrivate
 {
         GtkClipboard *default_clipboard;
@@ -48,14 +50,8 @@ struct GsdClipboardManagerPrivate
         GtkWidget    *window;
 };
 
-static void     gsd_clipboard_manager_class_init  (GsdClipboardManagerClass *klass);
-static void     gsd_clipboard_manager_init        (GsdClipboardManager      *clipboard_manager);
 static void     gsd_clipboard_manager_finalize    (GObject                  *object);
 
-G_DEFINE_TYPE (GsdClipboardManager, gsd_clipboard_manager, G_TYPE_OBJECT)
-
-static gpointer manager_object = NULL;
-
 
 Atom XA_CLIPBOARD_MANAGER;
 Atom XA_MANAGER;
@@ -448,13 +444,14 @@ gsd_clipboard_manager_finalize (GObject *object)
 GsdClipboardManager *
 gsd_clipboard_manager_new (void)
 {
-        if (manager_object != NULL) {
-                g_object_ref (manager_object);
+        static gpointer singleton = NULL;
+
+        if (singleton != NULL) {
+                g_object_ref (singleton);
         } else {
-                manager_object = g_object_new (GSD_TYPE_CLIPBOARD_MANAGER, NULL);
-                g_object_add_weak_pointer (manager_object,
-                                           (gpointer *) &manager_object);
+                singleton = g_object_new (GSD_TYPE_CLIPBOARD_MANAGER, NULL);
+                g_object_add_weak_pointer (singleton, (gpointer *) &singleton);
         }
 
-        return GSD_CLIPBOARD_MANAGER (manager_object);
+        return GSD_CLIPBOARD_MANAGER (singleton);
 }
diff --git a/panel-plugin/actions.c b/panel-plugin/actions.c
index 09c9d19..589eba5 100644
--- a/panel-plugin/actions.c
+++ b/panel-plugin/actions.c
@@ -60,8 +60,6 @@ struct _ClipmanActionsPrivate
   GtkWidget            *menu;
 };
 
-static void             clipman_actions_class_init          (ClipmanActionsClass *klass);
-static void             clipman_actions_init                (ClipmanActions *actions);
 static void             clipman_actions_finalize            (GObject *object);
 
 /*
@@ -755,17 +753,19 @@ clipman_actions_match_with_menu (ClipmanActions *actions,
       gtk_container_add (GTK_CONTAINER (actions->priv->menu), mi);
 
 #if GLIB_CHECK_VERSION (2,16,0)
-      GHashTableIter iter;
-      gpointer key, value;
-      g_hash_table_iter_init (&iter, entry->commands);
-      while (g_hash_table_iter_next (&iter, &key, &value))
         {
-          mi = gtk_menu_item_new_with_label ((const gchar *)key);
-          g_object_set_data (G_OBJECT (mi), "text", g_object_get_data (G_OBJECT (actions->priv->menu), "text"));
-          g_object_set_data (G_OBJECT (mi), "command", value);
-          g_object_set_data (G_OBJECT (mi), "regex", entry->regex);
-          gtk_container_add (GTK_CONTAINER (actions->priv->menu), mi);
-          g_signal_connect (mi, "activate", G_CALLBACK (cb_entry_activated), NULL);
+          GHashTableIter iter;
+          gpointer key, value;
+          g_hash_table_iter_init (&iter, entry->commands);
+          while (g_hash_table_iter_next (&iter, &key, &value))
+            {
+              mi = gtk_menu_item_new_with_label ((const gchar *)key);
+              g_object_set_data (G_OBJECT (mi), "text", g_object_get_data (G_OBJECT (actions->priv->menu), "text"));
+              g_object_set_data (G_OBJECT (mi), "command", value);
+              g_object_set_data (G_OBJECT (mi), "regex", entry->regex);
+              gtk_container_add (GTK_CONTAINER (actions->priv->menu), mi);
+              g_signal_connect (mi, "activate", G_CALLBACK (cb_entry_activated), NULL);
+            }
         }
 #else
       g_object_set_data (G_OBJECT (actions->priv->menu), "regex", entry->regex);
@@ -800,12 +800,12 @@ clipman_actions_load (ClipmanActions *actions)
   GMarkupParseContext *context;
   EntryParser *parser;
 
-  load = g_file_load_contents (actions->priv->file, NULL, &data, &size, NULL, NULL);
+  load = g_file_load_contents (actions->priv->file, NULL, &data, (gsize*)&size, NULL, NULL);
 
   if (!load)
     {
       filename = g_strdup (SYSCONFDIR"/xdg/xfce4/panel/xfce4-clipman-actions.xml");
-      load = g_file_get_contents (filename, &data, &size, NULL);
+      load = g_file_get_contents (filename, &data, (gsize*)&size, NULL);
       g_free (filename);
     }
 
@@ -867,22 +867,24 @@ clipman_actions_save (ClipmanActions *actions)
       g_string_append (output, "\t\t<commands>\n");
 
 #if GLIB_CHECK_VERSION (2,16,0)
-      GHashTableIter iter;
-      gpointer key, value;
-      g_hash_table_iter_init (&iter, entry->commands);
-      while (g_hash_table_iter_next (&iter, &key, &value))
         {
-          g_string_append (output, "\t\t\t<command>\n");
+          GHashTableIter iter;
+          gpointer key, value;
+          g_hash_table_iter_init (&iter, entry->commands);
+          while (g_hash_table_iter_next (&iter, &key, &value))
+            {
+              g_string_append (output, "\t\t\t<command>\n");
 
-          tmp = g_markup_escape_text (key, -1);
-          g_string_append_printf (output, "\t\t\t\t<name>%s</name>\n", tmp);
-          g_free (tmp);
+              tmp = g_markup_escape_text (key, -1);
+              g_string_append_printf (output, "\t\t\t\t<name>%s</name>\n", tmp);
+              g_free (tmp);
 
-          tmp = g_markup_escape_text (value, -1);
-          g_string_append_printf (output, "\t\t\t\t<exec>%s</exec>\n", tmp);
-          g_free (tmp);
+              tmp = g_markup_escape_text (value, -1);
+              g_string_append_printf (output, "\t\t\t\t<exec>%s</exec>\n", tmp);
+              g_free (tmp);
 
-          g_string_append (output, "\t\t\t</command>\n");
+              g_string_append (output, "\t\t\t</command>\n");
+            }
         }
 #else
       g_hash_table_foreach (entry->commands, (GHFunc)__foreach_command_write_xml, output);
@@ -910,7 +912,7 @@ clipman_actions_save (ClipmanActions *actions)
  *
  */
 ClipmanActions *
-clipman_actions_get ()
+clipman_actions_get (void)
 {
   static ClipmanActions *singleton = NULL;
 
diff --git a/panel-plugin/collector.c b/panel-plugin/collector.c
index 4b3eafb..935c4b4 100644
--- a/panel-plugin/collector.c
+++ b/panel-plugin/collector.c
@@ -58,8 +58,6 @@ enum
   ENABLE_ACTIONS,
 };
 
-static void             clipman_collector_class_init        (ClipmanCollectorClass *klass);
-static void             clipman_collector_init              (ClipmanCollector *collector);
 static void             clipman_collector_constructed       (GObject *object);
 static void             clipman_collector_finalize          (GObject *object);
 static void             clipman_collector_set_property      (GObject *object,
@@ -200,7 +198,7 @@ clipman_collector_set_is_restoring (ClipmanCollector *collector)
 }
 
 ClipmanCollector *
-clipman_collector_get ()
+clipman_collector_get (void)
 {
   static ClipmanCollector *singleton = NULL;
 
diff --git a/panel-plugin/history.c b/panel-plugin/history.c
index eb076c3..e717bdd 100644
--- a/panel-plugin/history.c
+++ b/panel-plugin/history.c
@@ -62,8 +62,6 @@ enum
 };
 static guint signals[LAST_SIGNAL];
 
-static void             clipman_history_class_init         (ClipmanHistoryClass *klass);
-static void             clipman_history_init               (ClipmanHistory *history);
 static void             clipman_history_finalize           (GObject *object);
 static void             clipman_history_set_property       (GObject *object,
                                                             guint property_id,
@@ -364,7 +362,7 @@ clipman_history_clear (ClipmanHistory *history)
 }
 
 ClipmanHistory *
-clipman_history_get ()
+clipman_history_get (void)
 {
   static ClipmanHistory *singleton = NULL;
 
diff --git a/panel-plugin/main-status-icon.c b/panel-plugin/main-status-icon.c
index ded195b..b2e106e 100644
--- a/panel-plugin/main-status-icon.c
+++ b/panel-plugin/main-status-icon.c
@@ -42,8 +42,6 @@ static void             cb_status_icon_popup_menu       (MyPlugin *plugin,
                                                          guint button,
                                                          guint activate_time);
 static void             cb_status_icon_quit             (MyPlugin *plugin);
-static gboolean         cb_status_icon_set_size         (MyPlugin *plugin,
-                                                         gint size);
 static void             cb_status_icon_finalize         (MyPlugin *plugin);
 static void             install_autostart_file          ();
 static void             update_autostart_file           ();
@@ -76,7 +74,7 @@ main (gint argc,
  */
 
 static MyPlugin *
-status_icon_register ()
+status_icon_register (void)
 {
   MyPlugin *plugin = plugin_register ();
 
@@ -165,11 +163,10 @@ cb_status_icon_finalize (MyPlugin *plugin)
 }
 
 static void
-install_autostart_file ()
+install_autostart_file (void)
 {
   gchar *sysfile;
   gchar *userfile;
-  gint res;
   GKeyFile *keyfile;
   gchar *data;
 
@@ -207,7 +204,6 @@ static void
 update_autostart_file (gboolean autostart)
 {
   gchar *userfile;
-  gint res;
   GKeyFile *keyfile;
   gchar *data;
 
diff --git a/panel-plugin/menu.c b/panel-plugin/menu.c
index c11d1c3..5a673c5 100644
--- a/panel-plugin/menu.c
+++ b/panel-plugin/menu.c
@@ -51,8 +51,6 @@ enum
   REVERSE_ORDER = 1,
 };
 
-static void             clipman_menu_class_init         (ClipmanMenuClass *klass);
-static void             clipman_menu_init               (ClipmanMenu *menu);
 static void             clipman_menu_finalize           (GObject *object);
 static void             clipman_menu_set_property       (GObject *object,
                                                          guint property_id,
@@ -225,7 +223,7 @@ _clipman_menu_free_list (ClipmanMenu *menu)
  */
 
 GtkWidget *
-clipman_menu_new ()
+clipman_menu_new (void)
 {
   return g_object_new (CLIPMAN_TYPE_MENU, NULL);
 }
diff --git a/panel-plugin/plugin.c b/panel-plugin/plugin.c
index c5a11b2..e49fb2c 100644
--- a/panel-plugin/plugin.c
+++ b/panel-plugin/plugin.c
@@ -20,6 +20,7 @@
 #include <config.h>
 #endif
 
+#include <glib/gstdio.h>
 #include <X11/Xlib.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
@@ -50,7 +51,7 @@ static gboolean         xfce_popup_grab_available       (GdkWindow *win,
 
 
 static gboolean
-clipboard_manager_ownership_exists ()
+clipboard_manager_ownership_exists (void)
 {
   Display *display;
   Atom atom;
@@ -65,7 +66,7 @@ clipboard_manager_ownership_exists ()
  */
 
 MyPlugin *
-plugin_register ()
+plugin_register (void)
 {
   MyPlugin *plugin = g_slice_new0 (MyPlugin);
 
@@ -258,7 +259,7 @@ plugin_free (MyPlugin *plugin)
 
 #ifdef PANEL_PLUGIN
   gtk_widget_destroy (plugin->button);
-#elif STATUS_ICON
+#elif defined (STATUS_ICON)
   gtk_widget_destroy (plugin->popup_menu);
 #endif
 
@@ -349,7 +350,7 @@ plugin_popup_menu (MyPlugin *plugin)
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->button), TRUE);
       xfce_panel_plugin_register_menu (plugin->panel_plugin, GTK_MENU (plugin->menu));
     }
-#elif STATUS_ICON
+#elif defined (STATUS_ICON)
   gtk_menu_set_screen (GTK_MENU (plugin->menu), gtk_status_icon_get_screen (plugin->status_icon));
   gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
                   plugin->menu_position_func, plugin->status_icon,
@@ -403,7 +404,7 @@ cb_popup_message_received (MyPlugin *plugin,
      * a keyboard shortcut to the popup command doesn't always work out... */
 #ifdef PANEL_PLUGIN
     GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (plugin->button));
-#elif STATUS_ICON
+#elif defined (STATUS_ICON)
     GdkScreen *screen = gtk_status_icon_get_screen (plugin->status_icon);
 #endif
     GdkWindow *root = gdk_screen_get_root_window (screen);
diff --git a/panel-plugin/plugin.h b/panel-plugin/plugin.h
index 2cbccd1..f0bb7e4 100644
--- a/panel-plugin/plugin.h
+++ b/panel-plugin/plugin.h
@@ -46,7 +46,7 @@ struct _MyPlugin
   XfcePanelPlugin      *panel_plugin;
   GtkWidget            *button;
   GtkWidget            *image;
-#elif STATUS_ICON
+#elif defined (STATUS_ICON)
   GtkStatusIcon        *status_icon;
 #endif
   GsdClipboardManager  *daemon;
@@ -70,7 +70,7 @@ void                    plugin_save                     (MyPlugin *plugin);
 void                    plugin_free                     (MyPlugin *plugin);
 void                    plugin_about                    (MyPlugin *plugin);
 void                    plugin_configure                (MyPlugin *plugin);
-void                    plugin_menu_popup               (MyPlugin *plugin);
+void                    plugin_popup_menu               (MyPlugin *plugin);
 
 #endif /* !__CLIPMAN_PLUGIN_H__ */
 
diff --git a/panel-plugin/xfce4-clipman-settings.c b/panel-plugin/xfce4-clipman-settings.c
index d741798..170e657 100644
--- a/panel-plugin/xfce4-clipman-settings.c
+++ b/panel-plugin/xfce4-clipman-settings.c
@@ -28,6 +28,7 @@
 #include <unique/unique.h>
 #endif
 
+#include <glib/gstdio.h>
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 #include <libxfcegui4/libxfcegui4.h>
@@ -77,7 +78,7 @@ static guint test_regex_changed_timeout = 0;
 
 
 static void
-prop_dialog_run ()
+prop_dialog_run (void)
 {
   GtkWidget *action_dialog;
 
@@ -387,15 +388,17 @@ cb_actions_row_activated (GtkTreeView *treeview,
 
   commands_model = gtk_tree_view_get_model (GTK_TREE_VIEW (glade_xml_get_widget (gxml, "commands")));
 #if GLIB_CHECK_VERSION (2,16,0)
-  GHashTableIter hiter;
-  gpointer key, value;
-  g_hash_table_iter_init (&hiter, entry->commands);
-  while (g_hash_table_iter_next (&hiter, &key, &value))
     {
-      title = g_markup_printf_escaped ("<b>%s</b>\n<small>%s</small>", (gchar *)key, (gchar *)value);
-      gtk_list_store_append (GTK_LIST_STORE (commands_model), &iter);
-      gtk_list_store_set (GTK_LIST_STORE (commands_model), &iter, 0, title, 1, key, 2, value, -1);
-      g_free (title);
+      GHashTableIter hiter;
+      gpointer key, value;
+      g_hash_table_iter_init (&hiter, entry->commands);
+      while (g_hash_table_iter_next (&hiter, &key, &value))
+        {
+          title = g_markup_printf_escaped ("<b>%s</b>\n<small>%s</small>", (gchar *)key, (gchar *)value);
+          gtk_list_store_append (GTK_LIST_STORE (commands_model), &iter);
+          gtk_list_store_set (GTK_LIST_STORE (commands_model), &iter, 0, title, 1, key, 2, value, -1);
+          g_free (title);
+        }
     }
 #else
   g_hash_table_foreach (entry->commands, (GHFunc)__foreach_command_fill_commands, commands_model);
@@ -488,7 +491,7 @@ setup_commands_treeview (GtkTreeView *treeview)
 }
 
 static void
-entry_dialog_cleanup ()
+entry_dialog_cleanup (void)
 {
   GtkTreeModel *model;
 
@@ -639,7 +642,7 @@ cb_delete_command (GtkButton *button)
 
 /* Regex dialog */
 static void
-setup_test_regex_dialog ()
+setup_test_regex_dialog (void)
 {
   GtkWidget *textview;
   GtkTextBuffer *buffer;
@@ -665,7 +668,6 @@ cb_test_regex (GtkButton *button)
   GtkWidget *regex;
   GtkWidget *dialog;
   GtkWidget *entry;
-  GtkWidget *textview;
   const gchar *pattern;
 
   regex = glade_xml_get_widget (gxml, "regex");
@@ -700,7 +702,7 @@ cb_test_regex_changed (GtkWidget *widget)
 }
 
 static gboolean
-cb_test_regex_changed_timeout ()
+cb_test_regex_changed_timeout (void)
 {
   update_test_regex_textview_tags ();
   test_regex_changed_timeout = 0;
@@ -708,7 +710,7 @@ cb_test_regex_changed_timeout ()
 }
 
 static void
-update_test_regex_textview_tags ()
+update_test_regex_textview_tags (void)
 {
   GtkWidget *entry;
   GtkWidget *textview;
@@ -845,16 +847,18 @@ main (gint argc,
   gtk_init (&argc, &argv);
 
 #ifdef HAVE_UNIQUE
-  UniqueApp *app = unique_app_new ("org.xfce.Clipman", NULL);
-  if (unique_app_is_running (app))
     {
-      if (unique_app_send_message (app, UNIQUE_ACTIVATE, NULL) == UNIQUE_RESPONSE_OK)
+      UniqueApp *app = unique_app_new ("org.xfce.Clipman", NULL);
+      if (unique_app_is_running (app))
         {
-          g_object_unref (app);
-          return;
+          if (unique_app_send_message (app, UNIQUE_ACTIVATE, NULL) == UNIQUE_RESPONSE_OK)
+            {
+              g_object_unref (app);
+              return 0;
+            }
         }
+      g_signal_connect (app, "message-received", G_CALLBACK (cb_unique_app), NULL);
     }
-  g_signal_connect (app, "message-received", G_CALLBACK (cb_unique_app), NULL);
 #endif
 
   xfconf_channel = xfconf_channel_new_with_property_base ("xfce4-panel", "/plugins/clipman");



More information about the Xfce4-commits mailing list