gnome-commander r1972 - in trunk: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r1972 - in trunk: . src
- Date: Wed, 13 Aug 2008 21:31:49 +0000 (UTC)
Author: epiotr
Date: Wed Aug 13 21:31:49 2008
New Revision: 1972
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1972&view=rev
Log:
Initial framework for tabs support
Added:
trunk/src/gnome-cmd-notebook.cc
trunk/src/gnome-cmd-notebook.h
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Aug 13 21:31:49 2008
@@ -72,6 +72,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-notebook.h gnome-cmd-notebook.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 \
Added: trunk/src/gnome-cmd-notebook.cc
==============================================================================
--- (empty file)
+++ trunk/src/gnome-cmd-notebook.cc Wed Aug 13 21:31:49 2008
@@ -0,0 +1,83 @@
+/*
+ GNOME Commander - A GNOME based file manager
+ Copyright (C) 2001-2006 Marcus Bjurman
+
+ 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-notebook.h"
+#include "utils.h"
+
+using namespace std;
+
+
+struct GnomeCmdNotebookClass
+{
+ GtkNotebookClass parent_class;
+};
+
+
+class GnomeCmdNotebook::Private
+{
+ public:
+
+ Private();
+ ~Private();
+};
+
+
+inline GnomeCmdNotebook::Private::Private()
+{
+}
+
+
+inline GnomeCmdNotebook::Private::~Private()
+{
+}
+
+
+// #define GNOME_CMD_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNOME_CMD_TYPE_NOTEBOOK, GnomeCmdNotebookClass))
+
+G_DEFINE_TYPE (GnomeCmdNotebook, gnome_cmd_notebook, GTK_TYPE_NOTEBOOK)
+
+
+static void gnome_cmd_notebook_init (GnomeCmdNotebook *self)
+{
+ self->priv = new GnomeCmdNotebook::Private;
+}
+
+
+static void gnome_cmd_notebook_finalize (GObject *object)
+{
+ GnomeCmdNotebook *self = GNOME_CMD_NOTEBOOK (object);
+
+ delete self->priv;
+
+ if (G_OBJECT_CLASS (gnome_cmd_notebook_parent_class)->finalize)
+ (* G_OBJECT_CLASS (gnome_cmd_notebook_parent_class)->finalize) (object);
+}
+
+
+static void gnome_cmd_notebook_class_init (GnomeCmdNotebookClass *klass)
+{
+ gnome_cmd_notebook_parent_class = (GObjectClass*) g_type_class_peek_parent (klass);
+
+ GObjectClass *object_class = (GObjectClass*) klass;
+
+ object_class->finalize = gnome_cmd_notebook_finalize;
+}
Added: trunk/src/gnome-cmd-notebook.h
==============================================================================
--- (empty file)
+++ trunk/src/gnome-cmd-notebook.h Wed Aug 13 21:31:49 2008
@@ -0,0 +1,86 @@
+/*
+ GNOME Commander - A GNOME based file manager
+ Copyright (C) 2001-2006 Marcus Bjurman
+
+ 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_NOTEBOOK_H__
+#define __GNOME_CMD_NOTEBOOK_H__
+
+
+#include <gtk/gtk.h>
+
+#define GNOME_CMD_TYPE_NOTEBOOK (gnome_cmd_notebook_get_type ())
+#define GNOME_CMD_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNOME_CMD_TYPE_NOTEBOOK, GnomeCmdNotebook))
+#define GNOME_CMD_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNOME_CMD_TYPE_NOTEBOOK))
+
+
+GType gnome_cmd_notebook_get_type ();
+
+
+struct GnomeCmdNotebook
+{
+ GtkNotebook parent; // this MUST be the first member
+
+ class Private;
+
+ Private *priv;
+
+ void *operator new (size_t size) { return g_object_new (GNOME_CMD_TYPE_NOTEBOOK, NULL); }
+ void operator delete (void *p) { g_free (p); }
+
+ operator GtkWidget * () { return GTK_WIDGET (this); }
+ operator GtkNotebook * () { return GTK_NOTEBOOK (this); }
+
+ int size() { return gtk_notebook_get_n_pages (*this); }
+ bool empty() { return size()==0; }
+
+ GtkWidget *page() { return gtk_notebook_get_nth_page (*this, gtk_notebook_get_current_page (*this)); }
+ GtkWidget *page(gint n) { return gtk_notebook_get_nth_page (*this, n); }
+
+ gint insert_page(GtkWidget *page, gint n, const gchar *label=NULL);
+ gint prepend_page(GtkWidget *page, const gchar *label=NULL) { return insert_page(page, 0, label); }
+ gint append_page(GtkWidget *page, const gchar *label=NULL) { return insert_page(page, -1, label); }
+
+ void remove_page() { gtk_notebook_remove_page (*this, gtk_notebook_get_current_page (*this)); }
+ void remove_page(gint n) { gtk_notebook_remove_page (*this, n); }
+
+ void set_label(const gchar *label=NULL);
+ void set_label(gint n, const gchar *label=NULL);
+
+ void prev_page();
+ void next_page();
+};
+
+
+inline gint GnomeCmdNotebook::insert_page(GtkWidget *page, gint n, const gchar *label)
+{
+ return gtk_notebook_insert_page (*this, page, label ? gtk_label_new (label) : NULL, n);
+}
+
+
+inline void GnomeCmdNotebook::set_label(const gchar *label)
+{
+ gtk_notebook_set_tab_label (*this, page(), label ? gtk_label_new (label) : NULL);
+}
+
+
+inline void GnomeCmdNotebook::set_label(gint n, const gchar *label)
+{
+ gtk_notebook_set_tab_label (*this, page(n), label ? gtk_label_new (label) : NULL);
+}
+
+#endif // __GNOME_CMD_NOTEBOOK_H__
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]