Hiroyuki Ikezoe
ikezo****@users*****
Wed Jan 3 09:40:53 JST 2007
Index: kazehakase/src/Makefile.am diff -u kazehakase/src/Makefile.am:1.125 kazehakase/src/Makefile.am:1.126 --- kazehakase/src/Makefile.am:1.125 Sun Dec 31 22:59:19 2006 +++ kazehakase/src/Makefile.am Wed Jan 3 09:40:53 2007 @@ -73,6 +73,7 @@ kz-download-box.h \ kz-feed-info.h \ kz-navi.h \ + kz-notebook.h \ kz-proxy-menu.h \ kz-proxy-item.h \ kz-favicon.h \ @@ -112,6 +113,7 @@ kz-download-box.c \ kz-feed-info.c \ kz-navi.c \ + kz-notebook.c \ kz-proxy-menu.c \ kz-proxy-item.c \ kz-favicon.c \ Index: kazehakase/src/kz-notebook.c diff -u /dev/null kazehakase/src/kz-notebook.c:1.1 --- /dev/null Wed Jan 3 09:40:53 2007 +++ kazehakase/src/kz-notebook.c Wed Jan 3 09:40:53 2007 @@ -0,0 +1,183 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Copyright (C) 2006 Hiroyuki Ikezoe + * + * 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <string.h> +#include <glib/gi18n.h> +#include <gdk/gdkkeysyms.h> + +#include "gtk-utils.h" +#include "kz-download-box.h" +#include "kz-entry.h" +#include "kz-notebook.h" + +enum { + PROP_0, + PROP_KZ_WINDOW +}; + +typedef struct _KzNotebookPrivate KzNotebookPrivate; +struct _KzNotebookPrivate +{ +}; + +#define KZ_NOTEBOOK_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KZ_TYPE_NOTEBOOK, KzNotebookPrivate)) + +#define STATUS_LINK_MESSAGE "INTERNAL_LINK_MESSAGE" +#define STATUS_GESTURE "INTERNAL_GESTURE" +#define STATUS_SEARCH "INTERNAL_SEARCH" + +static GObject *constructor (GType type, + guint n_props, + GObjectConstructParam *props); + +static void dispose (GObject *object); +static void set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + +G_DEFINE_TYPE (KzNotebook, kz_notebook, GTK_TYPE_NOTEBOOK) + +static void +kz_notebook_class_init (KzNotebookClass *klass) +{ + GObjectClass *gobject_class; + GtkWidgetClass *widget_class; + + gobject_class = (GObjectClass *)klass; + widget_class = (GtkWidgetClass *)klass; + + /* GtkObject signals */ + gobject_class->constructor = constructor; + gobject_class->dispose = dispose; + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property + (gobject_class, + PROP_KZ_WINDOW, + g_param_spec_object("kz-window", + _("KzWindow"), + _("The parent kazehakase window"), + KZ_TYPE_WINDOW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (gobject_class, sizeof(KzNotebookPrivate)); +} + + +static void +kz_notebook_init (KzNotebook *notebook) +{ + KzNotebookPrivate *priv = KZ_NOTEBOOK_GET_PRIVATE (notebook); + + /* widgets */ + notebook->kz = NULL; +} + + +static GObject* +constructor (GType type, + guint n_props, + GObjectConstructParam *props) +{ + KzNotebook *notebook; + GObject *object; + GObjectClass *klass = G_OBJECT_CLASS(kz_notebook_parent_class); + GtkWidget *widget; + + object = klass->constructor(type, n_props, props); + + notebook = KZ_NOTEBOOK(object); + + return object; +} + + +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + KzNotebook *notebook = KZ_NOTEBOOK(object); + + switch (prop_id) + { + case PROP_KZ_WINDOW: + notebook->kz = g_object_ref(g_value_get_object(value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + KzNotebook *notebook = KZ_NOTEBOOK(object); + + switch (prop_id) + { + case PROP_KZ_WINDOW: + g_value_set_object(value, notebook->kz); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +GtkWidget * +kz_notebook_new (KzWindow *kz) +{ + KzNotebook *notebook; + + notebook = g_object_new(KZ_TYPE_NOTEBOOK, + "kz-window", kz, + "scrollable", TRUE, + "show-tabs", TRUE, + NULL); + + return GTK_WIDGET(notebook); +} + +static void +dispose (GObject *object) +{ + KzNotebook *notebook = KZ_NOTEBOOK(object); + KzNotebookPrivate *priv = KZ_NOTEBOOK_GET_PRIVATE (notebook); + + if (notebook->kz) + { + g_object_unref(notebook->kz); + notebook->kz = NULL; + } + + if (G_OBJECT_CLASS(kz_notebook_parent_class)->dispose) + (*G_OBJECT_CLASS(kz_notebook_parent_class)->dispose) (object); +} + Index: kazehakase/src/kz-notebook.h diff -u /dev/null kazehakase/src/kz-notebook.h:1.1 --- /dev/null Wed Jan 3 09:40:53 2007 +++ kazehakase/src/kz-notebook.h Wed Jan 3 09:40:53 2007 @@ -0,0 +1,38 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +#ifndef __KZ_NOTEBOOK_H__ +#define __KZ_NOTEBOOK_H__ + +#include "kz-window.h" + +G_BEGIN_DECLS + +#define KZ_TYPE_NOTEBOOK (kz_notebook_get_type ()) +#define KZ_NOTEBOOK(obj) (GTK_CHECK_CAST ((obj), KZ_TYPE_NOTEBOOK, KzNotebook)) +#define KZ_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), KZ_TYPE_NOTEBOOK, KzNotebookClass)) +#define KZ_IS_NOTEBOOK(obj) (GTK_CHECK_TYPE ((obj), KZ_TYPE_NOTEBOOK)) +#define KZ_IS_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), KZ_TYPE_NOTEBOOK)) +#define KZ_NOTEBOOK_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), KZ_TYPE_NOTEBOOK, KzNotebookClass)) + +typedef struct _KzNotebook KzNotebook; +typedef struct _KzNotebookClass KzNotebookClass; + +struct _KzNotebook +{ + GtkNotebook parent; + + /* Kazehakase */ + KzWindow *kz; +}; + +struct _KzNotebookClass +{ + GtkNotebookClass parent_class; +}; + +GType kz_notebook_get_type (void) G_GNUC_CONST; +GtkWidget *kz_notebook_new (KzWindow *kz); + +G_END_DECLS + +#endif /* __KZ_NOTEBOOK_H__ */ Index: kazehakase/src/kz-window.c diff -u kazehakase/src/kz-window.c:1.287 kazehakase/src/kz-window.c:1.288 --- kazehakase/src/kz-window.c:1.287 Tue Jan 2 20:30:51 2007 +++ kazehakase/src/kz-window.c Wed Jan 3 09:40:53 2007 @@ -51,6 +51,7 @@ #include "kz-bookmark-file.h" #include "kz-paned.h" #include "kz-entry.h" +#include "kz-notebook.h" #include "kz-proxy-menu.h" #include "kz-popup-tablist.h" #include "kz-ext.h" @@ -429,7 +430,7 @@ g_list_free(children); kz->statusbar = kz_statusbar_new(kz); - kz->notebook = gtk_notebook_new(); + kz->notebook = kz_notebook_new(kz); kz->feed_info = g_object_ref(kz_feed_info_new(kz)); @@ -579,8 +580,6 @@ /* main notebook widget */ { - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(kz->notebook), TRUE); - gtk_notebook_set_scrollable(GTK_NOTEBOOK(kz->notebook), TRUE); g_signal_connect(kz->notebook, "switch-page", G_CALLBACK(cb_notebook_switch_page), kz); g_signal_connect_after(kz->notebook, "switch-page", @@ -602,7 +601,6 @@ kz->sidebar = kz_sidebar_new(kz); gtk_widget_set_size_request(kz->sidebar, 150, -1); gtk_paned_add1(GTK_PANED(kz->pane), kz->sidebar); - /* gtk_widget_show(kz->sidebar); */ { GtkAction *action; action = gtk_action_group_get_action(kz->actions, @@ -612,9 +610,6 @@ g_signal_connect(kz->sidebar, "unmap", G_CALLBACK(cb_sidebar_unmap), action); } - - /* embed tab */ - /* curpage = kz_window_open_new_tab(kz, NULL); */ } /* status bar */ @@ -636,7 +631,6 @@ kz_bookmark_set_title(kz->tabs, "Window"); kz_bookmark_append(KZ_GET_CURRENT_SESSION, kz->tabs); - /* kz_actions_set_sensitive(kz, KZ_EMBED(curpage)); */ kz_window_restore_state(kz); }