gnome-commander r2512 - in trunk: plugins/cvs plugins/fileroller plugins/test src



Author: epiotr
Date: Mon Apr  6 16:56:25 2009
New Revision: 2512
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2512&view=rev

Log:
Code cleanup

Modified:
   trunk/plugins/cvs/interface.c
   trunk/plugins/cvs/interface.h
   trunk/plugins/fileroller/file-roller-plugin.c
   trunk/plugins/test/test-plugin.c
   trunk/src/gnome-cmd-con.cc
   trunk/src/gnome-cmd-file-props-dialog.cc

Modified: trunk/plugins/cvs/interface.c
==============================================================================
--- trunk/plugins/cvs/interface.c	(original)
+++ trunk/plugins/cvs/interface.c	Mon Apr  6 16:56:25 2009
@@ -38,12 +38,11 @@
 static GtkWidget *create_compare_win (LogHistory *log_history);
 
 
-static void
-on_rev_list_select_row                 (GtkCList        *clist,
-                                        gint             row,
-                                        gint             column,
-                                        GdkEvent        *event,
-                                        LogHistory      *log_history)
+static void on_rev_list_select_row  (GtkCList *clist,
+                                     gint row,
+                                     gint column,
+                                     GdkEvent *event,
+                                     LogHistory *log_history)
 {
     Revision *rev = (Revision *)gtk_clist_get_row_data (clist, row);
 
@@ -134,12 +133,13 @@
 static Revision *find_prev_rev (LogHistory *h, Revision *rev)
 {
     GList *l = g_list_find (h->revisions, rev);
-    if (!l) return NULL;
+
+    if (!l)
+        return NULL;
 
     l = l->next;
-    if (!l) return NULL;
 
-    return (Revision *) l->data;
+    return l ? (Revision *) l->data : NULL;
 }
 
 
@@ -543,8 +543,7 @@
         gtk_clist_set_row_data (GTK_CLIST (rev_list), row, rev);
     }
 
-    gtk_signal_connect (GTK_OBJECT (rev_list), "select-row",
-                        GTK_SIGNAL_FUNC (on_rev_list_select_row), log_history);
+    gtk_signal_connect (GTK_OBJECT (rev_list), "select-row", GTK_SIGNAL_FUNC (on_rev_list_select_row), log_history);
 
     gtk_clist_select_row (GTK_CLIST (rev_list), 0, 0);
 }

Modified: trunk/plugins/cvs/interface.h
==============================================================================
--- trunk/plugins/cvs/interface.h	(original)
+++ trunk/plugins/cvs/interface.h	Mon Apr  6 16:56:25 2009
@@ -18,7 +18,7 @@
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
-GtkWidget *create_log_win  (CvsPlugin *plugin);
+GtkWidget *create_log_win (CvsPlugin *plugin);
 GtkWidget *create_diff_win (CvsPlugin *plugin);
 
 void add_log_tab (CvsPlugin *plugin, const gchar *fname);

Modified: trunk/plugins/fileroller/file-roller-plugin.c
==============================================================================
--- trunk/plugins/fileroller/file-roller-plugin.c	(original)
+++ trunk/plugins/fileroller/file-roller-plugin.c	Mon Apr  6 16:56:25 2009
@@ -357,9 +357,7 @@
     GtkWidget *dialog, *table, *cat, *label, *combo, *vbox;
 
     dialog = gnome_cmd_dialog_new (_("Options"));
-    gnome_cmd_dialog_set_transient_for (
-        GNOME_CMD_DIALOG (dialog),
-        GTK_WINDOW (main_win_widget));
+    gnome_cmd_dialog_set_transient_for (GNOME_CMD_DIALOG (dialog), GTK_WINDOW (main_win_widget));
     gnome_cmd_dialog_set_modal (GNOME_CMD_DIALOG (dialog));
 
     gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (dialog), GTK_STOCK_OK,
@@ -480,12 +478,11 @@
 {
     if (!plugin_nfo.authors)
     {
-        plugin_nfo.authors = g_new (gchar*, 2);
+        plugin_nfo.authors = g_new0 (gchar *, 2);
         plugin_nfo.authors[0] = AUTHOR;
         plugin_nfo.authors[1] = NULL;
-        plugin_nfo.comments = g_strdup (
-            _("A plugin that adds File Roller shortcuts for creating "
-              "and extracting compressed archives."));
+        plugin_nfo.comments = g_strdup (_("A plugin that adds File Roller shortcuts for creating "
+                                          "and extracting compressed archives."));
     }
     return &plugin_nfo;
 }

Modified: trunk/plugins/test/test-plugin.c
==============================================================================
--- trunk/plugins/test/test-plugin.c	(original)
+++ trunk/plugins/test/test-plugin.c	Mon Apr  6 16:56:25 2009
@@ -89,9 +89,7 @@
     gtk_container_add (GTK_CONTAINER (item), label);
 
     // Connect to the signal and set user data
