gnome-commander r1531 - branches/gcmd-1-3/src



Author: epiotr
Date: Fri Jan 18 18:46:52 2008
New Revision: 1531
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1531&view=rev

Log:
Code cleanup

Modified:
   branches/gcmd-1-3/src/gnome-cmd-dir.cc
   branches/gcmd-1-3/src/gnome-cmd-file-list.cc
   branches/gcmd-1-3/src/gnome-cmd-mkdir-dialog.cc

Modified: branches/gcmd-1-3/src/gnome-cmd-dir.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-dir.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-dir.cc	Fri Jan 18 18:46:52 2008
@@ -73,12 +73,7 @@
 static guint dir_signals[LAST_SIGNAL] = { 0 };
 
 
-static void
-monitor_callback (GnomeVFSMonitorHandle *handle,
-                  const gchar *monitor_uri,
-                  const gchar *info_uri,
-                  GnomeVFSMonitorEventType event_type,
-                  GnomeCmdDir *dir)
+static void monitor_callback (GnomeVFSMonitorHandle *handle, const gchar *monitor_uri, const gchar *info_uri, GnomeVFSMonitorEventType event_type, GnomeCmdDir *dir)
 {
     switch (event_type)
     {
@@ -98,6 +93,7 @@
         case GNOME_VFS_MONITOR_EVENT_STARTEXECUTING:
         case GNOME_VFS_MONITOR_EVENT_STOPEXECUTING:
             break;
+
         default:
             DEBUG('n', "Unknown monitor event %d\n", event_type);
     }
@@ -108,8 +104,7 @@
  * Gtk class implementation
  *******************************/
 
-static void
-destroy (GtkObject *object)
+static void destroy (GtkObject *object)
 {
     GnomeCmdDir *dir = GNOME_CMD_DIR (object);
 
@@ -127,10 +122,10 @@
     dir->priv->handle->ref = NULL;
     handle_unref (dir->priv->handle);
 
-    if (dir->priv)
-        g_free (dir->priv);
+    g_free (dir->priv);
 
-    if (DEBUG_ENABLED ('c')) {
+    if (DEBUG_ENABLED ('c'))
+    {
         all_dirs = g_list_remove (all_dirs, dir);
         deleted_dirs_cnt++;
     }
@@ -140,8 +135,7 @@
 }
 
 
-static void
-class_init (GnomeCmdDirClass *klass)
+static void class_init (GnomeCmdDirClass *klass)
 {
     GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
     GnomeCmdFileClass *file_class = GNOME_CMD_FILE_CLASS (klass);
@@ -202,8 +196,7 @@
 }
 
 
-static void
-init (GnomeCmdDir *dir)
+static void init (GnomeCmdDir *dir)
 {
     dir->priv = g_new0 (GnomeCmdDirPrivate, 1);
     dir->voffset = 0;
@@ -228,8 +221,7 @@
  * Public functions
  ***********************************/
 
-GtkType
-gnome_cmd_dir_get_type         (void)
+GtkType gnome_cmd_dir_get_type (void)
 {
     static GtkType type = 0;
 
@@ -253,8 +245,7 @@
 }
 
 
-GnomeCmdDir *
-gnome_cmd_dir_new_from_info (GnomeVFSFileInfo *info, GnomeCmdDir *parent)
+GnomeCmdDir *gnome_cmd_dir_new_from_info (GnomeVFSFileInfo *info, GnomeCmdDir *parent)
 {
     GnomeCmdDir *dir;
     GnomeCmdCon *con;
@@ -294,10 +285,7 @@
 }
 
 
-GnomeCmdDir *
-gnome_cmd_dir_new_with_con (GnomeVFSFileInfo *info,
-                            GnomeCmdPath *path,
-                            GnomeCmdCon *con)
+GnomeCmdDir *gnome_cmd_dir_new_with_con (GnomeVFSFileInfo *info, GnomeCmdPath *path, GnomeCmdCon *con)
 {
     g_return_val_if_fail (info != NULL, NULL);
     g_return_val_if_fail (GNOME_CMD_IS_CON (con), NULL);
@@ -327,8 +315,7 @@
 }
 
 
-GnomeCmdDir *
-gnome_cmd_dir_new (GnomeCmdCon *con, GnomeCmdPath *path)
+GnomeCmdDir *gnome_cmd_dir_new (GnomeCmdCon *con, GnomeCmdPath *path)
 {
     g_return_val_if_fail (GNOME_CMD_IS_CON (con), NULL);
     g_return_val_if_fail (GNOME_CMD_IS_PATH (path), NULL);
@@ -377,34 +364,27 @@
 }
 
 
-GnomeCmdDir *
-gnome_cmd_dir_get_parent (GnomeCmdDir *dir)
+GnomeCmdDir *gnome_cmd_dir_get_parent (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
     GnomeCmdPath *path = gnome_cmd_path_get_parent (dir->priv->path);
-    if (!path)
-        return NULL;
 
-    return gnome_cmd_dir_new (dir->priv->con, path);
+    return path ? gnome_cmd_dir_new (dir->priv->con, path) : NULL;
 }
 
 
-GnomeCmdDir *
-gnome_cmd_dir_get_child (GnomeCmdDir *dir, const gchar *child)
+GnomeCmdDir *gnome_cmd_dir_get_child (GnomeCmdDir *dir, const gchar *child)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
     GnomeCmdPath *path = gnome_cmd_path_get_child (dir->priv->path, child);
-    if (!path)
-        return NULL;
 
-    return gnome_cmd_dir_new (dir->priv->con, path);
+    return path ? gnome_cmd_dir_new (dir->priv->con, path) : NULL;
 }
 
 
-GnomeCmdCon *
-gnome_cmd_dir_get_connection (GnomeCmdDir *dir)
+GnomeCmdCon *gnome_cmd_dir_get_connection (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
@@ -420,8 +400,7 @@
 }
 
 
-void
-gnome_cmd_dir_ref (GnomeCmdDir *dir)
+void gnome_cmd_dir_ref (GnomeCmdDir *dir)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
@@ -429,8 +408,7 @@
 }
 
 
-void
-gnome_cmd_dir_unref (GnomeCmdDir *dir)
+void gnome_cmd_dir_unref (GnomeCmdDir *dir)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
@@ -438,8 +416,7 @@
 }
 
 
