[gnome-commander/gcmd-1-3] GnomeCmdMainWin: more C++ rework



commit 0df5f6aa8926c0d7590de195b758bfdff7f2b4df
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Thu Jul 23 20:42:54 2009 +0200

    GnomeCmdMainWin: more C++ rework

 src/gnome-cmd-bookmark-dialog.cc     |    6 +-
 src/gnome-cmd-cmdline.cc             |   18 ++----
 src/gnome-cmd-data.cc                |    8 +-
 src/gnome-cmd-file-popmenu.cc        |    2 +-
 src/gnome-cmd-file-props-dialog.cc   |    2 +-
 src/gnome-cmd-file-selector.cc       |    6 +-
 src/gnome-cmd-main-menu.cc           |    2 +-
 src/gnome-cmd-main-win.cc            |  110 ++++++++++++++++------------------
 src/gnome-cmd-main-win.h             |   15 +----
 src/gnome-cmd-mkdir-dialog.cc        |    2 +-
 src/gnome-cmd-prepare-xfer-dialog.cc |    2 +-
 src/gnome-cmd-python-plugin.cc       |    4 +-
 src/gnome-cmd-remote-dialog.cc       |    3 +-
 src/gnome-cmd-rename-dialog.cc       |    2 +-
 src/gnome-cmd-search-dialog.cc       |    2 +-
 src/gnome-cmd-user-actions.cc        |    2 +-
 16 files changed, 81 insertions(+), 105 deletions(-)