-    gtk_object_set_data (GTK_OBJECT (item),
-                         GNOMEUIINFO_KEY_UIDATA,
-                         data);
+    gtk_object_set_data (GTK_OBJECT (item), GNOMEUIINFO_KEY_UIDATA, data);
 
     if (callback)
         gtk_signal_connect (GTK_OBJECT (item), "activate", callback, data);
@@ -120,18 +118,17 @@
 static GList *create_popup_menu_items (GnomeCmdPlugin *plugin, GnomeCmdState *state)
 {
     GtkWidget *item = create_menu_item ("Test plugin dummy operation", TRUE, GTK_SIGNAL_FUNC (on_dummy), state);
+
     return g_list_append (NULL, item);
 }
 
 
-static void
-update_main_menu_state (GnomeCmdPlugin *plugin, GnomeCmdState *state)
+static void update_main_menu_state (GnomeCmdPlugin *plugin, GnomeCmdState *state)
 {
 }
 
 
-static void
-configure (GnomeCmdPlugin *plugin)
+static void configure (GnomeCmdPlugin *plugin)
 {
     gnome_ok_dialog ("Test plugin configuration dialog");
 }
@@ -143,8 +140,7 @@
  * Gtk class implementation
  *******************************/
 
-static void
-destroy (GtkObject *object)
+static void destroy (GtkObject *object)
 {
     //TestPlugin *plugin = TEST_PLUGIN (object);
 
@@ -182,8 +178,7 @@
  * Public functions
  ***********************************/
 
-GtkType
-test_plugin_get_type ()
+GtkType test_plugin_get_type ()
 {
     static GtkType type = 0;
 
@@ -209,9 +204,7 @@
 
 GnomeCmdPlugin *test_plugin_new ()
 {
-    TestPlugin *plugin;
-
-    plugin = gtk_type_new (test_plugin_get_type ());
+    TestPlugin *plugin = gtk_type_new (test_plugin_get_type ());
 
     return GNOME_CMD_PLUGIN (plugin);
 }
@@ -227,12 +220,12 @@
 {
     if (!plugin_nfo.authors)
     {
-        plugin_nfo.authors = g_new (gchar*, 2);
+        plugin_nfo.authors = g_new0 (gchar *, 2);
         plugin_nfo.authors[0] = AUTHOR;
         plugin_nfo.authors[1] = NULL;
-        plugin_nfo.comments = g_strdup (
-            _("This is an example plugin that is mostly useful as a "
-              "simple example for aspiring plugin hackers"));
+        plugin_nfo.comments = g_strdup (_("This is an example plugin that is mostly useful as a "
+                                          "simple example for aspiring plugin hackers"));
     }
+
     return &plugin_nfo;
 }

Modified: trunk/src/gnome-cmd-con.cc
==============================================================================
--- trunk/src/gnome-cmd-con.cc	(original)
+++ trunk/src/gnome-cmd-con.cc	Mon Apr  6 16:56:25 2009
@@ -465,7 +465,7 @@
     GnomeVFSResult res = gnome_vfs_get_file_info_uri (uri, info, GNOME_VFS_FILE_INFO_DEFAULT);
 
     if (res == GNOME_VFS_OK && info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK)         // resolve the symlink to get the real type of it
-        res = gnome_vfs_get_file_info_uri (uri, info, (GnomeVFSFileInfoOptions) (GNOME_VFS_FILE_INFO_DEFAULT | GNOME_VFS_FILE_INFO_FOLLOW_LINKS));
+        res = gnome_vfs_get_file_info_uri (uri, info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
 
     if (res == GNOME_VFS_OK)
         *type = info->type;

Modified: trunk/src/gnome-cmd-file-props-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-file-props-dialog.cc	(original)
+++ trunk/src/gnome-cmd-file-props-dialog.cc	Mon Apr  6 16:56:25 2009
@@ -78,7 +78,6 @@
 
 static void calc_tree_size_r (GnomeCmdFilePropsDialogPrivate *data, GnomeVFSURI *uri)
 {
-    GnomeVFSFileInfoOptions infoOpts = GNOME_VFS_FILE_INFO_DEFAULT;
     GList *list = NULL;
     gchar *uri_str;
 
@@ -89,7 +88,7 @@
     uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
     if (!uri_str) return;
 
-    GnomeVFSResult result = gnome_vfs_directory_list_load (&list, uri_str, infoOpts);
+    GnomeVFSResult result = gnome_vfs_directory_list_load (&list, uri_str, GNOME_VFS_FILE_INFO_DEFAULT);
 
     if (result != GNOME_VFS_OK) return;
     if (!list) return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]