-GnomeVFSResult
-gnome_cmd_dir_get_files (GnomeCmdDir *dir, GList **files)
+GnomeVFSResult gnome_cmd_dir_get_files (GnomeCmdDir *dir, GList **files)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), GNOME_VFS_ERROR_BAD_PARAMETERS);
 
@@ -450,8 +427,7 @@
 }
 
 
-static GList *
-create_file_list (GnomeCmdDir *dir, GList *info_list)
+static GList *create_file_list (GnomeCmdDir *dir, GList *info_list)
 {
     GList *file_list = NULL;
 
@@ -500,8 +476,7 @@
 }
 
 
-static void
-on_list_done (GnomeCmdDir *dir, GList *infolist, GnomeVFSResult result)
+static void on_list_done (GnomeCmdDir *dir, GList *infolist, GnomeVFSResult result)
 {
     if (dir->state == DIR_STATE_LISTED)
     {
@@ -545,8 +520,7 @@
 }
 
 
-static void
-on_dir_list_cancel (GtkButton *btn, GnomeCmdDir *dir)
+static void on_dir_list_cancel (GtkButton *btn, GnomeCmdDir *dir)
 {
     if (dir->state == DIR_STATE_LISTING)
     {
@@ -559,8 +533,7 @@
 }
 
 
-static void
-create_list_progress_dialog (GnomeCmdDir *dir)
+static void create_list_progress_dialog (GnomeCmdDir *dir)
 {
     dir->dialog = gnome_cmd_dialog_new (NULL);
     gtk_widget_ref (dir->dialog);
@@ -589,8 +562,7 @@
 }
 
 
-void
-gnome_cmd_dir_relist_files (GnomeCmdDir *dir, gboolean visprog)
+void gnome_cmd_dir_relist_files (GnomeCmdDir *dir, gboolean visprog)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
@@ -606,8 +578,7 @@
 }
 
 
-void
-gnome_cmd_dir_list_files (GnomeCmdDir *dir, gboolean visprog)
+void gnome_cmd_dir_list_files (GnomeCmdDir *dir, gboolean visprog)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
@@ -624,8 +595,7 @@
 }
 
 
-GnomeCmdPath *
-gnome_cmd_dir_get_path (GnomeCmdDir *dir)
+GnomeCmdPath *gnome_cmd_dir_get_path (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
@@ -633,8 +603,7 @@
 }
 
 
