gnome-commander r2172 - in branches/gcmd-1-3: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r2172 - in branches/gcmd-1-3: . src
- Date: Wed, 8 Oct 2008 21:12:28 +0000 (UTC)
Author: epiotr
Date: Wed Oct 8 21:12:28 2008
New Revision: 2172
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2172&view=rev
Log:
treeview: move common code to gnome-cmd-treeview.* files
Added:
branches/gcmd-1-3/src/gnome-cmd-treeview.cc
branches/gcmd-1-3/src/gnome-cmd-treeview.h
Modified:
branches/gcmd-1-3/ChangeLog
branches/gcmd-1-3/src/Makefile.am
branches/gcmd-1-3/src/gnome-cmd-file-props-dialog.cc
branches/gcmd-1-3/src/gnome-cmd-key-shortcuts-dialog.cc
branches/gcmd-1-3/src/gnome-cmd-remote-dialog.cc
Modified: branches/gcmd-1-3/src/Makefile.am
==============================================================================
--- branches/gcmd-1-3/src/Makefile.am (original)
+++ branches/gcmd-1-3/src/Makefile.am Wed Oct 8 21:12:28 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: branches/gcmd-1-3/src/gnome-cmd-file-props-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-props-dialog.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-props-dialog.cc Wed Oct 8 21:12:28 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: branches/gcmd-1-3/src/gnome-cmd-key-shortcuts-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-key-shortcuts-dialog.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-key-shortcuts-dialog.cc Wed Oct 8 21:12:28 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: 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 Wed Oct 8 21:12:28 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,
Added: branches/gcmd-1-3/src/gnome-cmd-treeview.cc
==============================================================================
--- (empty file)
+++ branches/gcmd-1-3/src/gnome-cmd-treeview.cc Wed Oct 8 21:12:28 2008
@@ -0,0 +1,67 @@
+/*
+ GNOME Commander - A GNOME based file manager
+ Copyright (C) 2001-2006 Marcus Bjurman
+ Copyright (C) 2007-2008 Piotr Eljasiak
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <config.h>
+#include "gnome-cmd-includes.h"
+#include "gnome-cmd-treeview.h"
+
+using namespace std;
+
+
+GtkTreeViewColumn *gnome_cmd_treeview_create_new_text_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title)
+{
+ 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;
+}
+
+
+GtkTreeViewColumn *gnome_cmd_treeview_create_new_pixbuf_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title)
+{
+ 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;
+}
Added: branches/gcmd-1-3/src/gnome-cmd-treeview.h
==============================================================================
--- (empty file)
+++ branches/gcmd-1-3/src/gnome-cmd-treeview.h Wed Oct 8 21:12:28 2008
@@ -0,0 +1,34 @@
+/*
+ GNOME Commander - A GNOME based file manager
+ Copyright (C) 2001-2006 Marcus Bjurman
+ Copyright (C) 2007-2008 Piotr Eljasiak
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __GNOME_CMD_TREEVIEW_H__
+#define __GNOME_CMD_TREEVIEW_H__
+
+GtkTreeViewColumn *gnome_cmd_treeview_create_new_text_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title=NULL);
+GtkTreeViewColumn *gnome_cmd_treeview_create_new_pixbuf_column (GtkTreeView *view, GtkCellRenderer *&renderer, gint COL_ID, const gchar *title=NULL);
+
+inline GtkTreeViewColumn *gnome_cmd_treeview_create_new_text_column (GtkTreeView *view, gint COL_ID, const gchar *title=NULL)
+{
+ GtkCellRenderer *renderer = NULL;
+
+ return gnome_cmd_treeview_create_new_text_column (view, renderer, COL_ID, title);
+}
+
+#endif // __GNOME_CMD_TREEVIEW_H__
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]