gnome-commander r2170 - in trunk: . src



Author: epiotr
Date: Wed Oct  8 21:11:48 2008
New Revision: 2170
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2170&view=rev

Log:
treeview: move common code to gnome-cmd-treeview.* files

Modified:
   trunk/ChangeLog
   trunk/src/Makefile.am
   trunk/src/gnome-cmd-file-props-dialog.cc
   trunk/src/gnome-cmd-key-shortcuts-dialog.cc
   trunk/src/gnome-cmd-remote-dialog.cc

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Wed Oct  8 21:11:48 2008
@@ -73,6 +73,7 @@
 	gnome-cmd-smb-net.h gnome-cmd-smb-net.cc \
 	gnome-cmd-smb-path.h gnome-cmd-smb-path.cc \
 	gnome-cmd-style.h gnome-cmd-style.cc \
+	gnome-cmd-treeview.h gnome-cmd-treeview.cc \
 	gnome-cmd-types.h \
 	gnome-cmd-user-actions.h gnome-cmd-user-actions.cc \
 	gnome-cmd-xfer-progress-win.h gnome-cmd-xfer-progress-win.cc \

Modified: trunk/src/gnome-cmd-file-props-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-file-props-dialog.cc	(original)
+++ trunk/src/gnome-cmd-file-props-dialog.cc	Wed Oct  8 21:11:48 2008
@@ -28,6 +28,7 @@
 #include "gnome-cmd-chown-component.h"
 #include "gnome-cmd-chmod-component.h"
 #include "gnome-cmd-data.h"
+#include "gnome-cmd-treeview.h"
 #include "utils.h"
 #include "imageloader.h"
 #include "tags/gnome-cmd-tags.h"
@@ -573,35 +574,6 @@
 }
 
 
-inline GtkTreeViewColumn *create_new_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title=NULL)
-{
-    renderer = gtk_cell_renderer_text_new ();
-
-    GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (title,
-                                                                       renderer,
-                                                                       "text", COL_ID,
-                                                                       NULL);
-
-    g_object_set (col,
-                  "clickable", TRUE,
-                  "resizable", TRUE,
-                  NULL);
-
-    // pack tree view column into tree view
-    gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
-
-    return col;
-}
-
-
-inline GtkTreeViewColumn *create_new_column (GtkTreeView *view, gint COL_ID, const gchar *title=NULL)
-{
-    GtkCellRenderer *renderer = NULL;
-
-    return create_new_column (view, renderer, COL_ID, title);
-}
-
-
 static GtkWidget *create_view_and_model (GnomeCmdFile *finfo)
 {
     GtkWidget *view = gtk_tree_view_new ();
@@ -617,7 +589,7 @@
 
     GtkTooltips *tips = gtk_tooltips_new ();
 
-    col = create_new_column (GTK_TREE_VIEW (view), renderer, COL_TYPE, _("Type"));
+    col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_TYPE, _("Type"));
     gtk_tooltips_set_tip (tips, col->button, _("Metadata namespace"), NULL);
 
     g_object_set (renderer,
@@ -625,13 +597,13 @@
                   "weight", PANGO_WEIGHT_BOLD,
                   NULL);
 
-    col = create_new_column (GTK_TREE_VIEW (view), COL_NAME, _("Name"));
+    col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), COL_NAME, _("Name"));
     gtk_tooltips_set_tip (tips, col->button, _("Tag name"), NULL);
 
-    col = create_new_column (GTK_TREE_VIEW (view), COL_VALUE, _("Value"));
+    col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), COL_VALUE, _("Value"));
     gtk_tooltips_set_tip (tips, col->button, _("Tag value"), NULL);
 
-    col = create_new_column (GTK_TREE_VIEW (view), renderer, COL_DESC, _("Description"));
+    col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_DESC, _("Description"));
     gtk_tooltips_set_tip (tips, col->button, _("Metadata tag description"), NULL);
 
     g_object_set (renderer,

Modified: trunk/src/gnome-cmd-key-shortcuts-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-key-shortcuts-dialog.cc	(original)
+++ trunk/src/gnome-cmd-key-shortcuts-dialog.cc	Wed Oct  8 21:11:48 2008
@@ -24,6 +24,7 @@
 #include "gnome-cmd-key-shortcuts-dialog.h"
 #include "eggcellrendererkeys.h"
 #include "gnome-cmd-data.h"
+#include "gnome-cmd-treeview.h"
 #include "gnome-cmd-hintbox.h"
 #include "dict.h"
 #include "utils.h"
@@ -266,36 +267,6 @@
 }
 
 