-void
-gnome_cmd_dir_set_path (GnomeCmdDir *dir, GnomeCmdPath *path)
+void gnome_cmd_dir_set_path (GnomeCmdDir *dir, GnomeCmdPath *path)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
@@ -646,8 +615,7 @@
 }
 
 
-void
-gnome_cmd_dir_update_path (GnomeCmdDir *dir)
+void gnome_cmd_dir_update_path (GnomeCmdDir *dir)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
@@ -661,8 +629,7 @@
 }
 
 
-gchar *
-gnome_cmd_dir_get_display_path (GnomeCmdDir *dir)
+gchar *gnome_cmd_dir_get_display_path (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
@@ -690,8 +657,7 @@
 }
 
 
-GnomeVFSURI *
-gnome_cmd_dir_get_child_uri (GnomeCmdDir *dir, const gchar *filename)
+GnomeVFSURI *gnome_cmd_dir_get_child_uri (GnomeCmdDir *dir, const gchar *filename)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
@@ -703,8 +669,7 @@
 }
 
 
-gchar *
-gnome_cmd_dir_get_child_uri_str (GnomeCmdDir *dir, const gchar *filename)
+gchar *gnome_cmd_dir_get_child_uri_str (GnomeCmdDir *dir, const gchar *filename)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
 
@@ -754,8 +719,7 @@
 }
 
 
-static gboolean
-file_already_exists (GnomeCmdDir *dir, const gchar *uri_str)
+static gboolean file_already_exists (GnomeCmdDir *dir, const gchar *uri_str)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), TRUE);
     g_return_val_if_fail (uri_str != NULL, TRUE);
@@ -770,23 +734,20 @@
  */
 void gnome_cmd_dir_file_created (GnomeCmdDir *dir, const gchar *uri_str)
 {
-    GnomeVFSURI *uri;
-    GnomeVFSResult res;
-    GnomeVFSFileInfo *info;
-    GnomeCmdFile *finfo;
-    GnomeVFSFileInfoOptions infoOpts = (GnomeVFSFileInfoOptions) (GNOME_VFS_FILE_INFO_FOLLOW_LINKS|GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
-
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
     g_return_if_fail (uri_str != NULL);
 
     if (file_already_exists (dir, uri_str))
         return;
 
-    uri = gnome_vfs_uri_new (uri_str);
-    info = gnome_vfs_file_info_new ();
-    res = gnome_vfs_get_file_info_uri (uri, info, infoOpts);
+    GnomeVFSURI *uri = gnome_vfs_uri_new (uri_str);
+    GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
+    GnomeVFSFileInfoOptions infoOpts = (GnomeVFSFileInfoOptions) (GNOME_VFS_FILE_INFO_FOLLOW_LINKS|GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
+    GnomeVFSResult res = gnome_vfs_get_file_info_uri (uri, info, infoOpts);
     gnome_vfs_uri_unref (uri);
 
+    GnomeCmdFile *finfo;
+
     if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
         finfo = GNOME_CMD_FILE (gnome_cmd_dir_new_from_info (info, dir));
     else
@@ -849,8 +810,7 @@
 }
 
 
-gboolean
-gnome_cmd_dir_uses_fam (GnomeCmdDir *dir)
+gboolean gnome_cmd_dir_uses_fam (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), FALSE);
 
@@ -858,13 +818,12 @@
 }
 
 
-void
-gnome_cmd_dir_start_monitoring (GnomeCmdDir *dir)
+void gnome_cmd_dir_start_monitoring (GnomeCmdDir *dir)
 {
-    GnomeVFSResult result;
-
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
+    GnomeVFSResult result;
+
     if (dir->priv->monitor_users == 0)
     {
         gchar *uri_str = gnome_cmd_file_get_uri_str (GNOME_CMD_FILE (dir));
@@ -888,8 +847,7 @@
 }
 
 
-void
-gnome_cmd_dir_cancel_monitoring (GnomeCmdDir *dir)
+void gnome_cmd_dir_cancel_monitoring (GnomeCmdDir *dir)
 {
     g_return_if_fail (GNOME_CMD_IS_DIR (dir));
 
@@ -916,8 +874,7 @@
 }
 
 
-gboolean
-gnome_cmd_dir_is_local (GnomeCmdDir *dir)
+gboolean gnome_cmd_dir_is_local (GnomeCmdDir *dir)
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), FALSE);
 

