gnome-commander r2160 - in branches/gcmd-1-3: plugins/cvs src/intviewer



Author: epiotr
Date: Tue Oct  7 17:10:47 2008
New Revision: 2160
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2160&view=rev

Log:
Code cleanup

Modified:
   branches/gcmd-1-3/plugins/cvs/cvs-plugin.c
   branches/gcmd-1-3/plugins/cvs/cvs-plugin.h
   branches/gcmd-1-3/plugins/cvs/interface.c
   branches/gcmd-1-3/plugins/cvs/interface.h
   branches/gcmd-1-3/src/intviewer/viewer-window.cc

Modified: branches/gcmd-1-3/plugins/cvs/cvs-plugin.c
==============================================================================
--- branches/gcmd-1-3/plugins/cvs/cvs-plugin.c	(original)
+++ branches/gcmd-1-3/plugins/cvs/cvs-plugin.c	Tue Oct  7 17:10:47 2008
@@ -77,15 +77,13 @@
 static GnomeCmdPluginClass *parent_class = NULL;
 
 
-static void
-on_dummy (GtkMenuItem *item, gpointer data)
+static void on_dummy (GtkMenuItem *item, gpointer data)
 {
     gnome_ok_dialog ("CVS plugin dummy operation");
 }
 
 
-static gboolean
-change_cwd (const gchar *fpath)
+static gboolean change_cwd (const gchar *fpath)
 {
     gchar *dir = g_path_get_dirname (fpath);
 
@@ -101,8 +99,7 @@
 }
 
 
-static void
-on_diff (GtkMenuItem *item, GnomeCmdState *state)
+static void on_diff (GtkMenuItem *item, GnomeCmdState *state)
 {
     GList *files = state->active_dir_selected_files;
     CvsPlugin *plugin = gtk_object_get_data (GTK_OBJECT (item), "plugin");
@@ -129,8 +126,7 @@
 }
 
 
