[gnome-commander] tab lock: initial framework
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] tab lock: initial framework
- Date: Sat, 8 Jan 2011 18:50:49 +0000 (UTC)
commit bbcd941d929c63486ff5311f9f891def64aef351
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Sat Jan 8 19:50:09 2011 +0100
tab lock: initial framework
src/gnome-cmd-file-list.cc | 1 +
src/gnome-cmd-file-list.h | 2 ++
src/gnome-cmd-file-selector.cc | 18 ++++++++++++++++--
src/gnome-cmd-file-selector.h | 8 +++++---
src/gnome-cmd-main-win.cc | 4 ++--
5 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 13fe844..1c94d91 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -219,6 +219,7 @@ GnomeCmdFileList::GnomeCmdFileList(ColumnID sort_col, GtkSortType sort_order)
{
realized = FALSE;
modifier_click = FALSE;
+ locked = FALSE;
con = NULL;
cwd = NULL;
lwd = NULL;
diff --git a/src/gnome-cmd-file-list.h b/src/gnome-cmd-file-list.h
index 8198f96..1475c34 100644
--- a/src/gnome-cmd-file-list.h
+++ b/src/gnome-cmd-file-list.h
@@ -68,6 +68,8 @@ struct GnomeCmdFileList
gboolean realized;
gboolean modifier_click;
+ gboolean locked;
+
void *operator new (size_t size);
void operator delete (void *p) { g_object_unref (p); }
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index b8e9383..8acb161 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -517,7 +517,7 @@ static void on_list_dir_changed (GnomeCmdFileList *fl, GnomeCmdDir *dir, GnomeCm
if (fl->cwd != dir) return;
- fs->notebook->set_label(GNOME_CMD_FILE (fl->cwd)->get_name());
+ fs->update_tab_label(GNOME_CMD_FILE (dir)->get_name(), fl->locked);
fs->priv->sel_first_file = FALSE;
fs->update_files();
@@ -1332,7 +1332,7 @@ gboolean GnomeCmdFileSelector::is_active()
}
-GtkWidget *GnomeCmdFileSelector::new_tab(GnomeCmdDir *dir, GnomeCmdFileList::ColumnID sort_col, GtkSortType sort_order, gboolean activate)
+GtkWidget *GnomeCmdFileSelector::new_tab(GnomeCmdDir *dir, GnomeCmdFileList::ColumnID sort_col, GtkSortType sort_order, gboolean locked, gboolean activate)
{
// create the list
GnomeCmdFileList *list = new GnomeCmdFileList(sort_col,sort_order);
@@ -1340,6 +1340,7 @@ GtkWidget *GnomeCmdFileSelector::new_tab(GnomeCmdDir *dir, GnomeCmdFileList::Col
if (activate)
this->list = list; // ... update GnomeCmdFileSelector::list to point at newly created tab
+ list->locked = locked;
list->update_style();
// hide dir column
@@ -1383,6 +1384,19 @@ GtkWidget *GnomeCmdFileSelector::new_tab(GnomeCmdDir *dir, GnomeCmdFileList::Col
}
+void GnomeCmdFileSelector::update_tab_label(const gchar *name, gboolean locked)
+{
+ if (locked)
+ {
+ gchar *s = g_strconcat ("* ", name, NULL);
+ notebook->set_label(s);
+ g_free (s);
+ }
+ else
+ notebook->set_label(name);
+}
+
+
XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileSelector &fs)
{
if (gnome_cmd_data.save_tabs_on_exit)
diff --git a/src/gnome-cmd-file-selector.h b/src/gnome-cmd-file-selector.h
index 965098e..872c5c9 100644
--- a/src/gnome-cmd-file-selector.h
+++ b/src/gnome-cmd-file-selector.h
@@ -87,10 +87,12 @@ struct GnomeCmdFileSelector
GtkWidget *new_tab();
GtkWidget *new_tab(GnomeCmdDir *dir, gboolean activate=TRUE);
- GtkWidget *new_tab(GnomeCmdDir *dir, GnomeCmdFileList::ColumnID sort_col, GtkSortType sort_order, gboolean activate);
+ GtkWidget *new_tab(GnomeCmdDir *dir, GnomeCmdFileList::ColumnID sort_col, GtkSortType sort_order, gboolean locked, gboolean activate);
void close_tab() { if (notebook->size()>1) notebook->remove_page(); }
void close_tab(gint n) { if (notebook->size()>1) notebook->remove_page(n); }
+ void update_tab_label(const gchar *name, gboolean locked);
+
void show_filter();
void update_files();
void update_direntry();
@@ -120,12 +122,12 @@ inline void GnomeCmdFileSelector::set_connection(GnomeCmdCon *con, GnomeCmdDir *
inline GtkWidget *GnomeCmdFileSelector::new_tab()
{
- return new_tab(NULL, GnomeCmdFileList::COLUMN_NAME, GTK_SORT_ASCENDING, TRUE);
+ return new_tab(NULL, GnomeCmdFileList::COLUMN_NAME, GTK_SORT_ASCENDING, FALSE, TRUE);
}
inline GtkWidget *GnomeCmdFileSelector::new_tab(GnomeCmdDir *dir, gboolean activate)
{
- return new_tab(dir, file_list()->get_sort_column(), file_list()->get_sort_order(), activate);
+ return new_tab(dir, file_list()->get_sort_column(), file_list()->get_sort_order(), FALSE, activate);
}
GtkType gnome_cmd_file_selector_get_type ();
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 1aa1253..9b8a2c7 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -813,7 +813,7 @@ static void init (GnomeCmdMainWin *mw)
for (vector<GnomeCmdData::Tab>::const_iterator i=gnome_cmd_data.tabs[LEFT].begin(); i!=gnome_cmd_data.tabs[LEFT].end(); ++i)
{
GnomeCmdDir *dir = gnome_cmd_dir_new (home, gnome_cmd_con_create_path (home, i->first.c_str()));
- mw->fs(LEFT)->new_tab(dir, i->second, i->third, TRUE);
+ mw->fs(LEFT)->new_tab(dir, i->second, i->third, FALSE, TRUE);
}
if (gnome_cmd_data.tabs[RIGHT].empty())
@@ -822,7 +822,7 @@ static void init (GnomeCmdMainWin *mw)
for (vector<GnomeCmdData::Tab>::const_iterator i=gnome_cmd_data.tabs[RIGHT].begin(); i!=gnome_cmd_data.tabs[RIGHT].end(); ++i)
{
GnomeCmdDir *dir = gnome_cmd_dir_new (home, gnome_cmd_con_create_path (home, i->first.c_str()));
- mw->fs(RIGHT)->new_tab(dir, i->second, i->third, TRUE);
+ mw->fs(RIGHT)->new_tab(dir, i->second, i->third, FALSE, TRUE);
}
g_signal_connect (mw, "size-allocate", G_CALLBACK (on_size_allocate), mw);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]