gnome-commander r2171 - trunk/src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r2171 - trunk/src
- Date: Wed, 8 Oct 2008 21:12:08 +0000 (UTC)
Author: epiotr
Date: Wed Oct 8 21:12:08 2008
New Revision: 2171
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2171&view=rev
Log:
treeview: move common code to gnome-cmd-treeview.* files
Added:
trunk/src/gnome-cmd-treeview.cc
trunk/src/gnome-cmd-treeview.h
Added: trunk/src/gnome-cmd-treeview.cc
==============================================================================
--- (empty file)
+++ trunk/src/gnome-cmd-treeview.cc Wed Oct 8 21:12:08 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: trunk/src/gnome-cmd-treeview.h
==============================================================================
--- (empty file)
+++ trunk/src/gnome-cmd-treeview.h Wed Oct 8 21:12:08 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]