diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-10-04 21:38:09 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-10-04 21:38:09 +0800 |
commit | 9c4c24fb594657e88afbd687f8c7d8f154e60c47 (patch) | |
tree | 8a412d7fefb250fcb74998df4ab53991fae172ed /src/ppview-toolbar.c | |
parent | c74cae5e214e1f9e27b0e9c624fcb1e2f48fb450 (diff) | |
download | gsoc2013-epiphany-9c4c24fb594657e88afbd687f8c7d8f154e60c47.tar gsoc2013-epiphany-9c4c24fb594657e88afbd687f8c7d8f154e60c47.tar.gz gsoc2013-epiphany-9c4c24fb594657e88afbd687f8c7d8f154e60c47.tar.bz2 gsoc2013-epiphany-9c4c24fb594657e88afbd687f8c7d8f154e60c47.tar.lz gsoc2013-epiphany-9c4c24fb594657e88afbd687f8c7d8f154e60c47.tar.xz gsoc2013-epiphany-9c4c24fb594657e88afbd687f8c7d8f154e60c47.tar.zst gsoc2013-epiphany-9c4c24fb594657e88afbd687f8c7d8f154e60c47.zip |
Clean up a bit.
2004-10-04 Christian Persch <chpe@cvs.gnome.org>
* src/ppview-toolbar.c: (ppview_toolbar_get_type),
(ppview_toolbar_class_init), (ppview_toolbar_set_property),
(ppview_toolbar_get_property), (ppview_toolbar_set_window),
(ppview_toolbar_init), (ppview_toolbar_finalize),
(ppview_toolbar_new), (toolbar_cmd_ppv_close):
* src/ppview-toolbar.h:
Clean up a bit.
Diffstat (limited to 'src/ppview-toolbar.c')
-rwxr-xr-x | src/ppview-toolbar.c | 70 |
1 files changed, 29 insertions, 41 deletions
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c index cd1cf81bf..31cb156b6 100755 --- a/src/ppview-toolbar.c +++ b/src/ppview-toolbar.c @@ -51,7 +51,7 @@ ppview_toolbar_get_property (GObject *object, enum { PROP_0, - PROP_EPHY_WINDOW + PROP_WINDOW }; static GObjectClass *parent_class = NULL; @@ -61,7 +61,7 @@ static GObjectClass *parent_class = NULL; struct PPViewToolbarPrivate { EphyWindow *window; - GtkUIManager *ui_merge; + GtkUIManager *manager; GtkActionGroup *action_group; guint ui_id; int current_page; @@ -109,25 +109,24 @@ static GtkActionEntry entries [] = { N_("Close print preview"), (GCallback)toolbar_cmd_ppv_close }, }; -static guint n_entries = G_N_ELEMENTS (entries); -static const gchar *ui_info = +static const char ui_info[] = "<ui>" " <toolbar name=\"PPViewToolbar\">" " <toolitem name=\"PPVGotoFirstItem\" action=\"PPVGotoFirst\" />" " <toolitem name=\"PPVGotoLastItem\" action=\"PPVGotoLast\" />" " <toolitem name=\"PPVGoBackItem\" action=\"PPVGoBack\" />" " <toolitem name=\"PPVGoForwardItem\" action=\"PPVGoForward\" />" -" <toolitem name=\"PPVClose\" action=\"PPVClose\" />" +" <toolitem name=\"PPVCloseItem\" action=\"PPVClose\" />" " </toolbar>\n" "</ui>\n"; GType ppview_toolbar_get_type (void) { - static GType ppview_toolbar_type = 0; + static GType type = 0; - if (ppview_toolbar_type == 0) + if (type == 0) { static const GTypeInfo our_info = { @@ -142,12 +141,12 @@ ppview_toolbar_get_type (void) (GInstanceInitFunc) ppview_toolbar_init }; - ppview_toolbar_type = g_type_register_static (G_TYPE_OBJECT, - "PPViewToolbar", - &our_info, 0); + type = g_type_register_static (G_TYPE_OBJECT, + "PPViewToolbar", + &our_info, 0); } - return ppview_toolbar_type; + return type; } static void @@ -163,15 +162,15 @@ ppview_toolbar_class_init (PPViewToolbarClass *klass) object_class->get_property = ppview_toolbar_get_property; g_object_class_install_property (object_class, - PROP_EPHY_WINDOW, - g_param_spec_object ("EphyWindow", - "EphyWindow", - "Parent window", + PROP_WINDOW, + g_param_spec_object ("window", + "Window", + "Window", EPHY_TYPE_WINDOW, - G_PARAM_READWRITE | + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_type_class_add_private (object_class, sizeof(PPViewToolbarPrivate)); + g_type_class_add_private (object_class, sizeof (PPViewToolbarPrivate)); } static void @@ -184,7 +183,7 @@ ppview_toolbar_set_property (GObject *object, switch (prop_id) { - case PROP_EPHY_WINDOW: + case PROP_WINDOW: ppview_toolbar_set_window (t, g_value_get_object (value)); break; } @@ -196,14 +195,8 @@ ppview_toolbar_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - PPViewToolbar *t = EPHY_PPVIEW_TOOLBAR (object); - - switch (prop_id) - { - case PROP_EPHY_WINDOW: - g_value_set_object (value, t->priv->window); - break; - } + /* no readable properties */ + g_return_if_reached (); } static void @@ -237,16 +230,16 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window) g_return_if_fail (t->priv->window == NULL); t->priv->window = window; - t->priv->ui_merge = GTK_UI_MANAGER (ephy_window_get_ui_manager (t->priv->window)); + t->priv->manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (t->priv->window)); t->priv->action_group = gtk_action_group_new ("PPViewActions"); gtk_action_group_set_translation_domain (t->priv->action_group, NULL); gtk_action_group_add_actions (t->priv->action_group, entries, - n_entries, t); - gtk_ui_manager_insert_action_group (t->priv->ui_merge, + G_N_ELEMENTS (entries), t); + gtk_ui_manager_insert_action_group (t->priv->manager, t->priv->action_group, 0); t->priv->ui_id = gtk_ui_manager_add_ui_from_string - (t->priv->ui_merge, ui_info, -1, NULL); + (t->priv->manager, ui_info, -1, NULL); toolbar_update_sensitivity (t); } @@ -257,7 +250,7 @@ ppview_toolbar_init (PPViewToolbar *t) t->priv = EPHY_PPVIEW_TOOLBAR_GET_PRIVATE (t); t->priv->window = NULL; - t->priv->ui_merge = NULL; + t->priv->manager = NULL; t->priv->current_page = 1; } @@ -266,8 +259,8 @@ ppview_toolbar_finalize (GObject *object) { PPViewToolbar *t = EPHY_PPVIEW_TOOLBAR (object); - gtk_ui_manager_remove_ui (t->priv->ui_merge, t->priv->ui_id); - gtk_ui_manager_remove_action_group (t->priv->ui_merge, + gtk_ui_manager_remove_ui (t->priv->manager, t->priv->ui_id); + gtk_ui_manager_remove_action_group (t->priv->manager, t->priv->action_group); g_object_unref (t->priv->action_group); @@ -277,13 +270,9 @@ ppview_toolbar_finalize (GObject *object) PPViewToolbar * ppview_toolbar_new (EphyWindow *window) { - PPViewToolbar *t; - - t = EPHY_PPVIEW_TOOLBAR (g_object_new (EPHY_TYPE_PPVIEW_TOOLBAR, - "EphyWindow", window, - NULL)); - - return t; + return g_object_new (EPHY_TYPE_PPVIEW_TOOLBAR, + "window", window, + NULL); } static void @@ -394,4 +383,3 @@ toolbar_cmd_ppv_close (GtkUIManager *merge, ephy_embed_set_print_preview_mode (embed, FALSE); } - |