-inline GtkTreeViewColumn *create_new_text_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title=NULL)
-{
-    renderer = gtk_cell_renderer_text_new ();
-
-    GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (title,
-                                                                       renderer,
-                                                                       "text", COL_ID,
-                                                                       NULL);
-    g_object_set (col,
-                  "clickable", TRUE,
-                  "resizable", TRUE,
-                  NULL);
-
-    g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_ID));
-
-    // pack tree view column into tree view
-    gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
-
-    return col;
-}
-
-
-inline GtkTreeViewColumn *create_new_text_column (GtkTreeView *view, gint COL_ID, const gchar *title=NULL)
-{
-    GtkCellRenderer *renderer = NULL;
-
-    return create_new_text_column (view, renderer, COL_ID, title);
-}
-
-
 inline GtkTreeViewColumn *create_new_accel_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_KEYS_ID, gint COL_MODS_ID, const gchar *title=NULL)
 {
     renderer = egg_cell_renderer_keys_new ();
@@ -389,7 +360,7 @@
 
     g_object_unref (combo_model);          // destroy model automatically with view
 
-    col = create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_OPTION, _("Options"));
+    col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_OPTION, _("Options"));
     gtk_tooltips_set_tip (tips, col->button, _("Optional data"), NULL);
     gtk_tree_view_column_set_sort_column_id (col, SORTID_OPTION);
     g_signal_connect(renderer, "edited", (GCallback) cell_edited_callback, view);

Modified: trunk/src/gnome-cmd-remote-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-remote-dialog.cc	(original)
+++ trunk/src/gnome-cmd-remote-dialog.cc	Wed Oct  8 21:11:48 2008
@@ -25,6 +25,7 @@
 #include "gnome-cmd-con-list.h"
 #include "gnome-cmd-con-ftp.h"
 #include "gnome-cmd-data.h"
+#include "gnome-cmd-treeview.h"
 #include "imageloader.h"
 #include "gnome-cmd-file-selector.h"
 #include "gnome-cmd-main-win.h"
@@ -341,46 +342,6 @@
 }
 
 
-inline GtkTreeViewColumn *create_new_text_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title=NULL)
-{
-    renderer = gtk_cell_renderer_text_new ();
-
-    GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (title,
-                                                                       renderer,
-                                                                       "text", COL_ID,
-                                                                       NULL);
-
-    g_object_set (col,
-                  "clickable", TRUE,
-                  NULL);
-
-    // pack tree view column into tree view
-    gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
-
-    return col;
-}
-
-
-inline GtkTreeViewColumn *create_new_pixbuf_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title=NULL)
-{
-    renderer = gtk_cell_renderer_pixbuf_new ();
-
-    GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (title,
-                                                                       renderer,
-                                                                       "icon-name", COL_ID,
-                                                                       NULL);
-
-    g_object_set (col,
-                  "clickable", TRUE,
-                  NULL);
-
-    // pack tree view column into tree view
-    gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
-
-    return col;
-}
-
-
 inline GtkWidget *create_view_and_model (GList *list)
 {
     GtkWidget *view = gtk_tree_view_new ();
@@ -396,24 +357,24 @@
 
     GtkTooltips *tips = gtk_tooltips_new ();
 
-    // col = create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_AUTH);
+    // col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_AUTH);
 
-    col = create_new_pixbuf_column (GTK_TREE_VIEW (view), renderer, COL_LOCK);
+    col = gnome_cmd_treeview_create_new_pixbuf_column (GTK_TREE_VIEW (view), renderer, COL_LOCK);
     gtk_tooltips_set_tip (tips, col->button, _("GNOME authentication manager usage"), NULL);
     gtk_tree_view_column_set_sort_column_id (col, SORTID_AUTH);
 
-    col = create_new_pixbuf_column (GTK_TREE_VIEW (view), renderer, COL_METHOD);
+    col = gnome_cmd_treeview_create_new_pixbuf_column (GTK_TREE_VIEW (view), renderer, COL_METHOD);
     gtk_tooltips_set_tip (tips, col->button, _("Network protocol"), NULL);
     gtk_tree_view_column_set_sort_column_id (col, SORTID_METHOD);
 
-    // col = create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_METHOD);
+    // col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_METHOD);
     // gtk_tree_view_column_set_sort_column_id (col, SORTID_METHOD);
     // g_object_set (renderer,
                   // "foreground-set", TRUE,
                   // "foreground", "DarkGray",
                   // NULL);
 
-    col = create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_NAME, _("Name"));
+    col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_NAME, _("Name"));
     gtk_tooltips_set_tip (tips, col->button, _("Connection name"), NULL);
     gtk_tree_view_column_set_sort_column_id (col, SORTID_NAME);
     g_object_set (renderer,



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