Modified: branches/gcmd-1-3/src/gnome-cmd-file-list.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-list.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-list.cc	Fri Jan 18 18:46:52 2008
@@ -206,7 +206,6 @@
     GTK_CLIST (fl)->focus_row = row;
     fl->priv->cur_file = row;
     gtk_clist_select_row (GTK_CLIST (fl), row, 0);
-
 }
 
 
@@ -401,7 +400,6 @@
 
 inline void toggle_with_pattern (GnomeCmdFileList *fl, const gchar *pattern, gboolean case_sens, gboolean mode)
 {
-
     g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
 
     Filter *filter = filter_new (pattern, case_sens, gnome_cmd_data_get_filter_type ());
@@ -1228,13 +1226,13 @@
 
     fl->priv = g_new0 (GnomeCmdFileListPrivate, 1);
     fl->priv->shown_files = gnome_cmd_file_collection_new ();
-    fl->priv->selected_files = NULL;
-    fl->priv->shift_down = FALSE;
-    fl->priv->selpat_dialog = NULL;
-    fl->priv->right_mb_down_file = NULL;
-    fl->priv->right_mb_timeout_id = 0;
-    fl->priv->quicksearch_popup = NULL;
-    fl->priv->focus_later = NULL;
+    // fl->priv->selected_files = NULL;
+    // fl->priv->shift_down = FALSE;
+    // fl->priv->selpat_dialog = NULL;
+    // fl->priv->right_mb_down_file = NULL;
+    // fl->priv->right_mb_timeout_id = 0;
+    // fl->priv->quicksearch_popup = NULL;
+    // fl->priv->focus_later = NULL;
 
     for (i=0; i<FILE_LIST_NUM_COLUMNS; i++)
         fl->priv->sort_raising[i] = FALSE;
@@ -1552,13 +1550,15 @@
     g_return_if_fail (finfo != NULL);
 
     gint row = get_row_from_file (fl, finfo);
+
     if (row >= 0)
     {
         gtk_clist_remove (GTK_CLIST (fl), row);
+
         fl->priv->selected_files = g_list_remove (fl->priv->selected_files, finfo);
         gnome_cmd_file_collection_remove (fl->priv->shown_files, finfo);
 
-        focus_file_at_row (fl, MIN(row, GTK_CLIST(fl)->focus_row));
+        focus_file_at_row (fl, MIN (row, GTK_CLIST(fl)->focus_row));
     }
 }
 
@@ -1799,10 +1799,7 @@
 }
 
 
-void
-gnome_cmd_file_list_focus_file (GnomeCmdFileList *fl,
-                                const gchar *focus_file,
-                                gboolean scroll_to_file)
+void gnome_cmd_file_list_focus_file (GnomeCmdFileList *fl, const gchar *focus_file, gboolean scroll_to_file)
 {
     g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
 
@@ -1829,8 +1826,7 @@
 
     /* The file was not found, remember the filename in case the file gets
        added to the list in the future (after a FAM event etc). */
-    if (fl->priv->focus_later)
-        g_free (fl->priv->focus_later);
+    g_free (fl->priv->focus_later);
     fl->priv->focus_later = g_strdup (focus_file);
 }
 
@@ -1994,14 +1990,14 @@
 {
     g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
 
-    GnomeCmdFile *finfo;
-    gint x, y, w, h;
-
-    finfo = gnome_cmd_file_list_get_selected_file (fl);
+    GnomeCmdFile *finfo = gnome_cmd_file_list_get_selected_file (fl);
 
     if (GNOME_CMD_IS_FILE (finfo))
     {
-        get_focus_row_coordinates(fl, &x, &y, &w, &h);
+        gint x, y, w, h;
+
+        get_focus_row_coordinates (fl, &x, &y, &w, &h);
+
         GtkWidget *dialog = gnome_cmd_rename_dialog_new (finfo, x, y, w, h);
 
         gtk_widget_ref (dialog);

Modified: branches/gcmd-1-3/src/gnome-cmd-mkdir-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-mkdir-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-mkdir-dialog.cc	Fri Jan 18 18:46:52 2008
@@ -202,7 +202,7 @@
         labels,
         1,
         (GnomeCmdStringDialogCallback) on_ok,
-        (GtkSignalFunc)on_cancel,
+        (GtkSignalFunc) on_cancel,
         dialog);
 
     return GTK_WIDGET (dialog);



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