---
diff --git a/src/gnome-cmd-bookmark-dialog.cc b/src/gnome-cmd-bookmark-dialog.cc
index 9b87d7b..2c4c6fc 100644
--- a/src/gnome-cmd-bookmark-dialog.cc
+++ b/src/gnome-cmd-bookmark-dialog.cc
@@ -388,7 +388,7 @@ static void add_groups (GnomeCmdBookmarkDialog *dialog)
 
 static void add_bookmarks (GnomeCmdBookmarkDialog *dialog)
 {
-    GnomeCmdCon *current_con = gnome_cmd_main_win_get_fs (main_win, ACTIVE)->get_connection();
+    GnomeCmdCon *current_con = main_win->fs(ACTIVE)->get_connection();
 
     g_return_if_fail (current_con != NULL);
 
@@ -615,7 +615,7 @@ GtkWidget *gnome_cmd_bookmark_dialog_new ()
 
 void gnome_cmd_bookmark_add_current ()
 {
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
+    GnomeCmdFileSelector *fs = main_win->fs(ACTIVE);
     GnomeCmdDir *cwd = fs->get_directory();
     gchar *path = gnome_cmd_dir_is_local (cwd) ? gnome_cmd_file_get_real_path (GNOME_CMD_FILE (cwd)) :
                                                  gnome_cmd_file_get_path (GNOME_CMD_FILE (cwd));
@@ -655,7 +655,7 @@ void gnome_cmd_bookmark_goto (GnomeCmdBookmark *bookmark)
 {
     g_return_if_fail (bookmark->group->con != NULL);
 
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
+    GnomeCmdFileSelector *fs = main_win->fs(ACTIVE);
     g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
 
     GnomeCmdCon *current_con = fs->get_connection();
diff --git a/src/gnome-cmd-cmdline.cc b/src/gnome-cmd-cmdline.cc
index 87e4038..ec41eaf 100644
--- a/src/gnome-cmd-cmdline.cc
+++ b/src/gnome-cmd-cmdline.cc
@@ -148,7 +148,7 @@ static void on_exec (GnomeCmdCmdline *cmdline, gboolean term)
     cmdline_text = gtk_entry_get_text (GTK_ENTRY (GNOME_CMD_COMBO (cmdline->priv->combo)->entry));
     cmdline_text = g_strstrip (g_strdup (cmdline_text));
 
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
+    GnomeCmdFileSelector *fs = main_win->fs(ACTIVE);
 
     if (g_str_has_prefix (cmdline_text, "cd "))   // if cmdline_text starts with "cd " then it MUST have at least 4 chars (as it's been previously g_strstrip'ed)
     {
@@ -245,7 +245,7 @@ static void on_fs_changed_dir (GnomeCmdFileSelector *fs, GnomeCmdDir *dir, Gnome
     g_return_if_fail (dir != NULL);
     g_return_if_fail (GNOME_CMD_IS_CMDLINE (cmdline));
 
-    if (fs != gnome_cmd_main_win_get_fs (main_win, ACTIVE))
+    if (fs != main_win->fs(ACTIVE))
         return;
 
     gchar *dpath = gnome_cmd_dir_get_display_path (dir);
@@ -261,10 +261,8 @@ static void on_fs_changed_dir (GnomeCmdFileSelector *fs, GnomeCmdDir *dir, Gnome
 static void destroy (GtkObject *object)
 {
     gtk_signal_disconnect_by_func (GTK_OBJECT (main_win), GTK_SIGNAL_FUNC (on_switch_fs), object);
-    gtk_signal_disconnect_by_func (GTK_OBJECT (gnome_cmd_main_win_get_fs (main_win, LEFT)),
-                                   GTK_SIGNAL_FUNC (on_fs_changed_dir), object);
-    gtk_signal_disconnect_by_func (GTK_OBJECT (gnome_cmd_main_win_get_fs (main_win, RIGHT)),
-                                   GTK_SIGNAL_FUNC (on_fs_changed_dir), object);
+    gtk_signal_disconnect_by_func (GTK_OBJECT (main_win->fs(LEFT)), GTK_SIGNAL_FUNC (on_fs_changed_dir), object);
+    gtk_signal_disconnect_by_func (GTK_OBJECT (main_win->fs(RIGHT)), GTK_SIGNAL_FUNC (on_fs_changed_dir), object);
 
     if (GTK_OBJECT_CLASS (parent_class)->destroy)
         (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -335,10 +333,8 @@ static void init (GnomeCmdCmdline *cmdline)
                         GTK_SIGNAL_FUNC (on_combo_popwin_hidden), cmdline);
     gtk_signal_connect_after (GTK_OBJECT (main_win), "switch-fs",
                         GTK_SIGNAL_FUNC (on_switch_fs), cmdline);
-    gtk_signal_connect (GTK_OBJECT (gnome_cmd_main_win_get_fs (main_win, LEFT)),
-                        "changed-dir", GTK_SIGNAL_FUNC (on_fs_changed_dir), cmdline);
-    gtk_signal_connect (GTK_OBJECT (gnome_cmd_main_win_get_fs (main_win, RIGHT)),
-                        "changed-dir", GTK_SIGNAL_FUNC (on_fs_changed_dir), cmdline);
+    gtk_signal_connect (GTK_OBJECT (main_win->fs(LEFT)), "changed-dir", GTK_SIGNAL_FUNC (on_fs_changed_dir), cmdline);
+    gtk_signal_connect (GTK_OBJECT (main_win->fs(RIGHT)), "changed-dir", GTK_SIGNAL_FUNC (on_fs_changed_dir), cmdline);
 
     gnome_cmd_cmdline_update_style (cmdline);
 }
@@ -561,7 +557,7 @@ gboolean gnome_cmd_cmdline_keypressed (GnomeCmdCmdline *cmdline, GdkEventKey *ev
                         {
                             gboolean ret;
                             GdkEventKey event2 = *event;
-                            GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
+                            GnomeCmdFileSelector *fs = main_win->fs(ACTIVE);
                             GtkWidget *file_list = *fs->file_list();
 
                             gtk_widget_grab_focus (file_list);
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index fe4c969..e398faf 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1935,13 +1935,13 @@ void gnome_cmd_data_set_auto_load_plugins (GList *plugins)
 
 void gnome_cmd_data_get_sort_params (GnomeCmdFileList *fl, gint &col, gboolean &direction)
 {
-    if (!gnome_cmd_main_win_get_fs (main_win, LEFT) || gnome_cmd_main_win_get_fs (main_win, LEFT)->file_list() == fl)
+    if (!main_win->fs(LEFT) || main_win->fs(LEFT)->file_list() == fl)
     {
         col = gnome_cmd_data.priv->sort_column[LEFT];
         direction = gnome_cmd_data.priv->sort_direction[LEFT];
     }
     else
-        if (!gnome_cmd_main_win_get_fs (main_win, RIGHT) || gnome_cmd_main_win_get_fs (main_win, RIGHT)->file_list() == fl)
+        if (!main_win->fs(RIGHT) || main_win->fs(RIGHT)->file_list() == fl)
         {
             col = gnome_cmd_data.priv->sort_column[RIGHT];
             direction = gnome_cmd_data.priv->sort_direction[RIGHT];
@@ -1951,13 +1951,13 @@ void gnome_cmd_data_get_sort_params (GnomeCmdFileList *fl, gint &col, gboolean &
 
 void gnome_cmd_data_set_sort_params (GnomeCmdFileList *fl, gint col, gboolean direction)
 {
-    if (gnome_cmd_main_win_get_fs (main_win, LEFT)->file_list() == fl)
+    if (main_win->fs(LEFT)->file_list()==fl)
     {
         gnome_cmd_data.priv->sort_column[LEFT] = col;
         gnome_cmd_data.priv->sort_direction[LEFT] = direction;
     }
     else
-        if (gnome_cmd_main_win_get_fs (main_win, RIGHT)->file_list() == fl)
+        if (main_win->fs(RIGHT)->file_list()==fl)
         {
             gnome_cmd_data.priv->sort_column[RIGHT] = col;
             gnome_cmd_data.priv->sort_direction[RIGHT] = direction;
diff --git a/src/gnome-cmd-file-popmenu.cc b/src/gnome-cmd-file-popmenu.cc
index f0a530c..776f953 100644
--- a/src/gnome-cmd-file-popmenu.cc
+++ b/src/gnome-cmd-file-popmenu.cc
@@ -137,7 +137,7 @@ static gboolean on_open_with_other_ok (GnomeCmdStringDialog *string_dialog, cons
         cmd += stringify (gnome_cmd_file_get_quoted_real_path (GNOME_CMD_FILE (files->data)));
     }
 
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
+    GnomeCmdFileSelector *fs = main_win->fs(ACTIVE);
     GnomeCmdDir *dir = fs->get_directory();
     gchar *dpath = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (dir));
     run_command_indir (cmd.c_str(), dpath, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (term_check)));
diff --git a/src/gnome-cmd-file-props-dialog.cc b/src/gnome-cmd-file-props-dialog.cc
index 1a3d982..06b30c8 100644
--- a/src/gnome-cmd-file-props-dialog.cc
+++ b/src/gnome-cmd-file-props-dialog.cc
@@ -221,7 +221,7 @@ static void on_dialog_ok (GtkButton *btn, GnomeCmdFilePropsDialogPrivate *data)
         result = gnome_cmd_file_rename (data->f, filename);
 
         if (result==GNOME_VFS_OK)
-            gnome_cmd_main_win_get_fs (main_win, ACTIVE)->file_list()->focus_file(filename, TRUE);
+            main_win->fs(ACTIVE)->file_list()->focus_file(filename, TRUE);
     }
 
     if (result == GNOME_VFS_OK)
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 0561769..ec06701 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -1539,8 +1539,8 @@ void gnome_cmd_file_selector_set_directory_to_opposite (GnomeCmdMainWin *mw, Fil
 {
     g_return_if_fail (mw!=NULL);
 
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (mw, fsID);
-    GnomeCmdFileSelector *other = gnome_cmd_main_win_get_fs (mw, !fsID);
+    GnomeCmdFileSelector *fs = mw->fs(fsID);
+    GnomeCmdFileSelector *other = mw->fs(!fsID);
 
     GnomeCmdDir *dir = other->get_directory();
     gboolean fs_is_active = fs->priv->active;
@@ -1640,7 +1640,7 @@ void GnomeCmdFileSelector::set_connection (GnomeCmdCon *con, GnomeCmdDir *start_
 
 gboolean gnome_cmd_file_selector_is_local (FileSelectorID fsID)
 {
-    return gnome_cmd_main_win_get_fs (main_win, fsID)->is_local();
+    return main_win->fs(fsID)->is_local();
 }
 
 
diff --git a/src/gnome-cmd-main-menu.cc b/src/gnome-cmd-main-menu.cc
index 2df8d69..e97c4b6 100644
--- a/src/gnome-cmd-main-menu.cc
+++ b/src/gnome-cmd-main-menu.cc
@@ -1024,7 +1024,7 @@ void gnome_cmd_main_menu_update_sens (GnomeCmdMainMenu *main_menu)
 {
     g_return_if_fail (GNOME_CMD_IS_MAIN_MENU (main_menu));
 
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
+    GnomeCmdFileSelector *fs = main_win->fs(ACTIVE);
 
     gtk_widget_set_sensitive (main_menu->priv->menu_view_back, fs->can_back());
     gtk_widget_set_sensitive (main_menu->priv->menu_view_forward, fs->can_forward());
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 1a98d2b..7935986 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -153,7 +153,7 @@ gint gnome_cmd_key_snooper(GtkWidget *grab_widget, GdkEventKey *event, GnomeCmdM
     if (!state_is_alt (event->state) && !state_is_alt_shift (event->state))
         return FALSE;
 
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (mw, ACTIVE);
+    GnomeCmdFileSelector *fs = mw->fs(ACTIVE);
     if (fs==NULL || fs->file_list()==NULL)
         return FALSE;
 
@@ -488,8 +488,8 @@ static void on_main_win_realize (GtkWidget *widget, GnomeCmdMainWin *mw)
 {
     mw->set_equal_panes();
 
-    gnome_cmd_main_win_get_fs (mw, LEFT)->set_active(TRUE);
-    gnome_cmd_main_win_get_fs (mw, RIGHT)->set_active(FALSE);
+    mw->fs(LEFT)->set_active(TRUE);
+    mw->fs(RIGHT)->set_active(FALSE);
 
     // if (gnome_cmd_data.cmdline_visibility)
     // {
@@ -563,7 +563,7 @@ inline void update_browse_buttons (GnomeCmdMainWin *mw, GnomeCmdFileSelector *fs
     g_return_if_fail (GNOME_CMD_IS_MAIN_WIN (mw));
     g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
 
-    if (fs == gnome_cmd_main_win_get_fs (mw, ACTIVE))
+    if (fs == mw->fs(ACTIVE))
     {
         if (gnome_cmd_data.toolbar_visibility)
         {
@@ -752,7 +752,7 @@ static void on_terminal_child_exited (GtkWidget *vte, GnomeCmdMainWin *mw)
         const char *working_dir = buf;
         char *envstrings = buf + strlen(buf) + 1;
 
-        gnome_cmd_main_win_get_fs (main_win, ACTIVE)->goto_directory(working_dir);
+        mw->fs(ACTIVE)->goto_directory(working_dir);
 
         // then environment variables set in the shell, in NAME=VALUE form
         if (g_env != NULL)
@@ -869,11 +869,11 @@ static void destroy (GtkObject *object)
         main_win->priv->key_snooper_id = 0;
     }
 
-    GnomeCmdDir *dir = gnome_cmd_main_win_get_fs (main_win, LEFT)->get_directory();
+    GnomeCmdDir *dir = main_win->fs(LEFT)->get_directory();
     if (con_home == gnome_cmd_dir_get_connection (dir))
         gnome_cmd_data_set_start_dir (LEFT, gnome_cmd_file_get_path (GNOME_CMD_FILE (dir)));
 
-    dir = gnome_cmd_main_win_get_fs (main_win, RIGHT)->get_directory();
+    dir = main_win->fs(RIGHT)->get_directory();
     if (con_home == gnome_cmd_dir_get_connection (dir))
         gnome_cmd_data_set_start_dir (RIGHT, gnome_cmd_file_get_path (GNOME_CMD_FILE (dir)));
 
@@ -996,23 +996,17 @@ static void init (GnomeCmdMainWin *mw)
     gnome_cmd_main_win_update_buttonbar_visibility (main_win);
     gnome_cmd_main_win_update_panels_visibility (main_win);
 
-    gtk_signal_connect (GTK_OBJECT (main_win), "realize", GTK_SIGNAL_FUNC (on_main_win_realize), mw);
-    gtk_signal_connect (GTK_OBJECT (mw->priv->file_selector[LEFT]), "changed-dir", GTK_SIGNAL_FUNC (on_fs_dir_change), mw);
-    gtk_signal_connect (GTK_OBJECT (mw->priv->file_selector[RIGHT]), "changed-dir", GTK_SIGNAL_FUNC (on_fs_dir_change), mw);
-
-    gtk_signal_connect (GTK_OBJECT (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[LEFT])->file_list()),
-                        "resize-column", GTK_SIGNAL_FUNC (on_fs_list_resize_column),
-                        GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[RIGHT])->file_list());
-    gtk_signal_connect (GTK_OBJECT (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[RIGHT])->file_list()),
-                        "resize-column", GTK_SIGNAL_FUNC (on_fs_list_resize_column),
-                        GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[LEFT])->file_list());
-    gtk_signal_connect (GTK_OBJECT (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[LEFT])->file_list()),
-                        "button-press-event", GTK_SIGNAL_FUNC (on_left_fs_select), mw);
-    gtk_signal_connect (GTK_OBJECT (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[RIGHT])->file_list()),
-                        "button-press-event", GTK_SIGNAL_FUNC (on_right_fs_select), mw);
-    gtk_signal_connect (GTK_OBJECT (mw), "size-allocate", GTK_SIGNAL_FUNC (on_size_allocate), mw);
-    gtk_signal_connect (GTK_OBJECT (mw), "delete-event", GTK_SIGNAL_FUNC (on_delete_event), mw);
-    gtk_signal_connect (GTK_OBJECT (mw->priv->paned), "button-press-event", GTK_SIGNAL_FUNC (on_slide_button_press), mw);
+    g_signal_connect (mw, "realize", G_CALLBACK (on_main_win_realize), mw);
+    g_signal_connect (mw->fs(LEFT), "changed-dir", G_CALLBACK (on_fs_dir_change), mw);
+    g_signal_connect (mw->fs(RIGHT), "changed-dir", G_CALLBACK (on_fs_dir_change), mw);
+
+    g_signal_connect (mw->fs(LEFT)->file_list(), "resize-column", G_CALLBACK (on_fs_list_resize_column), mw->fs(RIGHT)->file_list());
+    g_signal_connect (mw->fs(RIGHT)->file_list(), "resize-column", G_CALLBACK (on_fs_list_resize_column), mw->fs(LEFT)->file_list());
+    g_signal_connect (mw->fs(LEFT)->file_list(), "button-press-event", G_CALLBACK (on_left_fs_select), mw);
+    g_signal_connect (mw->fs(RIGHT)->file_list(), "button-press-event", G_CALLBACK (on_right_fs_select), mw);
+    g_signal_connect (mw, "size-allocate", G_CALLBACK (on_size_allocate), mw);
+    g_signal_connect (mw, "delete-event", G_CALLBACK (on_delete_event), mw);
+    g_signal_connect (mw->priv->paned, "button-press-event", G_CALLBACK (on_slide_button_press), mw);
     g_signal_connect (mw, "window-state-event", G_CALLBACK (on_window_state_event), NULL);
 
     g_signal_connect (terminal, "child-exited", G_CALLBACK (on_terminal_child_exited), mw);
@@ -1020,14 +1014,14 @@ static void init (GnomeCmdMainWin *mw)
     g_signal_connect (terminal, "button-press-event", G_CALLBACK (on_terminal_button_pressed), mw);
     g_signal_connect (terminal, "popup-menu", G_CALLBACK (on_terminal_popup_menu), mw);
 
-    gnome_cmd_main_win_get_fs (mw, LEFT)->update_connections();
-    gnome_cmd_main_win_get_fs (mw, RIGHT)->update_connections();
+    mw->fs(LEFT)->update_connections();
+    mw->fs(RIGHT)->update_connections();
 
-    gnome_cmd_main_win_get_fs (mw, LEFT)->set_connection(get_home_con ());
-    gnome_cmd_main_win_get_fs (mw, RIGHT)->set_connection(get_home_con ());
+    mw->fs(LEFT)->set_connection(get_home_con ());
+    mw->fs(RIGHT)->set_connection(get_home_con ());
 
-    gnome_cmd_main_win_get_fs (mw, LEFT)->goto_directory(start_dir_left ? start_dir_left : gnome_cmd_data_get_start_dir (LEFT));
-    gnome_cmd_main_win_get_fs (mw, RIGHT)->goto_directory(start_dir_right ? start_dir_right : gnome_cmd_data_get_start_dir (RIGHT));
+    mw->fs(LEFT)->goto_directory(start_dir_left ? start_dir_left : gnome_cmd_data_get_start_dir (LEFT));
+    mw->fs(RIGHT)->goto_directory(start_dir_right ? start_dir_right : gnome_cmd_data_get_start_dir (RIGHT));
 
     gtk_window_add_accel_group (GTK_WINDOW (main_win), mw->priv->accel_group);
     gnome_cmd_main_win_focus_file_lists (main_win);
@@ -1069,24 +1063,22 @@ GtkWidget *gnome_cmd_main_win_new ()
 }
 
 
-GnomeCmdFileSelector *gnome_cmd_main_win_get_fs (GnomeCmdMainWin *mw, FileSelectorID fs)
+GnomeCmdFileSelector *GnomeCmdMainWin::fs(FileSelectorID id)
 {
-    g_return_val_if_fail (GNOME_CMD_IS_MAIN_WIN (mw), NULL);
-
-    switch (fs)
+    switch (id)
     {
         case LEFT:
         case RIGHT:
-            return mw->priv->file_selector[fs] ?
-                   GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[fs]) : NULL;
+            return priv->file_selector[id] ?
+                   GNOME_CMD_FILE_SELECTOR (priv->file_selector[id]) : NULL;
 
         case ACTIVE:
-            return mw->priv->file_selector[mw->priv->current_fs] ?
-                   GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[mw->priv->current_fs]) : NULL;
+            return priv->file_selector[priv->current_fs] ?
+                   GNOME_CMD_FILE_SELECTOR (priv->file_selector[priv->current_fs]) : NULL;
 
         case INACTIVE:
-            return mw->priv->file_selector[!mw->priv->current_fs] ?
-                   GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[!mw->priv->current_fs]): NULL;
+            return priv->file_selector[!priv->current_fs] ?
+                   GNOME_CMD_FILE_SELECTOR (priv->file_selector[!priv->current_fs]): NULL;
 
        default:
             return NULL;
@@ -1101,8 +1093,8 @@ void gnome_cmd_main_win_update_style (GnomeCmdMainWin *mw)
 
     IMAGE_clear_mime_cache ();
 
-    gnome_cmd_main_win_get_fs (mw, LEFT)->update_style();
-    gnome_cmd_main_win_get_fs (mw, RIGHT)->update_style();
+    mw->fs(LEFT)->update_style();
+    mw->fs(RIGHT)->update_style();
 
     if (gnome_cmd_data.cmdline_visibility)
         gnome_cmd_cmdline_update_style (GNOME_CMD_CMDLINE (mw->priv->cmdline));
@@ -1142,8 +1134,8 @@ void gnome_cmd_main_win_focus_cmdline (GnomeCmdMainWin *mw)
 
 void gnome_cmd_main_win_focus_file_lists (GnomeCmdMainWin *mw)
 {
-    gnome_cmd_main_win_get_fs (mw, ACTIVE)->set_active(TRUE);
-    gnome_cmd_main_win_get_fs (mw, INACTIVE)->set_active(FALSE);
+    mw->fs(ACTIVE)->set_active(TRUE);
+    mw->fs(INACTIVE)->set_active(FALSE);
 
     mw->priv->focused_widget = mw->priv->file_selector[mw->priv->current_fs];
 }
@@ -1164,7 +1156,7 @@ gboolean gnome_cmd_main_win_keypressed (GnomeCmdMainWin *mw, GdkEventKey *event)
         {
             case GDK_1:
                 {
-                    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (mw, LEFT);
+                    GnomeCmdFileSelector *fs = mw->fs(LEFT);
                     gnome_cmd_main_win_switch_fs (mw, fs);
                     gnome_cmd_combo_popup_list (GNOME_CMD_COMBO (fs->con_combo));
                 }
@@ -1172,7 +1164,7 @@ gboolean gnome_cmd_main_win_keypressed (GnomeCmdMainWin *mw, GdkEventKey *event)
 
             case GDK_2:
                 {
-                    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (mw, RIGHT);
+                    GnomeCmdFileSelector *fs = mw->fs(RIGHT);
                     gnome_cmd_main_win_switch_fs (mw, fs);
                     gnome_cmd_combo_popup_list (GNOME_CMD_COMBO (fs->con_combo));
                 }
@@ -1211,14 +1203,14 @@ gboolean gnome_cmd_main_win_keypressed (GnomeCmdMainWin *mw, GdkEventKey *event)
             case GDK_u:
             case GDK_U:
                 {
-                    GnomeCmdDir *dir1 = gnome_cmd_main_win_get_fs (mw, LEFT)->get_directory();
-                    GnomeCmdDir *dir2 = gnome_cmd_main_win_get_fs (mw, RIGHT)->get_directory();
+                    GnomeCmdDir *dir1 = mw->fs(LEFT)->get_directory();
+                    GnomeCmdDir *dir2 = mw->fs(RIGHT)->get_directory();
 
                     gnome_cmd_dir_ref (dir1);
                     gnome_cmd_dir_ref (dir2);
 
-                    gnome_cmd_main_win_get_fs (mw, LEFT)->set_directory(dir2);
-                    gnome_cmd_main_win_get_fs (mw, RIGHT)->set_directory(dir1);
+                    mw->fs(LEFT)->set_directory(dir2);
+                    mw->fs(RIGHT)->set_directory(dir1);
 
                     gnome_cmd_dir_unref (dir1);
                     gnome_cmd_dir_unref (dir2);
@@ -1242,7 +1234,7 @@ gboolean gnome_cmd_main_win_keypressed (GnomeCmdMainWin *mw, GdkEventKey *event)
             {
                 GnomeCmdConFtp *con = GNOME_CMD_CON_FTP (gnome_cmd_con_list_get_all_ftp (gnome_cmd_con_list_get ())->data);
 
-                gnome_cmd_main_win_get_fs (main_win, ACTIVE)->set_connection(GNOME_CMD_CON (con));
+                main_win->fs(ACTIVE)->set_connection(GNOME_CMD_CON (con));
             }
             break;
         }
@@ -1254,7 +1246,7 @@ gboolean gnome_cmd_main_win_keypressed (GnomeCmdMainWin *mw, GdkEventKey *event)
                 case GDK_Tab:
                     // hack to avoid the default handling of the tab-key
                     clear_event_key (event);
-                    gnome_cmd_main_win_switch_fs (mw, gnome_cmd_main_win_get_fs (mw, INACTIVE));
+                    gnome_cmd_main_win_switch_fs (mw, mw->fs(INACTIVE));
                     return TRUE;
 
                 case GDK_F1:
@@ -1298,7 +1290,7 @@ gboolean gnome_cmd_main_win_keypressed (GnomeCmdMainWin *mw, GdkEventKey *event)
                     return TRUE;
             }
 
-    if (gnome_cmd_main_win_get_fs (mw, ACTIVE)->key_pressed(event))
+    if (mw->fs(ACTIVE)->key_pressed(event))
         return TRUE;
 
     return FALSE;
@@ -1319,12 +1311,12 @@ static void gnome_cmd_main_win_real_switch_fs (GnomeCmdMainWin *mw, GnomeCmdFile
     g_return_if_fail (GNOME_CMD_IS_MAIN_WIN (mw));
     g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
 
-    if (fs == gnome_cmd_main_win_get_fs (mw, ACTIVE))
+    if (fs == mw->fs(ACTIVE))
         return;
 
     mw->priv->current_fs = (FileSelectorID) !mw->priv->current_fs;
-    gnome_cmd_main_win_get_fs (mw, ACTIVE)->set_active(TRUE);
-    gnome_cmd_main_win_get_fs (mw, INACTIVE)->set_active(FALSE);
+    mw->fs(ACTIVE)->set_active(TRUE);
+    mw->fs(INACTIVE)->set_active(FALSE);
 
     update_browse_buttons (mw, fs);
     update_drop_con_button (mw, fs);
@@ -1401,7 +1393,7 @@ void gnome_cmd_main_win_update_toolbar_visibility (GnomeCmdMainWin *mw)
         mw->priv->toolbar_sep = NULL;
     }
 
-    update_drop_con_button (mw, gnome_cmd_main_win_get_fs (mw, ACTIVE));
+    update_drop_con_button (mw, mw->fs(ACTIVE));
 }
 
 
@@ -1506,8 +1498,8 @@ GnomeCmdState *gnome_cmd_main_win_get_state (GnomeCmdMainWin *mw)
 {
     g_return_val_if_fail (GNOME_CMD_IS_MAIN_WIN (mw), NULL);
 
-    GnomeCmdFileSelector *fs1 = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
-    GnomeCmdFileSelector *fs2 = gnome_cmd_main_win_get_fs (main_win, INACTIVE);
+    GnomeCmdFileSelector *fs1 = main_win->fs(ACTIVE);
+    GnomeCmdFileSelector *fs2 = main_win->fs(INACTIVE);
     GnomeCmdDir *dir1 = fs1->get_directory();
     GnomeCmdDir *dir2 = fs2->get_directory();
 
diff --git a/src/gnome-cmd-main-win.h b/src/gnome-cmd-main-win.h
index 7c6e6db..1fa1a4a 100644
--- a/src/gnome-cmd-main-win.h
+++ b/src/gnome-cmd-main-win.h
@@ -21,20 +21,8 @@
 #ifndef __GNOME_CMD_MAIN_WIN_H__
 #define __GNOME_CMD_MAIN_WIN_H__
 
-<<<<<<< HEAD:src/gnome-cmd-main-win.h
-#define GNOME_CMD_MAIN_WIN(obj) \
-    GTK_CHECK_CAST(obj, gnome_cmd_main_win_get_type (), GnomeCmdMainWin)
-#define GNOME_CMD_MAIN_WIN_CLASS(klass) \
-    GTK_CHECK_CLASS_CAST(klass, gnome_cmd_main_win_get_type (), GnomeCmdMainWinClass)
-#define GNOME_CMD_IS_MAIN_WIN(obj) \
-    GTK_CHECK_TYPE(obj, gnome_cmd_main_win_get_type ())
-
-struct GnomeCmdMainWinPrivate;
-
 #include <vte/vte.h>
 
-=======
->>>>>>> a54a5c4... Convert GnomeCmdMainWin struct into C++ class:src/gnome-cmd-main-win.h
 #include "gnome-cmd-file-selector.h"
 #include "gnome-cmd-advrename-dialog.h"
 #include "gnome-cmd-cmdline.h"
@@ -61,6 +49,8 @@ struct GnomeCmdMainWin
 
     GnomeCmdAdvrenameDialog *advrename_dlg;
 
+    GnomeCmdFileSelector *fs(FileSelectorID id);
+    
     void set_equal_panes();
 
     void set_cap_state(gboolean state);
@@ -72,7 +62,6 @@ extern GnomeCmdMainWin *main_win;
 
 GtkWidget *gnome_cmd_main_win_new ();
 
-GnomeCmdFileSelector *gnome_cmd_main_win_get_fs (GnomeCmdMainWin *mw, FileSelectorID fs);
 void gnome_cmd_main_win_switch_fs (GnomeCmdMainWin *mw, GnomeCmdFileSelector *fs);
 
 GnomeCmdCmdline *gnome_cmd_main_win_get_cmdline (GnomeCmdMainWin *mw);
diff --git a/src/gnome-cmd-mkdir-dialog.cc b/src/gnome-cmd-mkdir-dialog.cc
index 47113ea..d07f3e1 100644
--- a/src/gnome-cmd-mkdir-dialog.cc
+++ b/src/gnome-cmd-mkdir-dialog.cc
@@ -121,7 +121,7 @@ static gboolean on_ok (GnomeCmdStringDialog *string_dialog, const gchar **values
                 string mkdir_uri_str = stringify (gnome_vfs_uri_to_string (mkdir_uri, GNOME_VFS_URI_HIDE_NONE));
 
                 gnome_cmd_dir_file_created (dialog->priv->dir, mkdir_uri_str.c_str());
-                gnome_cmd_main_win_get_fs (main_win, ACTIVE)->file_list()->focus_file(focus_filename.c_str(), TRUE);
+                main_win->fs(ACTIVE)->file_list()->focus_file(focus_filename.c_str(), TRUE);
                 new_dir_focused = TRUE;
             }
     }
diff --git a/src/gnome-cmd-prepare-xfer-dialog.cc b/src/gnome-cmd-prepare-xfer-dialog.cc
index aa68295..c9a6a68 100644
--- a/src/gnome-cmd-prepare-xfer-dialog.cc
+++ b/src/gnome-cmd-prepare-xfer-dialog.cc
@@ -39,7 +39,7 @@ static GnomeCmdDialogClass *parent_class = NULL;
 
 inline gboolean con_device_has_path (FileSelectorID fsID, GnomeCmdCon *&dev, const gchar *user_path)
 {
-    dev = gnome_cmd_main_win_get_fs (main_win, fsID)->get_connection();
+    dev = main_win->fs(fsID)->get_connection();
 
     return GNOME_CMD_IS_CON_DEVICE (dev) &&
            g_str_has_prefix (user_path, gnome_cmd_con_device_get_mountp (GNOME_CMD_CON_DEVICE (dev)));
diff --git a/src/gnome-cmd-python-plugin.cc b/src/gnome-cmd-python-plugin.cc
index 572d1e4..0630d67 100644
--- a/src/gnome-cmd-python-plugin.cc
+++ b/src/gnome-cmd-python-plugin.cc
@@ -175,7 +175,7 @@ GList *gnome_cmd_python_plugin_get_list()
 
 inline gchar *get_dir_as_str (GnomeCmdMainWin *mw, FileSelectorID id)
 {
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (mw, id);
+    GnomeCmdFileSelector *fs = mw->fs(id);
 
     if (!fs)
         return NULL;
@@ -247,7 +247,7 @@ gboolean gnome_cmd_python_plugin_execute(const PythonPluginData *plugin, GnomeCm
     GnomeCmdFileSelector *active_fs;
     GnomeCmdFileList     *active_fl;
 
-    active_fs = gnome_cmd_main_win_get_fs (mw, ACTIVE);
+    active_fs = mw->fs(ACTIVE);
     active_fl = active_fs ? active_fs->file_list() : NULL;
 
     if (!GNOME_CMD_IS_FILE_LIST (active_fl))
diff --git a/src/gnome-cmd-remote-dialog.cc b/src/gnome-cmd-remote-dialog.cc
index 6db6170..20f3d0f 100644
--- a/src/gnome-cmd-remote-dialog.cc
+++ b/src/gnome-cmd-remote-dialog.cc
@@ -114,10 +114,9 @@ inline void set_server (GtkListStore *store, GtkTreeIter *iter, GnomeCmdConFtp *
 
 static gboolean do_connect_real (GnomeCmdConFtp *server)
 {
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
     GnomeCmdCon *con = GNOME_CMD_CON (server);
 
-    fs->set_connection(con);
+    main_win->fs(ACTIVE)->set_connection(con);
     // gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, G_DIR_SEPARATOR_S)));
 
     return FALSE;
diff --git a/src/gnome-cmd-rename-dialog.cc b/src/gnome-cmd-rename-dialog.cc
index 71d33b2..33576c9 100644
--- a/src/gnome-cmd-rename-dialog.cc
+++ b/src/gnome-cmd-rename-dialog.cc
@@ -63,7 +63,7 @@ static gboolean on_dialog_keypressed (GtkWidget *widget, GdkEventKey *event, gpo
                 GnomeVFSResult result = gnome_cmd_file_rename (dialog->priv->f, new_fname);
 
                 if (result==GNOME_VFS_OK)
-                    gnome_cmd_main_win_get_fs (main_win, ACTIVE)->file_list()->focus_file(new_fname, TRUE);
+                    main_win->fs(ACTIVE)->file_list()->focus_file(new_fname, TRUE);
 
                 gnome_cmd_file_unref (dialog->priv->f);
                 gtk_widget_destroy (widget);
diff --git a/src/gnome-cmd-search-dialog.cc b/src/gnome-cmd-search-dialog.cc
index 990450f..00152fa 100644
--- a/src/gnome-cmd-search-dialog.cc
+++ b/src/gnome-cmd-search-dialog.cc
@@ -629,7 +629,7 @@ static void on_goto (GtkButton *button, GnomeCmdSearchDialog *dialog)
     gchar *fpath = gnome_cmd_file_get_path (f);
     gchar *dpath = g_path_get_dirname (fpath);
 
-    GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
+    GnomeCmdFileSelector *fs = main_win->fs(ACTIVE);
     fs->goto_directory(dpath);
     fs->file_list()->focus_file(gnome_cmd_file_get_name (f), TRUE);
 
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 662d951..5c7df2e 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -52,7 +52,7 @@ using namespace std;
 
 inline GnomeCmdFileSelector *get_fs (const FileSelectorID fsID)
 {
-    return gnome_cmd_main_win_get_fs (main_win, fsID);
+    return main_win->fs(fsID);
 }
 
 



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