-static void
-on_log (GtkMenuItem *item, GnomeCmdState *state)
+static void on_log (GtkMenuItem *item, GnomeCmdState *state)
 {
     GList *files = state->active_dir_selected_files;
     CvsPlugin *plugin = gtk_object_get_data (GTK_OBJECT (item), "plugin");
@@ -141,8 +137,7 @@
     for (; files; files = files->next)
     {
         GnomeCmdFileInfo *finfo = GNOME_CMD_FILE_INFO (files->data);
-        GnomeVFSURI *uri = gnome_vfs_uri_append_file_name (
-            state->active_dir_uri, finfo->info->name);
+        GnomeVFSURI *uri = gnome_vfs_uri_append_file_name (state->active_dir_uri, finfo->info->name);
         const gchar *fpath = gnome_vfs_uri_get_path (uri);
 
         change_cwd (fpath);
@@ -192,8 +187,7 @@
 }
 
 
-static GtkWidget *
-create_main_menu (GnomeCmdPlugin *p, GnomeCmdState *state)
+static GtkWidget *create_main_menu (GnomeCmdPlugin *p, GnomeCmdState *state)
 {
     GtkWidget *item, *child;
     CvsPlugin *plugin = CVS_PLUGIN (p);
@@ -222,8 +216,7 @@
 }
 
 
-static gboolean
-cvs_dir_exists (GList *files)
+static gboolean cvs_dir_exists (GList *files)
 {
     for (; files; files = files->next)
     {
@@ -239,8 +232,7 @@
 }
 
 
-static GList *
-create_popup_menu_items (GnomeCmdPlugin *plugin, GnomeCmdState *state)
+static GList *create_popup_menu_items (GnomeCmdPlugin *plugin, GnomeCmdState *state)
 {
     GtkWidget *item;
     GList *l = NULL;
@@ -257,19 +249,20 @@
 }
 
 
-static void
-update_main_menu_state (GnomeCmdPlugin *p, GnomeCmdState *state)
+static void update_main_menu_state (GnomeCmdPlugin *p, GnomeCmdState *state)
 {
     CvsPlugin *plugin = CVS_PLUGIN (p);
 
-    if (cvs_dir_exists (state->active_dir_files)) {
+    if (cvs_dir_exists (state->active_dir_files))
+    {
         gtk_widget_set_sensitive (plugin->priv->update, TRUE);
         gtk_widget_set_sensitive (plugin->priv->diff, TRUE);
         gtk_widget_set_sensitive (plugin->priv->log, TRUE);
         gtk_widget_set_sensitive (plugin->priv->last_log, TRUE);
         gtk_widget_set_sensitive (plugin->priv->last_change, TRUE);
     }
-    else {
+    else
+    {
         gtk_widget_set_sensitive (plugin->priv->update, FALSE);
         gtk_widget_set_sensitive (plugin->priv->diff, FALSE);
         gtk_widget_set_sensitive (plugin->priv->log, FALSE);
@@ -279,13 +272,10 @@
 }
 
 
-static void
-on_configure_close (GtkButton *btn, CvsPlugin *plugin)
+static void on_configure_close (GtkButton *btn, CvsPlugin *plugin)
 {
-    plugin->compression_level = gtk_option_menu_get_history (
-        GTK_OPTION_MENU (plugin->priv->compression_level_menu));
-    plugin->unidiff = gtk_toggle_button_get_active (
-        GTK_TOGGLE_BUTTON (plugin->priv->unidiff_check));
+    plugin->compression_level = gtk_option_menu_get_history (GTK_OPTION_MENU (plugin->priv->compression_level_menu));
+    plugin->unidiff = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->priv->unidiff_check));
 
     gnome_cmd_data_set_int ("/cvs-plugin/compression_level", plugin->compression_level);
 
@@ -293,8 +283,7 @@
 }
 
 
-static void
-configure (GnomeCmdPlugin *p)
+static void configure (GnomeCmdPlugin *p)
 {
     GtkWidget *dialog, *table, *cat, *label, *vbox, *optmenu, *check;
     CvsPlugin *plugin = CVS_PLUGIN (p);
@@ -327,8 +316,7 @@
 
     check = create_check (dialog, _("Unified diff format"), "check");
     plugin->priv->unidiff_check = check;
-    gtk_toggle_button_set_active (
-        GTK_TOGGLE_BUTTON (check), plugin->unidiff);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin->unidiff);
     gtk_table_attach (GTK_TABLE (table), check, 0, 2, 0, 1,
                       (GtkAttachOptions) (GTK_FILL),
                       (GtkAttachOptions) (0), 0, 0);
@@ -341,8 +329,7 @@
  * Gtk class implementation
  *******************************/
 
-static void
-destroy (GtkObject *object)
+static void destroy (GtkObject *object)
 {
     //CvsPlugin *plugin = CVS_PLUGIN (object);
 
@@ -351,8 +338,7 @@
 }
 
 
-static void
-class_init (CvsPluginClass *klass)
+static void class_init (CvsPluginClass *klass)
 {
     GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
     GnomeCmdPluginClass *plugin_class = GNOME_CMD_PLUGIN_CLASS (klass);
@@ -368,10 +354,9 @@
 }
 
 
-static void
-init (CvsPlugin *plugin)
+static void init (CvsPlugin *plugin)
 {
-    plugin->priv = g_new (CvsPluginPrivate, 1);
+    plugin->priv = g_new0 (CvsPluginPrivate, 1);
 
     plugin->diff_win = NULL;
     plugin->log_win = NULL;
@@ -386,8 +371,7 @@
  * Public functions
  ***********************************/
 
-GtkType
-cvs_plugin_get_type         (void)
+GtkType cvs_plugin_get_type ()
 {
     static GtkType type = 0;
 
@@ -411,8 +395,7 @@
 }
 
 
-GnomeCmdPlugin *
-cvs_plugin_new (void)
+GnomeCmdPlugin *cvs_plugin_new ()
 {
     CvsPlugin *plugin = gtk_type_new (cvs_plugin_get_type ());
 
@@ -420,13 +403,13 @@
 }
 
 
-GnomeCmdPlugin *create_plugin (void)
+GnomeCmdPlugin *create_plugin ()
 {
     return cvs_plugin_new ();
 }
 
 
-PluginInfo *get_plugin_info (void)
+PluginInfo *get_plugin_info ()
 {
     if (!plugin_nfo.authors)
     {

Modified: branches/gcmd-1-3/plugins/cvs/cvs-plugin.h
==============================================================================
--- branches/gcmd-1-3/plugins/cvs/cvs-plugin.h	(original)
+++ branches/gcmd-1-3/plugins/cvs/cvs-plugin.h	Tue Oct  7 17:10:47 2008
@@ -58,11 +58,9 @@
 };
 
 
-GtkType
-cvs_plugin_get_type (void);
+GtkType cvs_plugin_get_type ();
 
-GnomeCmdPlugin *
-cvs_plugin_new (void);
+GnomeCmdPlugin *cvs_plugin_new ();
 
 G_END_DECLS
 

Modified: branches/gcmd-1-3/plugins/cvs/interface.c
==============================================================================
--- branches/gcmd-1-3/plugins/cvs/interface.c	(original)
+++ branches/gcmd-1-3/plugins/cvs/interface.c	Tue Oct  7 17:10:47 2008
@@ -15,8 +15,7 @@
 #include "close.xpm"
 
 
-static GtkWidget*
-create_compare_win (LogHistory *log_history);
+static GtkWidget *create_compare_win (LogHistory *log_history);
 
 
 static void
@@ -36,7 +35,8 @@
 
     log_history->plugin->selected_rev = rev;
 
-    if (rev->message) {
+    if (rev->message)
+    {
         GtkTextBuffer *buf = gtk_text_buffer_new (NULL);
         gtk_text_buffer_set_text (buf, rev->message, strlen (rev->message));
         gtk_text_view_set_buffer (GTK_TEXT_VIEW (log_history->msg_text_view), buf);
@@ -44,21 +44,17 @@
 }
 
 
-static void
-on_compare_clicked                     (GtkButton       *button,
-                                        LogHistory      *log_history)
+static void on_compare_clicked (GtkButton *button, LogHistory *log_history)
 {
     GtkWidget *dlg = create_compare_win (log_history);
     GtkWidget *combo = lookup_widget (GTK_WIDGET (dlg), "rev_combo");
 
-    gtk_combo_set_popdown_strings (
-        GTK_COMBO (combo), log_history->rev_names);
+    gtk_combo_set_popdown_strings (GTK_COMBO (combo), log_history->rev_names);
     gtk_widget_show (dlg);
 }
 
 
-static void
-on_compare_ok (GtkButton *button, GtkWidget *dialog)
+static void on_compare_ok (GtkButton *button, GtkWidget *dialog)
 {
     gchar *cmd, *args, *prev_rev;
     const gchar *selected_rev, *selected_other_rev;
@@ -94,20 +90,19 @@
 }
 
 
-static void
-on_compare_cancel (GtkButton *button, GtkWidget *dialog)
+static void on_compare_cancel (GtkButton *button, GtkWidget *dialog)
 {
     gtk_widget_destroy (dialog);
 }
 
 
-static void
-on_other_rev_toggled (GtkToggleButton *btn, GtkWidget *dialog)
+static void on_other_rev_toggled (GtkToggleButton *btn, GtkWidget *dialog)
 {
     GtkWidget *combo = lookup_widget (dialog, "rev_combo");
     GtkWidget *entry = GTK_COMBO (combo)->entry;
 
-    if (gtk_toggle_button_get_active (btn)) {
+    if (gtk_toggle_button_get_active (btn))
+    {
         gtk_widget_set_sensitive (combo, TRUE);
         gtk_widget_grab_focus (entry);
     }
@@ -116,8 +111,7 @@
 }
 
 
-static Revision *
-find_prev_rev (LogHistory *h, Revision *rev)
+static Revision *find_prev_rev (LogHistory *h, Revision *rev)
 {
     GList *l = g_list_find (h->revisions, rev);
     if (!l) return NULL;
@@ -129,8 +123,7 @@
 }
 
 
-static GtkWidget*
-create_compare_win (LogHistory *log_history)
+static GtkWidget *create_compare_win (LogHistory *log_history)
 {
     GtkWidget *dialog;
     GtkWidget *vbox;
@@ -146,10 +139,8 @@
     if (prev_rev)
         gtk_object_set_data (GTK_OBJECT (dialog), "prev_rev", prev_rev->number);
 
-    gtk_object_set_data (GTK_OBJECT (dialog), "selected_rev",
-                         log_history->plugin->selected_rev->number);
-    gtk_object_set_data (GTK_OBJECT (dialog), "log_history",
-                         log_history);
+    gtk_object_set_data (GTK_OBJECT (dialog), "selected_rev", log_history->plugin->selected_rev->number);
+    gtk_object_set_data (GTK_OBJECT (dialog), "log_history", log_history);
 
 
     /**
@@ -159,65 +150,54 @@
     cat = create_category (dialog, vbox, _("Compare with"));
     gnome_cmd_dialog_add_category (GNOME_CMD_DIALOG (dialog), cat);
 
-    radio = create_radio (dialog, NULL, _("HEAD"),
-                          "head_radio");
+    radio = create_radio (dialog, NULL, _("HEAD"), "head_radio");
     gtk_box_pack_start (GTK_BOX (vbox), radio, TRUE, FALSE, 0);
 
-    radio = create_radio (dialog, get_radio_group(radio), _("The previous revision"),
-                          "prev_rev_radio");
+    radio = create_radio (dialog, get_radio_group(radio), _("The previous revision"), "prev_rev_radio");
     gtk_box_pack_start (GTK_BOX (vbox), radio, TRUE, FALSE, 0);
     if (!prev_rev)
         gtk_widget_set_sensitive (radio, FALSE);
 
-    radio = create_radio (dialog, get_radio_group(radio), _("Other revision"),
-                          "other_rev_radio");
+    radio = create_radio (dialog, get_radio_group(radio), _("Other revision"), "other_rev_radio");
     gtk_box_pack_start (GTK_BOX (vbox), radio, TRUE, FALSE, 0);
 
-    gtk_signal_connect (GTK_OBJECT (radio), "toggled",
-                        GTK_SIGNAL_FUNC (on_other_rev_toggled), dialog);
+    gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (on_other_rev_toggled), dialog);
 
     combo = create_combo (dialog);
-    gtk_object_set_data_full (GTK_OBJECT (dialog), "rev_combo", combo,
-                              (GtkDestroyNotify) gtk_widget_unref);
+    gtk_object_set_data_full (GTK_OBJECT (dialog), "rev_combo", combo, (GtkDestroyNotify) gtk_widget_unref);
     gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, FALSE, 0);
     gtk_widget_set_sensitive (combo, FALSE);
 
-    gnome_cmd_dialog_add_button (
-        GNOME_CMD_DIALOG (dialog), GNOME_STOCK_BUTTON_CANCEL,
-        GTK_SIGNAL_FUNC (on_compare_cancel), dialog);
-    gnome_cmd_dialog_add_button (
-        GNOME_CMD_DIALOG (dialog), GNOME_STOCK_BUTTON_OK,
-        GTK_SIGNAL_FUNC (on_compare_ok), dialog);
+    gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (dialog), GNOME_STOCK_BUTTON_CANCEL,
+                                 GTK_SIGNAL_FUNC (on_compare_cancel), dialog);
+    gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (dialog), GNOME_STOCK_BUTTON_OK,
+                                 GTK_SIGNAL_FUNC (on_compare_ok), dialog);
 
     return dialog;
 }
 
 
-static void
-on_close_tab (GtkButton *button, GtkWidget *tab)
+static void on_close_tab (GtkButton *button, GtkWidget *tab)
 {
     gtk_widget_destroy (tab);
 }
 
 
-static void
-on_diff_window_close (GtkButton *button, CvsPlugin *plugin)
+static void on_diff_window_close (GtkButton *button, CvsPlugin *plugin)
 {
     gtk_widget_destroy (plugin->diff_win);
     plugin->diff_win = NULL;
 }
 
 
-static void
-on_log_window_close (GtkButton *button, CvsPlugin *plugin)
+static void on_log_window_close (GtkButton *button, CvsPlugin *plugin)
 {
     gtk_widget_destroy (plugin->log_win);
     plugin->log_win = NULL;
 }
 
 
-static gboolean
-on_log_win_delete (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
+static gboolean on_log_win_delete (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
 {
     gtk_widget_destroy (widget);
     plugin->log_win = NULL;
@@ -225,8 +205,7 @@
 }
 
 
-static gboolean
-on_diff_win_delete (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
+static gboolean on_diff_win_delete (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
 {
     gtk_widget_destroy (widget);
     plugin->diff_win = NULL;
@@ -234,24 +213,21 @@
 }
 
 
-static gboolean
-on_log_win_destroy (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
+static gboolean on_log_win_destroy (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
 {
     plugin->log_win = NULL;
     return FALSE;
 }
 
 
-static gboolean
-on_diff_win_destroy (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
+static gboolean on_diff_win_destroy (GtkWidget *widget, GdkEvent *event, CvsPlugin *plugin)
 {
     plugin->diff_win = NULL;
     return FALSE;
 }
 
 
-GtkWidget *
-create_diff_win (CvsPlugin *plugin)
+GtkWidget *create_diff_win (CvsPlugin *plugin)
 {
     GtkWidget *dialog;
     GtkWidget *notebook;
@@ -265,18 +241,14 @@
         GNOME_CMD_DIALOG (dialog), GNOME_STOCK_BUTTON_CLOSE,
         GTK_SIGNAL_FUNC (on_diff_window_close), plugin);
 
-    gtk_signal_connect (GTK_OBJECT (dialog), "delete-event",
-                        GTK_SIGNAL_FUNC (on_diff_win_delete), plugin);
-    gtk_signal_connect (GTK_OBJECT (dialog), "destroy-event",
-                        GTK_SIGNAL_FUNC (on_diff_win_destroy), plugin);
+    gtk_signal_connect (GTK_OBJECT (dialog), "delete-event", GTK_SIGNAL_FUNC (on_diff_win_delete), plugin);
+    gtk_signal_connect (GTK_OBJECT (dialog), "destroy-event", GTK_SIGNAL_FUNC (on_diff_win_destroy), plugin);
 
     notebook = gtk_notebook_new ();
     gtk_widget_ref (notebook);
-    gtk_object_set_data_full (GTK_OBJECT (dialog), "notebook",
-                              notebook, (GtkDestroyNotify) gtk_widget_unref);
+    gtk_object_set_data_full (GTK_OBJECT (dialog), "notebook", notebook, (GtkDestroyNotify) gtk_widget_unref);
     gtk_widget_show (notebook);
-    gnome_cmd_dialog_add_expanding_category (
-        GNOME_CMD_DIALOG (dialog), notebook);
+    gnome_cmd_dialog_add_expanding_category (GNOME_CMD_DIALOG (dialog), notebook);
 
     gtk_widget_show (dialog);
 
@@ -284,8 +256,7 @@
 }
 
 
-GtkWidget*
-create_log_win (CvsPlugin *plugin)
+GtkWidget *create_log_win (CvsPlugin *plugin)
 {
     GtkWidget *dialog;
     GtkWidget *notebook;
@@ -307,11 +278,9 @@
 
     notebook = gtk_notebook_new ();
     gtk_widget_ref (notebook);
-    gtk_object_set_data_full (GTK_OBJECT (dialog), "notebook",
-                              notebook, (GtkDestroyNotify) gtk_widget_unref);
+    gtk_object_set_data_full (GTK_OBJECT (dialog), "notebook", notebook, (GtkDestroyNotify) gtk_widget_unref);
     gtk_widget_show (notebook);
-    gnome_cmd_dialog_add_expanding_category (
-        GNOME_CMD_DIALOG (dialog), notebook);
+    gnome_cmd_dialog_add_expanding_category (GNOME_CMD_DIALOG (dialog), notebook);
 
     gtk_widget_show (dialog);
 
@@ -351,8 +320,7 @@
 }
 
 
-void
-add_diff_tab (CvsPlugin *plugin, const gchar *cmd, const gchar *fname)
+void add_diff_tab (CvsPlugin *plugin, const gchar *cmd, const gchar *fname)
 {
     gint ret;
     FILE *fd;
@@ -364,14 +332,12 @@
     GtkWidget *notebook;
 
     sw = create_sw (plugin->diff_win);
-    gtk_scrolled_window_set_shadow_type (
-        GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
+    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
 
     text_view = gtk_text_view_new ();
     gtk_container_add (GTK_CONTAINER (sw), text_view);
     gtk_widget_ref (text_view);
-    gtk_object_set_data_full (GTK_OBJECT (sw), "text_view", text_view,
-                              (GtkDestroyNotify) gtk_widget_unref);
+    gtk_object_set_data_full (GTK_OBJECT (sw), "text_view", text_view, (GtkDestroyNotify) gtk_widget_unref);
     gtk_widget_show (text_view);
 
     notebook = lookup_widget (plugin->diff_win, "notebook");
@@ -392,8 +358,7 @@
 }
 
 
-void
-add_log_tab (CvsPlugin *plugin, const gchar *fname)
+void add_log_tab (CvsPlugin *plugin, const gchar *fname)
 {
     GList *revs;
     GtkWidget *hpaned;

Modified: branches/gcmd-1-3/plugins/cvs/interface.h
==============================================================================
--- branches/gcmd-1-3/plugins/cvs/interface.h	(original)
+++ branches/gcmd-1-3/plugins/cvs/interface.h	Tue Oct  7 17:10:47 2008
@@ -1,12 +1,5 @@
-
 GtkWidget *create_log_win  (CvsPlugin *plugin);
-
-void add_log_tab           (CvsPlugin *plugin,
-                            const gchar *fname);
-
-
 GtkWidget *create_diff_win (CvsPlugin *plugin);
 
-void add_diff_tab          (CvsPlugin *plugin,
-                            const gchar *command,
-                            const gchar *fname);
+void add_log_tab (CvsPlugin *plugin, const gchar *fname);
+void add_diff_tab (CvsPlugin *plugin, const gchar *command, const gchar *fname);

Modified: branches/gcmd-1-3/src/intviewer/viewer-window.cc
==============================================================================
--- branches/gcmd-1-3/src/intviewer/viewer-window.cc	(original)
+++ branches/gcmd-1-3/src/intviewer/viewer-window.cc	Tue Oct  7 17:10:47 2008
@@ -802,10 +802,10 @@
     };
 
 #define ENCODING_MENU_ITEM(label, keyval, value) {MI_RADIO, _(label), \
-    keyval, NO_MODIFIER, G_CALLBACK (menu_view_set_charset), \
-    GNOME_APP_PIXMAP_NONE, NO_PIXMAP_INFO, \
-    G_OBJ_CHARSET_KEY, (gpointer *) GUINT_TO_POINTER(value), \
-    NO_MENU_ITEM, &text_encoding_list}
+            keyval, NO_MODIFIER, G_CALLBACK (menu_view_set_charset), \
+            GNOME_APP_PIXMAP_NONE, NO_PIXMAP_INFO, \
+            G_OBJ_CHARSET_KEY, (gpointer *) GUINT_TO_POINTER(value), \
+            NO_MENU_ITEM, &text_encoding_list}
 
     GSList *text_encoding_list = NULL;
     MENU_ITEM_DATA encoding_menu_items[] = {



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