[gnome-commander/gcmd-1-3] Convert GnomeCmdMainWin struct into C++ class
- From: Piotr Eljasiak <epiotr src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-commander/gcmd-1-3] Convert GnomeCmdMainWin struct into C++ class
- Date: Tue, 21 Jul 2009 19:27:38 +0000 (UTC)
commit 5fd7e514cf2ec0efb5dd8bc7b78bda3d83089783
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Tue Jul 21 21:21:11 2009 +0200
Convert GnomeCmdMainWin struct into C++ class
src/cap.cc | 8 ++++----
src/gnome-cmd-main-win.cc | 38 ++++++++++++++++++++++----------------
src/gnome-cmd-main-win.h | 33 +++++++++++++++++++++------------
src/gnome-cmd-user-actions.cc | 2 +-
4 files changed, 48 insertions(+), 33 deletions(-)
---
diff --git a/src/cap.cc b/src/cap.cc
index c8802c8..4655a2a 100644
--- a/src/cap.cc
+++ b/src/cap.cc
@@ -66,7 +66,7 @@ inline void cut_and_paste (GnomeCmdDir *to)
GTK_SIGNAL_FUNC (on_xfer_done), _files);
_files = NULL;
_fl = NULL;
- gnome_cmd_main_win_set_cap_state (main_win, FALSE);
+ main_win->set_cap_state(FALSE);
}
@@ -82,7 +82,7 @@ inline void copy_and_paste (GnomeCmdDir *to)
GTK_SIGNAL_FUNC (on_xfer_done), _files);
_files = NULL;
_fl = NULL;
- gnome_cmd_main_win_set_cap_state (main_win, FALSE);
+ main_win->set_cap_state(FALSE);
}
@@ -91,7 +91,7 @@ void cap_cut_files (GnomeCmdFileList *fl, GList *files)
update_refs (fl, files);
_type = GNOME_CMD_CUTTED;
- gnome_cmd_main_win_set_cap_state (main_win, TRUE);
+ main_win->set_cap_state(TRUE);
}
@@ -101,7 +101,7 @@ void cap_copy_files (GnomeCmdFileList *fl, GList *files)
update_refs (fl, files);
_type = GNOME_CMD_COPIED;
- gnome_cmd_main_win_set_cap_state (main_win, TRUE);
+ main_win->set_cap_state(TRUE);
}
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index a4cdfd9..1a98d2b 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -74,7 +74,15 @@ enum
};
-struct GnomeCmdMainWinPrivate
+struct GnomeCmdMainWinClass
+{
+ GnomeAppClass parent_class;
+
+ void (* switch_fs) (GnomeCmdMainWin *mw, GnomeCmdFileSelector *fs);
+};
+
+
+struct GnomeCmdMainWin::Private
{
FileSelectorID current_fs;
GnomeCmdState state;
@@ -118,10 +126,10 @@ struct GnomeCmdMainWinPrivate
static GnomeAppClass *parent_class = NULL;
-static guint main_win_signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL] = { 0 };
static GtkTooltips *toolbar_tooltips = NULL;
-extern gchar *start_dir_left; //main.cc
-extern gchar *start_dir_right; //main.cc
+extern gchar *start_dir_left; // main.cc
+extern gchar *start_dir_right; // main.cc
static void gnome_cmd_main_win_real_switch_fs (GnomeCmdMainWin *mw, GnomeCmdFileSelector *fs);
@@ -478,14 +486,14 @@ static gboolean on_slide_button_press (GtkWidget *widget, GdkEventButton *event,
static void on_main_win_realize (GtkWidget *widget, GnomeCmdMainWin *mw)
{
- gnome_cmd_main_win_set_equal_panes (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);
// if (gnome_cmd_data.cmdline_visibility)
// {
- // gchar *dpath = gnome_cmd_file_get_path (GNOME_CMD_FILE (gnome_cmd_main_win_get_fs (mw, LEFT)->get_directory()));
+ // gchar *dpath = gnome_cmd_file_get_path (GNOME_CMD_FILE (mw->fs(LEFT)->get_directory()));
// gnome_cmd_cmdline_set_dir (GNOME_CMD_CMDLINE (mw->priv->cmdline), dpath);
// g_free (dpath);
// }
@@ -639,11 +647,11 @@ static void on_fs_dir_change (GnomeCmdFileSelector *fs, const gchar dir, GnomeCm
}
-static void restore_size_and_pos (GnomeCmdMainWin *mw)
+inline void restore_size_and_pos (GnomeCmdMainWin *mw)
{
gint x, y;
- gtk_widget_set_size_request (GTK_WIDGET (main_win),
+ gtk_widget_set_size_request (*mw,
gnome_cmd_data.main_win_width,
gnome_cmd_data.main_win_height);
@@ -890,7 +898,7 @@ static void class_init (GnomeCmdMainWinClass *klass)
parent_class = (GnomeAppClass *) gtk_type_class (gnome_app_get_type ());
- main_win_signals[SWITCH_FS] =
+ signals[SWITCH_FS] =
gtk_signal_new ("switch-fs",
GTK_RUN_LAST,
G_OBJECT_CLASS_TYPE (object_class),
@@ -912,7 +920,7 @@ static void init (GnomeCmdMainWin *mw)
main_win = GNOME_CMD_MAIN_WIN (mw);
mw->advrename_dlg = NULL;
- mw->priv = g_new0 (GnomeCmdMainWinPrivate, 1);
+ mw->priv = g_new0 (GnomeCmdMainWin::Private, 1);
mw->priv->current_fs = LEFT;
mw->priv->accel_group = gtk_accel_group_new ();
mw->priv->toolbar = NULL;
@@ -1302,7 +1310,7 @@ void gnome_cmd_main_win_switch_fs (GnomeCmdMainWin *mw, GnomeCmdFileSelector *fs
g_return_if_fail (GNOME_CMD_IS_MAIN_WIN (mw));
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
- gtk_signal_emit (GTK_OBJECT (mw), main_win_signals[SWITCH_FS], fs);
+ gtk_signal_emit (*mw, signals[SWITCH_FS], fs);
}
@@ -1515,15 +1523,13 @@ GnomeCmdState *gnome_cmd_main_win_get_state (GnomeCmdMainWin *mw)
}
-void gnome_cmd_main_win_set_cap_state (GnomeCmdMainWin *mw, gboolean state)
+void GnomeCmdMainWin::set_cap_state (gboolean state)
{
- g_return_if_fail (GNOME_CMD_IS_MAIN_WIN (mw));
-
- gtk_widget_set_sensitive (mw->priv->tb_cap_paste_btn, state);
+ gtk_widget_set_sensitive (priv->tb_cap_paste_btn, state);
}
-void gnome_cmd_main_win_set_equal_panes (GnomeCmdMainWin *mw)
+void GnomeCmdMainWin::set_equal_panes()
{
slide_set_50_50 (NULL, NULL);
}
diff --git a/src/gnome-cmd-main-win.h b/src/gnome-cmd-main-win.h
index d919c67..7c6e6db 100644
--- a/src/gnome-cmd-main-win.h
+++ b/src/gnome-cmd-main-win.h
@@ -21,6 +21,7 @@
#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) \
@@ -32,31 +33,43 @@ 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"
#include "plugin_manager.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 ())
+
+
+GtkType gnome_cmd_main_win_get_type ();
+
+
struct GnomeCmdMainWin
{
GnomeApp parent;
+
+ struct Private;
+
+ Private *priv;
+
+ operator GtkObject * () { return GTK_OBJECT (this); }
+ operator GtkWidget * () { return GTK_WIDGET (this); }
+
GnomeCmdAdvrenameDialog *advrename_dlg;
- GnomeCmdMainWinPrivate *priv;
-};
-struct GnomeCmdMainWinClass
-{
- GnomeAppClass parent_class;
+ void set_equal_panes();
- void (* switch_fs) (GnomeCmdMainWin *mw, GnomeCmdFileSelector *fs);
+ void set_cap_state(gboolean state);
};
extern GnomeCmdMainWin *main_win;
-GtkType gnome_cmd_main_win_get_type ();
-
GtkWidget *gnome_cmd_main_win_new ();
GnomeCmdFileSelector *gnome_cmd_main_win_get_fs (GnomeCmdMainWin *mw, FileSelectorID fs);
@@ -105,8 +118,4 @@ void gnome_cmd_main_win_add_plugin_menu (GnomeCmdMainWin *mw, PluginData *data);
GnomeCmdState *gnome_cmd_main_win_get_state (GnomeCmdMainWin *mw);
-void gnome_cmd_main_win_set_cap_state (GnomeCmdMainWin *mw, gboolean state);
-
-void gnome_cmd_main_win_set_equal_panes (GnomeCmdMainWin *mw);
-
#endif // __GNOME_CMD_MAIN_WIN_H__
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 88bda83..662d951 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1368,7 +1368,7 @@ void view_refresh (GtkMenuItem *menuitem, gpointer not_used)
void view_equal_panes (GtkMenuItem *menuitem, gpointer not_used)
{
- gnome_cmd_main_win_set_equal_panes (GNOME_CMD_MAIN_WIN (main_win));
+ main_win->set_equal_panes();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]