[gnome-commander] GnomeCmdMainWin: more C++ rework



commit b4d88a18a7bd104a0b510add8767ee40dd8deae6
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Fri Jul 24 23:16:50 2009 +0200

    GnomeCmdMainWin: more C++ rework

 src/gnome-cmd-file-popmenu.cc |    3 +--
 src/gnome-cmd-main-menu.cc    |    2 +-
 src/gnome-cmd-main-win.cc     |   10 ++++------
 src/gnome-cmd-main-win.h      |    3 +--
 src/plugin_manager.cc         |    2 +-
 5 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/src/gnome-cmd-file-popmenu.cc b/src/gnome-cmd-file-popmenu.cc
index 776f953..57a1c71 100644
--- a/src/gnome-cmd-file-popmenu.cc
+++ b/src/gnome-cmd-file-popmenu.cc
@@ -550,8 +550,7 @@ GtkWidget *gnome_cmd_file_popmenu_new (GnomeCmdFileList *fl)
         PluginData *data = (PluginData *) tmp->data;
         if (data->active)
         {
-            GList *items = gnome_cmd_plugin_create_popup_menu_items (data->plugin,
-                                                                     gnome_cmd_main_win_get_state (main_win));
+            GList *items = gnome_cmd_plugin_create_popup_menu_items (data->plugin, main_win->get_state());
             if (items)
             {
                 add_plugin_menu_items (menu, items, pos);
diff --git a/src/gnome-cmd-main-menu.cc b/src/gnome-cmd-main-menu.cc
index f0fa7b7..b0d4077 100644
--- a/src/gnome-cmd-main-menu.cc
+++ b/src/gnome-cmd-main-menu.cc
@@ -1024,7 +1024,7 @@ static void on_plugin_menu_activate (GtkMenuItem *item, PluginData *data)
 {
     g_return_if_fail (data != NULL);
 
-    GnomeCmdState *state = gnome_cmd_main_win_get_state (main_win);
+    GnomeCmdState *state = main_win->get_state();
     gnome_cmd_plugin_update_main_menu_state (data->plugin, state);
 }
 
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 21d1091..7c5770d 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -1297,16 +1297,14 @@ void gnome_cmd_main_win_add_plugin_menu (GnomeCmdMainWin *mw, PluginData *data)
 }
 
 
-GnomeCmdState *gnome_cmd_main_win_get_state (GnomeCmdMainWin *mw)
+GnomeCmdState *GnomeCmdMainWin::get_state()
 {
-    g_return_val_if_fail (GNOME_CMD_IS_MAIN_WIN (mw), NULL);
-
-    GnomeCmdFileSelector *fs1 = main_win->fs(ACTIVE);
-    GnomeCmdFileSelector *fs2 = main_win->fs(INACTIVE);
+    GnomeCmdFileSelector *fs1 = fs(ACTIVE);
+    GnomeCmdFileSelector *fs2 = fs(INACTIVE);
     GnomeCmdDir *dir1 = fs1->get_directory();
     GnomeCmdDir *dir2 = fs2->get_directory();
 
-    GnomeCmdState *state = &mw->priv->state;
+    GnomeCmdState *state = &priv->state;
     state->active_dir_uri = gnome_cmd_file_get_uri (GNOME_CMD_FILE (dir1));
     state->inactive_dir_uri = gnome_cmd_file_get_uri (GNOME_CMD_FILE (dir2));
     state->active_dir_files = fs1->file_list()->get_visible_files();
diff --git a/src/gnome-cmd-main-win.h b/src/gnome-cmd-main-win.h
index cb6633c..149302f 100644
--- a/src/gnome-cmd-main-win.h
+++ b/src/gnome-cmd-main-win.h
@@ -52,6 +52,7 @@ struct GnomeCmdMainWin
     gboolean key_pressed (GdkEventKey *event);
 
     void set_equal_panes();
+    GnomeCmdState *get_state();
     void set_cap_state(gboolean state);
 };
 
@@ -79,6 +80,4 @@ void gnome_cmd_main_win_update_list_orientation (GnomeCmdMainWin *mw);
 
 void gnome_cmd_main_win_add_plugin_menu (GnomeCmdMainWin *mw, PluginData *data);
 
-GnomeCmdState *gnome_cmd_main_win_get_state (GnomeCmdMainWin *mw);
-
 #endif // __GNOME_CMD_MAIN_WIN_H__
diff --git a/src/plugin_manager.cc b/src/plugin_manager.cc
index 1650d9e..ed81b95 100644
--- a/src/plugin_manager.cc
+++ b/src/plugin_manager.cc
@@ -123,7 +123,7 @@ static void activate_plugin (PluginData *data)
 
     data->active = TRUE;
 
-    GnomeCmdState *state = gnome_cmd_main_win_get_state (main_win);
+    GnomeCmdState *state = main_win->get_state();
     data->menu = gnome_cmd_plugin_create_main_menu (data->plugin, state);
     if (data->menu)
         gnome_cmd_main_win_add_plugin_menu (main_win, data);



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