gnome-commander r1979 - in branches/gcmd-1-3: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r1979 - in branches/gcmd-1-3: . src
- Date: Thu, 14 Aug 2008 18:36:13 +0000 (UTC)
Author: epiotr
Date: Thu Aug 14 18:36:13 2008
New Revision: 1979
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1979&view=rev
Log:
Convert GnomeCmdFileSelector struct into C++ class, part 1
Modified:
branches/gcmd-1-3/ChangeLog
branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc
branches/gcmd-1-3/src/gnome-cmd-cmdline.cc
branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc
branches/gcmd-1-3/src/gnome-cmd-file-popmenu.cc
branches/gcmd-1-3/src/gnome-cmd-file-selector.cc
branches/gcmd-1-3/src/gnome-cmd-file-selector.h
branches/gcmd-1-3/src/gnome-cmd-list-popmenu.cc
branches/gcmd-1-3/src/gnome-cmd-main-menu.cc
branches/gcmd-1-3/src/gnome-cmd-main-win.cc
branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc
branches/gcmd-1-3/src/gnome-cmd-python-plugin.cc
branches/gcmd-1-3/src/gnome-cmd-remote-dialog.cc
branches/gcmd-1-3/src/gnome-cmd-user-actions.cc
Modified: branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-bookmark-dialog.cc Thu Aug 14 18:36:13 2008
@@ -326,7 +326,7 @@
static void add_bookmarks (GnomeCmdBookmarkDialog *dialog)
{
- GnomeCmdCon *current_con = gnome_cmd_file_selector_get_connection (gnome_cmd_main_win_get_fs (main_win, ACTIVE));
+ GnomeCmdCon *current_con = gnome_cmd_main_win_get_fs (main_win, ACTIVE)->get_connection();
g_return_if_fail (current_con != NULL);
@@ -555,7 +555,7 @@
static gboolean on_new_bookmark_ok (GnomeCmdStringDialog *string_dialog, const gchar **values, gpointer data)
{
GnomeCmdBookmark *bookmark = g_new0 (GnomeCmdBookmark, 1);
- GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (gnome_cmd_main_win_get_fs (main_win, ACTIVE));
+ GnomeCmdCon *con = gnome_cmd_main_win_get_fs (main_win, ACTIVE)->get_connection();
GnomeCmdBookmarkGroup *group = gnome_cmd_con_get_bookmarks (con);
bookmark->name = g_strdup (values[0]);
@@ -572,7 +572,7 @@
void gnome_cmd_bookmark_add_current (void)
{
- GnomeCmdDir *cwd = gnome_cmd_file_selector_get_directory (gnome_cmd_main_win_get_fs (main_win, ACTIVE));
+ GnomeCmdDir *cwd = gnome_cmd_main_win_get_fs (main_win, ACTIVE)->get_directory();
gchar *path = gnome_cmd_file_get_path (GNOME_CMD_FILE (cwd));
if (!g_utf8_validate (path, -1, NULL))
@@ -598,7 +598,7 @@
GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
- GnomeCmdCon *current_con = gnome_cmd_file_selector_get_connection (fs);
+ GnomeCmdCon *current_con = fs->get_connection();
if (current_con == bookmark->group->con)
gnome_cmd_file_selector_goto_directory (fs, bookmark->path);
@@ -609,7 +609,7 @@
if (con->state == CON_STATE_OPEN)
{
GnomeCmdDir *dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, bookmark->path));
- gnome_cmd_file_selector_set_connection (fs, con, dir);
+ fs->set_connection(con, dir);
}
else
@@ -619,7 +619,7 @@
con->base_path = gnome_cmd_con_create_path (con, bookmark->path);
gtk_object_ref (GTK_OBJECT (con->base_path));
- gnome_cmd_file_selector_set_connection (fs, con);
+ fs->set_connection(con);
}
}
}
Modified: branches/gcmd-1-3/src/gnome-cmd-cmdline.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-cmdline.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-cmdline.cc Thu Aug 14 18:36:13 2008
@@ -63,10 +63,7 @@
inline void add_to_history (GnomeCmdCmdline *cmdline, const gchar *command)
{
- cmdline->priv->history = string_history_add (
- cmdline->priv->history,
- command,
- gnome_cmd_data_get_cmdline_history_length());
+ cmdline->priv->history = string_history_add (cmdline->priv->history, command, gnome_cmd_data_get_cmdline_history_length());
update_history_combo (cmdline);
}
@@ -87,12 +84,12 @@
if (strcmp (dest_dir, "-")==0)
{
- GnomeVFSURI *test_uri = gnome_cmd_dir_get_child_uri (gnome_cmd_file_selector_get_directory (fs), "-");
+ GnomeVFSURI *test_uri = gnome_cmd_dir_get_child_uri (fs->get_directory(), "-");
if (gnome_vfs_uri_exists (test_uri))
gnome_cmd_file_selector_goto_directory (fs, dest_dir);
else
- gnome_cmd_file_selector_back (fs);
+ fs->back();
gnome_vfs_uri_unref (test_uri);
}
@@ -103,10 +100,9 @@
if (strcmp (cmdline_text, "cd")==0)
gnome_cmd_file_selector_goto_directory (fs, "~");
else
- if (gnome_cmd_con_is_local (gnome_cmd_file_selector_get_connection (fs)))
+ if (fs->is_local())
{
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
- gchar *fpath = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (dir));
+ gchar *fpath = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (fs->get_directory()));
run_command_indir (cmdline_text, fpath, term);
g_free (fpath);
@@ -164,7 +160,7 @@
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
g_return_if_fail (GNOME_CMD_IS_CMDLINE (cmdline));
- gchar *dpath = gnome_cmd_dir_get_display_path (gnome_cmd_file_selector_get_directory (fs));
+ gchar *dpath = gnome_cmd_dir_get_display_path (fs->get_directory());
gnome_cmd_cmdline_set_dir (cmdline, dpath);
g_free (dpath);
}
@@ -496,7 +492,7 @@
GtkWidget *file_list = fs->list_widget;
gtk_widget_grab_focus (file_list);
- gnome_cmd_file_selector_set_active (fs, TRUE);
+ fs->set_active(TRUE);
gtk_signal_emit_by_name (GTK_OBJECT (file_list), "key-press-event", &event2, &ret);
event->keyval = 0;
Modified: branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-dir-indicator.cc Thu Aug 14 18:36:13 2008
@@ -330,7 +330,7 @@
GTK_OBJECT (indicator->priv->dir_history_popup), "hide",
GTK_SIGNAL_FUNC (on_dir_history_popup_hide), indicator);
- GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (indicator->priv->fs);
+ GnomeCmdCon *con = indicator->priv->fs->get_connection();
History *history = gnome_cmd_con_get_dir_history (con);
for (GList *l=history->ents; l; l=l->next)
@@ -356,14 +356,14 @@
static void on_bookmarks_add_current (GtkMenuItem *item, GnomeCmdDirIndicator *indicator)
{
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (indicator->priv->fs);
- GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (indicator->priv->fs);
+ GnomeCmdFile *f = GNOME_CMD_FILE (indicator->priv->fs->get_directory());
+ GnomeCmdCon *con = indicator->priv->fs->get_connection();
GnomeCmdBookmarkGroup *group = gnome_cmd_con_get_bookmarks (con);
GnomeCmdBookmark *bm = g_new0 (GnomeCmdBookmark, 1);
- bm->name = g_strdup (gnome_cmd_file_get_name (GNOME_CMD_FILE (dir)));
- bm->path = gnome_cmd_file_get_path (GNOME_CMD_FILE (dir));
+ bm->name = g_strdup (gnome_cmd_file_get_name (f));
+ bm->path = gnome_cmd_file_get_path (f);
bm->group = group;
group->bookmarks = g_list_append (group->bookmarks, bm);
@@ -385,7 +385,7 @@
gtk_object_set_data_full (GTK_OBJECT (indicator), "bookmark_popup", indicator->priv->bookmark_popup, (GtkDestroyNotify) gtk_widget_unref);
gtk_signal_connect (GTK_OBJECT (indicator->priv->bookmark_popup), "hide", GTK_SIGNAL_FUNC (on_bookmark_popup_hide), indicator);
- GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (indicator->priv->fs);
+ GnomeCmdCon *con = indicator->priv->fs->get_connection();
GnomeCmdBookmarkGroup *group = gnome_cmd_con_get_bookmarks (con);
for (GList *l = group->bookmarks; l; l = l->next)
Modified: branches/gcmd-1-3/src/gnome-cmd-file-popmenu.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-popmenu.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-popmenu.cc Thu Aug 14 18:36:13 2008
@@ -135,7 +135,7 @@
}
GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
+ 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)));
g_free (dpath);
Modified: branches/gcmd-1-3/src/gnome-cmd-file-selector.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-selector.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-selector.cc Thu Aug 14 18:36:13 2008
@@ -56,8 +56,10 @@
static GtkVBoxClass *parent_class = NULL;
-struct _GnomeCmdFileSelectorPrivate
+class GnomeCmdFileSelector::Private
{
+ public:
+
GtkWidget *filter_box;
gboolean active;
@@ -77,8 +79,37 @@
gboolean autoscroll_dir;
guint autoscroll_timeout;
gint autoscroll_y;
+
+ Private();
+ ~Private();
};
+
+inline GnomeCmdFileSelector::Private::Private()
+{
+ active = FALSE;
+ realized = FALSE;
+ sel_first_file = TRUE;
+ cwd = NULL;
+ lwd = NULL;
+ connected_dir = NULL;
+ old_btns = NULL;
+ dir_history = NULL;
+ sym_file = NULL;
+ con = NULL;
+ con_open_dialog = NULL;
+ con_open_dialog_label = NULL;
+ con_opening = NULL;
+}
+
+
+inline GnomeCmdFileSelector::Private::~Private()
+{
+ gnome_cmd_dir_unref (cwd);
+ // gnome_cmd_dir_unref (cwd); // FIXME ??
+}
+
+
enum {CHANGED_DIR, LAST_SIGNAL};
static guint file_selector_signals[LAST_SIGNAL] = { 0 };
@@ -239,7 +270,7 @@
dir = gnome_cmd_con_should_remember_dir (con) ? gnome_cmd_con_get_cwd (con) :
gnome_cmd_con_get_default_dir (con);
- gnome_cmd_file_selector_set_directory (fs, dir);
+ fs->set_directory(dir);
if (!con_change_needed)
gnome_cmd_combo_select_data (GNOME_CMD_COMBO (fs->con_combo), con);
@@ -310,7 +341,7 @@
{
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
+ GnomeCmdDir *dir = fs->get_directory();
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
GList *list;
@@ -449,7 +480,7 @@
}
f = gnome_cmd_file_list_get_file_at_row (fs->list, row);
- cwd = gnome_cmd_file_selector_get_directory (fs);
+ cwd = fs->get_directory();
if (f && f->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
{
@@ -508,7 +539,7 @@
{
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
+ GnomeCmdDir *dir = fs->get_directory();
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
GList *files = gnome_cmd_file_list_get_selected_files (fs->list);
@@ -709,7 +740,7 @@
const gchar *focus_dir = NULL;
gchar *dir;
- cur_dir = gnome_cmd_file_selector_get_directory (fs);
+ cur_dir = fs->get_directory();
g_return_if_fail (GNOME_CMD_IS_DIR (cur_dir));
if (g_str_has_prefix (in_dir, "~"))
@@ -745,7 +776,7 @@
}
if (new_dir)
- gnome_cmd_file_selector_set_directory (fs, new_dir);
+ fs->set_directory(new_dir);
// focus the current dir when going back to the parent dir
if (focus_dir)
@@ -768,7 +799,7 @@
if (strcmp (f->info->name, "..") == 0)
goto_directory (fs, "..");
else
- gnome_cmd_file_selector_set_directory (fs, GNOME_CMD_DIR (f));
+ fs->set_directory (GNOME_CMD_DIR (f));
}
}
@@ -891,7 +922,7 @@
g_return_if_fail (GNOME_CMD_IS_CON (con));
gnome_cmd_main_win_switch_fs (main_win, fs);
- gnome_cmd_file_selector_set_connection (fs, con);
+ fs->set_connection(con);
}
@@ -913,7 +944,7 @@
g_return_if_fail (GNOME_CMD_IS_CON (con));
gnome_cmd_main_win_switch_fs (main_win, fs);
- gnome_cmd_file_selector_set_connection (fs, con);
+ fs->set_connection(con);
}
@@ -1068,7 +1099,7 @@
fs->priv->connected_dir = dir;
}
- con = gnome_cmd_file_selector_get_connection (fs);
+ con = fs->get_connection();
gnome_cmd_con_set_cwd (con, dir);
if (fs->priv->dir_history && !fs->priv->dir_history->is_locked)
@@ -1108,7 +1139,8 @@
static gboolean set_home_connection (GnomeCmdFileSelector *fs)
{
g_printerr ("Setting home connection\n");
- gnome_cmd_file_selector_set_connection (fs, get_home_con ());
+ fs->set_connection(get_home_con ());
+
return FALSE;
}
@@ -1208,8 +1240,7 @@
{
GnomeCmdFileSelector *fs = GNOME_CMD_FILE_SELECTOR (object);
- gnome_cmd_dir_unref (fs->priv->cwd);
- g_free (fs->priv);
+ delete fs->priv;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -1250,21 +1281,7 @@
GtkVBox *vbox;
GtkWidget *padding;
- fs->priv = g_new0 (GnomeCmdFileSelectorPrivate, 1);
-
- fs->priv->realized = FALSE;
- fs->priv->cwd = NULL;
- fs->priv->lwd = NULL;
- fs->priv->connected_dir = NULL;
- fs->priv->old_btns = NULL;
- fs->priv->sel_first_file = TRUE;
- fs->priv->dir_history = NULL;
- fs->priv->active = FALSE;
- fs->priv->sym_file = NULL;
- fs->priv->con = NULL;
- fs->priv->con_open_dialog = NULL;
- fs->priv->con_open_dialog_label = NULL;
- fs->priv->con_opening = NULL;
+ fs->priv = new GnomeCmdFileSelector::Private;
vbox = GTK_VBOX (fs);
@@ -1430,24 +1447,20 @@
}
-GnomeCmdDir *gnome_cmd_file_selector_get_directory (GnomeCmdFileSelector *fs)
+GnomeCmdDir *GnomeCmdFileSelector::get_directory()
{
- g_return_val_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs), NULL);
-
- return fs->priv->cwd;
+ return priv->cwd;
}
-void gnome_cmd_file_selector_reload (GnomeCmdFileSelector *fs)
+void GnomeCmdFileSelector::reload()
{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-
- gnome_cmd_file_list_unselect_all (fs->list);
+ gnome_cmd_file_list_unselect_all (list);
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
+ GnomeCmdDir *dir = get_directory();
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
- gnome_cmd_dir_relist_files (dir, gnome_cmd_con_needs_list_visprog (fs->priv->con));
+ gnome_cmd_dir_relist_files (dir, gnome_cmd_con_needs_list_visprog (priv->con));
}
@@ -1471,112 +1484,95 @@
}
-void gnome_cmd_file_selector_first (GnomeCmdFileSelector *fs)
+void GnomeCmdFileSelector::first()
{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-
- if (!fs->priv->dir_history || !fs->priv->dir_history->can_back())
+ if (!priv->dir_history->can_back())
return;
- fs->priv->dir_history->lock();
- goto_directory (fs, fs->priv->dir_history->first());
- fs->priv->dir_history->unlock();
+ priv->dir_history->lock();
+ goto_directory (this, priv->dir_history->first());
+ priv->dir_history->unlock();
}
-void gnome_cmd_file_selector_back (GnomeCmdFileSelector *fs)
+void GnomeCmdFileSelector::back()
{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-
- if (!fs->priv->dir_history || !fs->priv->dir_history->can_back())
+ if (!priv->dir_history->can_back())
return;
- fs->priv->dir_history->lock();
- goto_directory (fs, fs->priv->dir_history->back());
- fs->priv->dir_history->unlock();
+ priv->dir_history->lock();
+ goto_directory (this, priv->dir_history->back());
+ priv->dir_history->unlock();
}
-void gnome_cmd_file_selector_forward (GnomeCmdFileSelector *fs)
+void GnomeCmdFileSelector::forward()
{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-
- if (!fs->priv->dir_history || !fs->priv->dir_history->can_forward())
+ if (!priv->dir_history->can_forward())
return;
- fs->priv->dir_history->lock();
- goto_directory (fs, fs->priv->dir_history->forward());
- fs->priv->dir_history->unlock();
+ priv->dir_history->lock();
+ goto_directory (this, priv->dir_history->forward());
+ priv->dir_history->unlock();
}
-void gnome_cmd_file_selector_last (GnomeCmdFileSelector *fs)
+void GnomeCmdFileSelector::last()
{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-
- if (!fs->priv->dir_history || !fs->priv->dir_history->can_forward())
+ if (!priv->dir_history->can_forward())
return;
- fs->priv->dir_history->lock();
- goto_directory (fs, fs->priv->dir_history->last());
- fs->priv->dir_history->unlock();
+ priv->dir_history->lock();
+ goto_directory (this, priv->dir_history->last());
+ priv->dir_history->unlock();
}
-gboolean gnome_cmd_file_selector_can_back (GnomeCmdFileSelector *fs)
+gboolean GnomeCmdFileSelector::can_back()
{
- g_return_val_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs), FALSE);
-
- if (!fs->priv->dir_history) return FALSE;
-
- return fs->priv->dir_history->can_back();
+ return priv->dir_history && priv->dir_history->can_back();
}
-gboolean gnome_cmd_file_selector_can_forward (GnomeCmdFileSelector *fs)
+gboolean GnomeCmdFileSelector::can_forward()
{
- g_return_val_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs), FALSE);
-
- if (!fs->priv->dir_history) return FALSE;
-
- return fs->priv->dir_history->can_forward();
+ return priv->dir_history && priv->dir_history->can_forward();
}
-void gnome_cmd_file_selector_set_directory (GnomeCmdFileSelector *fs, GnomeCmdDir *dir)
+void GnomeCmdFileSelector::set_directory(GnomeCmdDir *dir)
{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
- if (fs->priv->cwd == dir)
+ if (priv->cwd == dir)
return;
gnome_cmd_dir_ref (dir);
- if (fs->priv->lwd && fs->priv->lwd != dir)
- gnome_cmd_dir_unref (fs->priv->lwd);
+ if (priv->lwd && priv->lwd != dir)
+ gnome_cmd_dir_unref (priv->lwd);
- if (fs->priv->cwd)
+ if (priv->cwd)
{
- gnome_cmd_dir_cancel_monitoring (fs->priv->cwd);
- fs->priv->lwd = fs->priv->cwd;
- gtk_signal_disconnect_by_data (GTK_OBJECT (fs->priv->lwd), fs);
- fs->priv->connected_dir = NULL;
- fs->priv->lwd->voffset = gnome_cmd_clist_get_voffset (GNOME_CMD_CLIST (fs->list));
+ gnome_cmd_dir_cancel_monitoring (priv->cwd);
+ priv->lwd = priv->cwd;
+ gtk_signal_disconnect_by_data (GTK_OBJECT (priv->lwd), this);
+ priv->connected_dir = NULL;
+ priv->lwd->voffset = gnome_cmd_clist_get_voffset (GNOME_CMD_CLIST (list));
}
- fs->priv->cwd = dir;
+ priv->cwd = dir;
- if (fs->priv->realized)
+ if (priv->realized)
{
- gtk_widget_set_sensitive (GTK_WIDGET (fs), FALSE);
- set_cursor_busy_for_widget (GTK_WIDGET (fs));
+ gtk_widget_set_sensitive (GTK_WIDGET (this), FALSE);
+ set_cursor_busy_for_widget (GTK_WIDGET (this));
}
- gtk_signal_connect (GTK_OBJECT (dir), "list-ok", GTK_SIGNAL_FUNC (on_dir_list_ok), fs);
- gtk_signal_connect (GTK_OBJECT (dir), "list-failed", GTK_SIGNAL_FUNC (on_dir_list_failed), fs);
+ gtk_signal_connect (GTK_OBJECT (dir), "list-ok", GTK_SIGNAL_FUNC (on_dir_list_ok), this);
+ gtk_signal_connect (GTK_OBJECT (dir), "list-failed", GTK_SIGNAL_FUNC (on_dir_list_failed), this);
- gnome_cmd_dir_list_files (dir, gnome_cmd_con_needs_list_visprog (fs->priv->con));
+ gnome_cmd_dir_list_files (dir, gnome_cmd_con_needs_list_visprog (priv->con));
gnome_cmd_dir_start_monitoring (dir);
}
@@ -1587,21 +1583,19 @@
}
-void gnome_cmd_file_selector_set_active (GnomeCmdFileSelector *fs, gboolean value)
+void GnomeCmdFileSelector::set_active(gboolean value)
{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-
- fs->priv->active = value;
+ priv->active = value;
if (value)
{
- gtk_widget_grab_focus (fs->list_widget);
- gnome_cmd_file_list_select_row (fs->list, GTK_CLIST (fs->list)->focus_row);
+ gtk_widget_grab_focus (list_widget);
+ gnome_cmd_file_list_select_row (list, GTK_CLIST (list)->focus_row);
}
else
- gtk_clist_unselect_all (GTK_CLIST (fs->list));
+ gtk_clist_unselect_all (GTK_CLIST (list));
- gnome_cmd_dir_indicator_set_active (GNOME_CMD_DIR_INDICATOR (fs->dir_indicator), value);
+ gnome_cmd_dir_indicator_set_active (GNOME_CMD_DIR_INDICATOR (dir_indicator), value);
}
@@ -1711,34 +1705,6 @@
}
-void gnome_cmd_file_selector_set_connection (GnomeCmdFileSelector *fs, GnomeCmdCon *con, GnomeCmdDir *start_dir)
-{
- g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
- g_return_if_fail (GNOME_CMD_IS_CON (con));
-
- if (fs->priv->con == con)
- {
- if (!gnome_cmd_con_should_remember_dir (con))
- gnome_cmd_file_selector_set_directory (fs, gnome_cmd_con_get_default_dir (con));
- return;
- }
-
- if (!gnome_cmd_con_is_open (con))
- {
- gtk_signal_connect (GTK_OBJECT (con), "open-done", GTK_SIGNAL_FUNC (on_con_open_done), fs);
- gtk_signal_connect (GTK_OBJECT (con), "open-failed", GTK_SIGNAL_FUNC (on_con_open_failed), fs);
- fs->priv->con_opening = con;
-
- create_con_open_progress_dialog (fs);
- g_timeout_add (gnome_cmd_data_get_gui_update_rate (), (GSourceFunc) update_con_open_progress, fs);
-
- gnome_cmd_con_open (con);
- }
- else
- set_connection (fs, con, start_dir);
-}
-
-
void gnome_cmd_file_selector_set_directory_to_opposite (GnomeCmdMainWin *mw, FileSelectorID fsID)
{
g_return_if_fail (mw!=NULL);
@@ -1746,7 +1712,7 @@
GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (mw, fsID);
GnomeCmdFileSelector *other = gnome_cmd_main_win_get_fs (mw, !fsID);
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (other);
+ GnomeCmdDir *dir = other->get_directory();
gboolean fs_is_active = fs->priv->active;
if (!fs_is_active)
@@ -1759,8 +1725,8 @@
set_connection (fs, other->priv->con, dir);
- gnome_cmd_file_selector_set_active (other, !fs_is_active);
- gnome_cmd_file_selector_set_active (fs, fs_is_active);
+ other->set_active(!fs_is_active);
+ fs->set_active(fs_is_active);
}
@@ -1808,7 +1774,7 @@
// If the connection is no longer available use the home connection
if (!found_my_con)
- gnome_cmd_file_selector_set_connection (fs, get_home_con ());
+ fs->set_connection(get_home_con ());
else
gnome_cmd_combo_select_data (GNOME_CMD_COMBO (fs->con_combo), fs->priv->con);
@@ -1816,19 +1782,45 @@
}
-GnomeCmdCon *gnome_cmd_file_selector_get_connection (GnomeCmdFileSelector *fs)
+GnomeCmdCon *GnomeCmdFileSelector::get_connection()
+{
+ return priv->con;
+}
+
+
+void GnomeCmdFileSelector::set_connection (GnomeCmdCon *con, GnomeCmdDir *start_dir)
{
- g_return_val_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs), NULL);
+ g_return_if_fail (GNOME_CMD_IS_CON (con));
- return fs->priv->con;
+ if (priv->con == con)
+ {
+ if (!gnome_cmd_con_should_remember_dir (con))
+ set_directory (gnome_cmd_con_get_default_dir (con));
+ return;
+ }
+
+ if (!gnome_cmd_con_is_open (con))
+ {
+ gtk_signal_connect (GTK_OBJECT (con), "open-done", GTK_SIGNAL_FUNC (on_con_open_done), this);
+ gtk_signal_connect (GTK_OBJECT (con), "open-failed", GTK_SIGNAL_FUNC (on_con_open_failed), this);
+ priv->con_opening = con;
+
+ create_con_open_progress_dialog (this);
+ g_timeout_add (gnome_cmd_data_get_gui_update_rate (), (GSourceFunc) update_con_open_progress, this);
+
+ gnome_cmd_con_open (con);
+ }
+ else
+ ::set_connection (this, con, start_dir);
}
gboolean gnome_cmd_file_selector_is_local (FileSelectorID fsID)
{
- return gnome_cmd_file_selector_is_local (gnome_cmd_main_win_get_fs (main_win, fsID));
+ return gnome_cmd_main_win_get_fs (main_win, fsID)->is_local();
}
+
void gnome_cmd_file_selector_update_style (GnomeCmdFileSelector *fs)
{
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
@@ -1846,7 +1838,7 @@
void gnome_cmd_file_selector_show_mkdir_dialog (GnomeCmdFileSelector *fs)
{
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
+ GnomeCmdDir *dir = fs->get_directory();
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
GtkWidget *dialog = gnome_cmd_mkdir_dialog_new (dir);
@@ -1871,7 +1863,7 @@
return FALSE;
}
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
+ GnomeCmdDir *dir = fs->get_directory();
g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), TRUE);
gchar *dpath = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (dir));
@@ -1945,7 +1937,7 @@
{
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (fs);
+ GnomeCmdDir *dir = fs->get_directory();
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
cap_paste_files (dir);
@@ -1987,12 +1979,12 @@
return TRUE;
case GDK_Left:
- gnome_cmd_file_selector_back (fs);
+ fs->back();
stop_kp(GTK_OBJECT(fs->list));
return TRUE;
case GDK_Right:
- gnome_cmd_file_selector_forward (fs);
+ fs->forward();
stop_kp(GTK_OBJECT(fs->list));
return TRUE;
}
Modified: branches/gcmd-1-3/src/gnome-cmd-file-selector.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-selector.h (original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-selector.h Thu Aug 14 18:36:13 2008
@@ -20,18 +20,9 @@
#ifndef __GNOME_CMD_FILE_SELECTOR_H__
#define __GNOME_CMD_FILE_SELECTOR_H__
-#define GNOME_CMD_FILE_SELECTOR(obj) \
- GTK_CHECK_CAST (obj, gnome_cmd_file_selector_get_type (), GnomeCmdFileSelector)
-#define GNOME_CMD_FILE_SELECTOR_CLASS(klass) \
- GTK_CHECK_CLASS_CAST (klass, gnome_cmd_file_selector_get_type (), GnomeCmdFileSelectorClass)
-#define GNOME_CMD_IS_FILE_SELECTOR(obj) \
- GTK_CHECK_TYPE (obj, gnome_cmd_file_selector_get_type ())
-
-#define DIR_HISTORY_SIZE 20
-
-typedef struct _GnomeCmdFileSelector GnomeCmdFileSelector;
-typedef struct _GnomeCmdFileSelectorPrivate GnomeCmdFileSelectorPrivate;
-typedef struct _GnomeCmdFileSelectorClass GnomeCmdFileSelectorClass;
+#define GNOME_CMD_FILE_SELECTOR(obj) GTK_CHECK_CAST (obj, gnome_cmd_file_selector_get_type (), GnomeCmdFileSelector)
+#define GNOME_CMD_FILE_SELECTOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gnome_cmd_file_selector_get_type (), GnomeCmdFileSelectorClass)
+#define GNOME_CMD_IS_FILE_SELECTOR(obj) GTK_CHECK_TYPE (obj, gnome_cmd_file_selector_get_type ())
typedef struct _GnomeCmdMainWin GnomeCmdMainWin;
@@ -39,7 +30,17 @@
#include "gnome-cmd-con.h"
#include "gnome-cmd-dir.h"
-struct _GnomeCmdFileSelector
+
+typedef enum
+{
+ LEFT,
+ RIGHT,
+ ACTIVE,
+ INACTIVE
+} FileSelectorID;
+
+
+struct GnomeCmdFileSelector
{
GtkVBox vbox;
@@ -55,11 +56,33 @@
GtkWidget *con_combo;
GtkWidget *vol_label;
- GnomeCmdFileSelectorPrivate *priv;
+ class Private;
+
+ Private *priv;
+
+ GnomeCmdDir *get_directory();
+ void set_directory(GnomeCmdDir *dir);
+
+ void reload();
+
+ void first();
+ void back();
+ void forward();
+ void last();
+
+ gboolean can_back();
+ gboolean can_forward();
+
+ void set_active(gboolean value);
+
+ GnomeCmdCon *get_connection();
+ void set_connection(GnomeCmdCon *con, GnomeCmdDir *start_dir=NULL);
+
+ gboolean is_local() { return gnome_cmd_con_is_local (get_connection ()); }
};
-struct _GnomeCmdFileSelectorClass
+struct GnomeCmdFileSelectorClass
{
GtkVBoxClass parent_class;
@@ -67,49 +90,17 @@
};
-typedef enum
-{
- LEFT,
- RIGHT,
- ACTIVE,
- INACTIVE
-} FileSelectorID;
-
-
GtkType gnome_cmd_file_selector_get_type (void);
GtkWidget *gnome_cmd_file_selector_new (void);
-GnomeCmdDir *gnome_cmd_file_selector_get_directory (GnomeCmdFileSelector *fs);
-void gnome_cmd_file_selector_set_directory (GnomeCmdFileSelector *fs, GnomeCmdDir *dir);
-
void gnome_cmd_file_selector_set_directory_to_opposite (GnomeCmdMainWin *mw, FileSelectorID fsID);
void gnome_cmd_file_selector_goto_directory (GnomeCmdFileSelector *fs, const gchar *dir);
-void gnome_cmd_file_selector_reload (GnomeCmdFileSelector *fs);
-
void gnome_cmd_file_selector_start_editor (GnomeCmdFileSelector *fs);
-void gnome_cmd_file_selector_first (GnomeCmdFileSelector *fs);
-void gnome_cmd_file_selector_back (GnomeCmdFileSelector *fs);
-void gnome_cmd_file_selector_forward (GnomeCmdFileSelector *fs);
-void gnome_cmd_file_selector_last (GnomeCmdFileSelector *fs);
-
-gboolean gnome_cmd_file_selector_can_back (GnomeCmdFileSelector *fs);
-gboolean gnome_cmd_file_selector_can_forward (GnomeCmdFileSelector *fs);
-
-void gnome_cmd_file_selector_set_active (GnomeCmdFileSelector *fs, gboolean value);
-
void gnome_cmd_file_selector_update_connections (GnomeCmdFileSelector *fs);
-GnomeCmdCon *gnome_cmd_file_selector_get_connection (GnomeCmdFileSelector *fs);
-void gnome_cmd_file_selector_set_connection (GnomeCmdFileSelector *fs, GnomeCmdCon *con, GnomeCmdDir *start_dir=NULL);
-
-inline gboolean gnome_cmd_file_selector_is_local (GnomeCmdFileSelector *fs)
-{
- return gnome_cmd_con_is_local (gnome_cmd_file_selector_get_connection (fs));
-}
-
gboolean gnome_cmd_file_selector_is_local (FileSelectorID fsID);
void gnome_cmd_file_selector_update_style (GnomeCmdFileSelector *fs);
Modified: branches/gcmd-1-3/src/gnome-cmd-list-popmenu.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-list-popmenu.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-list-popmenu.cc Thu Aug 14 18:36:13 2008
@@ -52,7 +52,7 @@
static void on_refresh (GtkMenuItem *item, GnomeCmdFileSelector *fs)
{
- gnome_cmd_file_selector_reload (fs);
+ fs->reload();
}
Modified: branches/gcmd-1-3/src/gnome-cmd-main-menu.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-main-menu.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-main-menu.cc Thu Aug 14 18:36:13 2008
@@ -989,8 +989,8 @@
GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
- gtk_widget_set_sensitive (main_menu->priv->menu_view_back, gnome_cmd_file_selector_can_back (fs));
- gtk_widget_set_sensitive (main_menu->priv->menu_view_forward, gnome_cmd_file_selector_can_forward (fs));
+ 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());
}
Modified: branches/gcmd-1-3/src/gnome-cmd-main-win.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-main-win.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-main-win.cc Thu Aug 14 18:36:13 2008
@@ -471,13 +471,12 @@
gdk_window_get_geometry (widget->window, NULL, NULL, &w, NULL, NULL);
gtk_paned_set_position (GTK_PANED (mw->priv->paned), w/2 - 5);
- gnome_cmd_file_selector_set_active (gnome_cmd_main_win_get_fs (mw, LEFT), TRUE);
- gnome_cmd_file_selector_set_active (gnome_cmd_main_win_get_fs (mw, RIGHT), FALSE);
+ 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_get_cmdline_visibility ())
{
- gchar *dpath = gnome_cmd_file_get_path (
- GNOME_CMD_FILE (gnome_cmd_file_selector_get_directory (gnome_cmd_main_win_get_fs (mw, LEFT))));
+ gchar *dpath = gnome_cmd_file_get_path (GNOME_CMD_FILE (gnome_cmd_main_win_get_fs (mw, LEFT)->get_directory()));
gnome_cmd_cmdline_set_dir (GNOME_CMD_CMDLINE (mw->priv->cmdline), dpath);
g_free (dpath);
}
@@ -490,12 +489,12 @@
static gboolean on_left_fs_select (GtkCList *list, GdkEventButton *event, GnomeCmdMainWin *mw)
{
- mw->priv->current_fs = LEFT;
+ mw->priv->current_fs = LEFT;
- gnome_cmd_file_selector_set_active (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[LEFT]), TRUE);
- gnome_cmd_file_selector_set_active (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[RIGHT]), FALSE);
+ GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[LEFT])->set_active(TRUE);
+ GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[RIGHT])->set_active(FALSE);
- return FALSE;
+ return FALSE;
}
@@ -503,8 +502,8 @@
{
mw->priv->current_fs = RIGHT;
- gnome_cmd_file_selector_set_active (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[RIGHT]), TRUE);
- gnome_cmd_file_selector_set_active (GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[LEFT]), FALSE);
+ GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[RIGHT])->set_active(TRUE);
+ GNOME_CMD_FILE_SELECTOR (mw->priv->file_selector[LEFT])->set_active(FALSE);
return FALSE;
}
@@ -550,10 +549,10 @@
{
if (gnome_cmd_data_get_toolbar_visibility ())
{
- gtk_widget_set_sensitive (mw->priv->tb_first_btn, gnome_cmd_file_selector_can_back (fs));
- gtk_widget_set_sensitive (mw->priv->tb_back_btn, gnome_cmd_file_selector_can_back (fs));
- gtk_widget_set_sensitive (mw->priv->tb_fwd_btn, gnome_cmd_file_selector_can_forward (fs));
- gtk_widget_set_sensitive (mw->priv->tb_last_btn, gnome_cmd_file_selector_can_forward (fs));
+ gtk_widget_set_sensitive (mw->priv->tb_first_btn, fs->can_back());
+ gtk_widget_set_sensitive (mw->priv->tb_back_btn, fs->can_back());
+ gtk_widget_set_sensitive (mw->priv->tb_fwd_btn, fs->can_forward());
+ gtk_widget_set_sensitive (mw->priv->tb_last_btn, fs->can_forward());
}
gnome_cmd_main_menu_update_sens (GNOME_CMD_MAIN_MENU (mw->priv->menubar));
@@ -569,7 +568,7 @@
GnomeCmdPixmap *pm = NULL;
static GtkWidget *prev_pixmap = NULL;
- GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (fs);
+ GnomeCmdCon *con = fs->get_connection();
if (!con)
return;
@@ -700,11 +699,11 @@
main_win->priv->key_snooper_id = 0;
}
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (gnome_cmd_main_win_get_fs (main_win, LEFT));
+ GnomeCmdDir *dir = gnome_cmd_main_win_get_fs (main_win, 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_file_selector_get_directory (gnome_cmd_main_win_get_fs (main_win, RIGHT));
+ dir = gnome_cmd_main_win_get_fs (main_win, 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)));
@@ -835,8 +834,8 @@
gnome_cmd_file_selector_update_connections (gnome_cmd_main_win_get_fs (mw, LEFT));
gnome_cmd_file_selector_update_connections (gnome_cmd_main_win_get_fs (mw, RIGHT));
- gnome_cmd_file_selector_set_connection (gnome_cmd_main_win_get_fs (mw, LEFT), get_home_con ());
- gnome_cmd_file_selector_set_connection (gnome_cmd_main_win_get_fs (mw, RIGHT), get_home_con ());
+ 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 ());
gnome_cmd_file_selector_goto_directory (gnome_cmd_main_win_get_fs (mw, LEFT),
start_dir_left ? start_dir_left : gnome_cmd_data_get_start_dir (LEFT));
@@ -935,8 +934,8 @@
void gnome_cmd_main_win_focus_file_lists (GnomeCmdMainWin *mw)
{
- gnome_cmd_file_selector_set_active (gnome_cmd_main_win_get_fs (mw, ACTIVE), TRUE);
- gnome_cmd_file_selector_set_active (gnome_cmd_main_win_get_fs (mw, INACTIVE), FALSE);
+ gnome_cmd_main_win_get_fs (mw, ACTIVE)->set_active(TRUE);
+ gnome_cmd_main_win_get_fs (mw, INACTIVE)->set_active(FALSE);
mw->priv->focused_widget = mw->priv->file_selector[mw->priv->current_fs];
}
@@ -1002,14 +1001,14 @@
case GDK_u:
case GDK_U:
{
- GnomeCmdDir *dir1 = gnome_cmd_file_selector_get_directory (gnome_cmd_main_win_get_fs (mw, LEFT));
- GnomeCmdDir *dir2 = gnome_cmd_file_selector_get_directory (gnome_cmd_main_win_get_fs (mw, RIGHT));
+ GnomeCmdDir *dir1 = gnome_cmd_main_win_get_fs (mw, LEFT)->get_directory();
+ GnomeCmdDir *dir2 = gnome_cmd_main_win_get_fs (mw, RIGHT)->get_directory();
gnome_cmd_dir_ref (dir1);
gnome_cmd_dir_ref (dir2);
- gnome_cmd_file_selector_set_directory (gnome_cmd_main_win_get_fs (mw, LEFT), dir2);
- gnome_cmd_file_selector_set_directory (gnome_cmd_main_win_get_fs (mw, RIGHT), dir1);
+ gnome_cmd_main_win_get_fs (mw, LEFT)->set_directory(dir2);
+ gnome_cmd_main_win_get_fs (mw, RIGHT)->set_directory(dir1);
gnome_cmd_dir_unref (dir1);
gnome_cmd_dir_unref (dir2);
@@ -1038,7 +1037,7 @@
{
GnomeCmdConFtp *con = GNOME_CMD_CON_FTP (gnome_cmd_con_list_get_all_ftp (gnome_cmd_con_list_get ())->data);
- gnome_cmd_file_selector_set_connection (gnome_cmd_main_win_get_fs (main_win, ACTIVE), GNOME_CMD_CON (con));
+ gnome_cmd_main_win_get_fs (main_win, ACTIVE)->set_connection(GNOME_CMD_CON (con));
}
break;
}
@@ -1124,8 +1123,8 @@
return;
mw->priv->current_fs = (FileSelectorID) !mw->priv->current_fs;
- gnome_cmd_file_selector_set_active (gnome_cmd_main_win_get_fs (mw, ACTIVE), TRUE);
- gnome_cmd_file_selector_set_active (gnome_cmd_main_win_get_fs (mw, INACTIVE), FALSE);
+ gnome_cmd_main_win_get_fs (mw, ACTIVE)->set_active(TRUE);
+ gnome_cmd_main_win_get_fs (mw, INACTIVE)->set_active(FALSE);
update_browse_buttons (mw, fs);
update_drop_con_button (mw, fs);
@@ -1312,8 +1311,8 @@
GnomeCmdFileSelector *fs1 = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
GnomeCmdFileSelector *fs2 = gnome_cmd_main_win_get_fs (main_win, INACTIVE);
- GnomeCmdDir *dir1 = gnome_cmd_file_selector_get_directory (fs1);
- GnomeCmdDir *dir2 = gnome_cmd_file_selector_get_directory (fs2);
+ GnomeCmdDir *dir1 = fs1->get_directory();
+ GnomeCmdDir *dir2 = fs2->get_directory();
GnomeCmdState *state = &mw->priv->state;
state->active_dir_uri = gnome_cmd_file_get_uri (GNOME_CMD_FILE (dir1));
Modified: branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-prepare-xfer-dialog.cc Thu Aug 14 18:36:13 2008
@@ -37,7 +37,7 @@
inline gboolean con_device_has_path (FileSelectorID fsID, GnomeCmdCon *&dev, const gchar *user_path)
{
- dev = gnome_cmd_file_selector_get_connection (gnome_cmd_main_win_get_fs (main_win, fsID));
+ dev = gnome_cmd_main_win_get_fs (main_win, 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)));
@@ -87,7 +87,7 @@
}
else
{
- gchar *t = gnome_cmd_file_get_path (GNOME_CMD_FILE (gnome_cmd_file_selector_get_directory (dialog->src_fs)));
+ gchar *t = gnome_cmd_file_get_path (GNOME_CMD_FILE (dialog->src_fs->get_directory()));
dest_path = g_build_path (G_DIR_SEPARATOR_S, t, user_path, NULL);
g_free (t);
}
@@ -366,8 +366,7 @@
{
GnomeVFSFileType type;
- GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (to);
- GnomeVFSResult res = gnome_cmd_con_get_path_target_type (con, dest_path, &type);
+ GnomeVFSResult res = gnome_cmd_con_get_path_target_type (to->get_connection(), dest_path, &type);
return res == GNOME_VFS_OK && type == GNOME_VFS_FILE_TYPE_DIRECTORY;
}
@@ -383,12 +382,12 @@
dialog->src_files = gnome_cmd_file_list_get_selected_files (from->list);
gnome_cmd_file_list_ref (dialog->src_files);
- dialog->default_dest_dir = gnome_cmd_file_selector_get_directory (to);
+ dialog->default_dest_dir = to->get_directory();
dialog->src_fs = from;
guint num_files = g_list_length (dialog->src_files);
- if (!gnome_cmd_file_selector_is_local (to))
+ if (!to->is_local())
{
if (num_files == 1)
{
Modified: branches/gcmd-1-3/src/gnome-cmd-python-plugin.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-python-plugin.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-python-plugin.cc Thu Aug 14 18:36:13 2008
@@ -178,7 +178,7 @@
if (!fs)
return NULL;
- GnomeVFSURI *dir_uri = gnome_cmd_dir_get_uri (gnome_cmd_file_selector_get_directory (fs));
+ GnomeVFSURI *dir_uri = gnome_cmd_dir_get_uri (fs->get_directory());
if (!dir_uri)
return NULL;
Modified: branches/gcmd-1-3/src/gnome-cmd-remote-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-remote-dialog.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-remote-dialog.cc Thu Aug 14 18:36:13 2008
@@ -114,7 +114,7 @@
GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
GnomeCmdCon *con = GNOME_CMD_CON (server);
- gnome_cmd_file_selector_set_connection (fs, con);
+ fs->set_connection(con);
// gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, G_DIR_SEPARATOR_S)));
return FALSE;
Modified: branches/gcmd-1-3/src/gnome-cmd-user-actions.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-user-actions.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-user-actions.cc Thu Aug 14 18:36:13 2008
@@ -704,7 +704,7 @@
gchar *msg = g_strdup_printf (ngettext("Create symbolic links of %i file in %s?",
"Create symbolic links of %i files in %s?",
selected_files),
- selected_files, gnome_cmd_dir_get_display_path (gnome_cmd_file_selector_get_directory(inactive_fs)));
+ selected_files, gnome_cmd_dir_get_display_path (inactive_fs->get_directory()));
gint choice = run_simple_dialog (GTK_WIDGET (main_win), TRUE, GTK_MESSAGE_QUESTION, msg, _("Create Symbolic Link"), 1, _("Cancel"), _("Create"), NULL);
@@ -747,7 +747,7 @@
void file_diff (GtkMenuItem *menuitem, gpointer not_used)
{
- if (!gnome_cmd_file_selector_is_local (get_fs (ACTIVE)))
+ if (!get_fs (ACTIVE)->is_local())
{
create_error_dialog (_("Operation not supported on remote file systems"));
return;
@@ -765,7 +765,7 @@
return;
case 1:
- if (!gnome_cmd_file_selector_is_local (get_fs (INACTIVE)))
+ if (!get_fs (INACTIVE)->is_local())
create_error_dialog (_("Operation not supported on remote file systems"));
else
if (!append_real_path (s, get_selected_file (ACTIVE)) || !append_real_path (s, get_selected_file (INACTIVE)))
@@ -804,14 +804,14 @@
GnomeCmdFileSelector *active_fs = get_fs (ACTIVE);
GnomeCmdFileSelector *inactive_fs = get_fs (INACTIVE);
- if (!gnome_cmd_file_selector_is_local (active_fs) || !gnome_cmd_file_selector_is_local (inactive_fs))
+ if (!active_fs->is_local() || !inactive_fs->is_local())
{
create_error_dialog (_("Operation not supported on remote file systems"));
return;
}
- GnomeVFSURI *active_dir_uri = gnome_cmd_dir_get_uri (gnome_cmd_file_selector_get_directory (active_fs));
- GnomeVFSURI *inactive_dir_uri = gnome_cmd_dir_get_uri (gnome_cmd_file_selector_get_directory (inactive_fs));
+ GnomeVFSURI *active_dir_uri = gnome_cmd_dir_get_uri (active_fs->get_directory());
+ GnomeVFSURI *inactive_dir_uri = gnome_cmd_dir_get_uri (inactive_fs->get_directory());
gchar *active_dir = gnome_vfs_unescape_string (gnome_vfs_uri_get_path (active_dir_uri), NULL);
gchar *inactive_dir = gnome_vfs_unescape_string (gnome_vfs_uri_get_path (inactive_dir_uri), NULL);
@@ -878,7 +878,7 @@
void edit_search (GtkMenuItem *menuitem, gpointer not_used)
{
GnomeCmdFileSelector *fs = get_fs (ACTIVE);
- GtkWidget *dialog = gnome_cmd_search_dialog_new (gnome_cmd_file_selector_get_directory (fs));
+ GtkWidget *dialog = gnome_cmd_search_dialog_new (fs->get_directory());
gtk_widget_ref (dialog);
gtk_widget_show (dialog);
}
@@ -953,7 +953,7 @@
g_list_free (sfl);
- GnomeCmdDir *dir = gnome_cmd_file_selector_get_directory (get_fs (ACTIVE));
+ GnomeCmdDir *dir = get_fs (ACTIVE)->get_directory();
stringify (dir_path, gnome_cmd_file_get_real_path (GNOME_CMD_FILE (dir)));
stringify (quoted_dir_path, gnome_cmd_file_get_quoted_real_path (GNOME_CMD_FILE (dir)));
@@ -1026,7 +1026,7 @@
void command_open_terminal (GtkMenuItem *menuitem, gpointer not_used)
{
- gchar *dpath = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (gnome_cmd_file_selector_get_directory (get_fs (ACTIVE))));
+ gchar *dpath = gnome_cmd_file_get_real_path (GNOME_CMD_FILE (get_fs (ACTIVE)->get_directory()));
gnome_execute_terminal_shell (dpath, NULL);
g_free (dpath);
@@ -1059,13 +1059,13 @@
{
GnomeCmdFile *f = gnome_cmd_file_list_get_selected_file (get_fl (ACTIVE));
- open_uri_in_nautilus (gnome_cmd_file_get_uri_str (GNOME_CMD_IS_DIR (f) ? f : GNOME_CMD_FILE (gnome_cmd_file_selector_get_directory (get_fs (ACTIVE)))));
+ open_uri_in_nautilus (gnome_cmd_file_get_uri_str (GNOME_CMD_IS_DIR (f) ? f : GNOME_CMD_FILE (get_fs (ACTIVE)->get_directory())));
}
void command_open_nautilus_in_cwd (GtkMenuItem *menuitem, gpointer not_used)
{
- open_uri_in_nautilus (gnome_cmd_file_get_uri_str (GNOME_CMD_FILE (gnome_cmd_file_selector_get_directory (get_fs (ACTIVE)))));
+ open_uri_in_nautilus (gnome_cmd_file_get_uri_str (GNOME_CMD_FILE (get_fs (ACTIVE)->get_directory())));
}
@@ -1216,8 +1216,8 @@
GtkCheckMenuItem *checkitem = (GtkCheckMenuItem *) menuitem;
gnome_cmd_data_get_filter_settings()->hidden = !checkitem->active;
- gnome_cmd_file_selector_reload (get_fs (ACTIVE));
- gnome_cmd_file_selector_reload (get_fs (INACTIVE));
+ get_fs (ACTIVE)->reload();
+ get_fs (INACTIVE)->reload();
}
@@ -1227,8 +1227,8 @@
GtkCheckMenuItem *checkitem = (GtkCheckMenuItem *) menuitem;
gnome_cmd_data_get_filter_settings()->backup = !checkitem->active;
- gnome_cmd_file_selector_reload (get_fs (ACTIVE));
- gnome_cmd_file_selector_reload (get_fs (INACTIVE));
+ get_fs (ACTIVE)->reload();
+ get_fs (INACTIVE)->reload();
}
@@ -1240,31 +1240,31 @@
void view_first (GtkMenuItem *menuitem, gpointer not_used)
{
- gnome_cmd_file_selector_first (get_fs (ACTIVE));
+ get_fs (ACTIVE)->first();
}
void view_back (GtkMenuItem *menuitem, gpointer not_used)
{
- gnome_cmd_file_selector_back (get_fs (ACTIVE));
+ get_fs (ACTIVE)->back();
}
void view_forward (GtkMenuItem *menuitem, gpointer not_used)
{
- gnome_cmd_file_selector_forward (get_fs (ACTIVE));
+ get_fs (ACTIVE)->forward();
}
void view_last (GtkMenuItem *menuitem, gpointer not_used)
{
- gnome_cmd_file_selector_last (get_fs (ACTIVE));
+ get_fs (ACTIVE)->last();
}
void view_refresh (GtkMenuItem *menuitem, gpointer not_used)
{
- gnome_cmd_file_selector_reload (get_fs (ACTIVE));
+ get_fs (ACTIVE)->reload();
}
@@ -1300,7 +1300,7 @@
void view_home (GtkMenuItem *menuitem, gpointer not_used)
{
- gnome_cmd_file_selector_set_connection (get_fs (ACTIVE), get_home_con ());
+ get_fs (ACTIVE)->set_connection(get_home_con ());
gnome_cmd_file_selector_goto_directory (get_fs (ACTIVE), "~");
}
@@ -1350,7 +1350,7 @@
void connections_change (GtkMenuItem *menuitem, gpointer con) // this function is NOT exposed to user as UserAction
{
- gnome_cmd_file_selector_set_connection (get_fs (ACTIVE), (GnomeCmdCon *) con);
+ get_fs (ACTIVE)->set_connection((GnomeCmdCon *) con);
}
@@ -1359,14 +1359,12 @@
GnomeCmdFileSelector *active = get_fs (ACTIVE);
GnomeCmdFileSelector *inactive = get_fs (INACTIVE);
- GnomeCmdCon *c1 = gnome_cmd_file_selector_get_connection (active);
- GnomeCmdCon *c2 = gnome_cmd_file_selector_get_connection (inactive);
GnomeCmdCon *home = get_home_con ();
- if (con == c1)
- gnome_cmd_file_selector_set_connection (active, home);
- if (con == c2)
- gnome_cmd_file_selector_set_connection (inactive, home);
+ if (con == active->get_connection())
+ active->set_connection(home);
+ if (con == inactive->get_connection())
+ inactive->set_connection(home);
gnome_cmd_con_close ((GnomeCmdCon *) con);
}
@@ -1374,7 +1372,7 @@
void connections_close_current (GtkMenuItem *menuitem, gpointer not_used)
{
- GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (get_fs (ACTIVE));
+ GnomeCmdCon *con = get_fs (ACTIVE)->get_connection();
connections_close (menuitem, con);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]