From 1109efff73c6f11040c1d491d99141423d6e6aeb Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Mon, 6 Jun 2005 21:23:46 +0000 Subject: [PATCH] Fix gcc 4.0 warnings. Second part --- .../toolbar-editor/egg-editable-toolbar.c | 104 +++++++++--------- .../toolbar-editor/egg-editable-toolbar.h | 18 ++- .../toolbar-editor/egg-toolbar-editor.c | 52 +++------ .../toolbar-editor/egg-toolbars-model.c | 48 ++++---- .../toolbar-editor/egg-toolbars-model.h | 13 ++- 5 files changed, 106 insertions(+), 129 deletions(-) diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c index 934eb1ba..4c307448 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 2003-2004 Marco Pesenti Gritti - * Copyright (C) 2004 Christian Persch + * Copyright (C) 2003, 2004 Marco Pesenti Gritti + * Copyright (C) 2003, 2004, 2005 Christian Persch * * 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 @@ -19,9 +19,7 @@ * $Id$ */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "egg-editable-toolbar.h" #include "egg-toolbars-model.h" @@ -49,10 +47,9 @@ static void egg_editable_toolbar_finalize (GObject *object); #define MIN_TOOLBAR_HEIGHT 20 -static GtkTargetEntry dest_drag_types[] = { +static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; -static int n_dest_drag_types = G_N_ELEMENTS (dest_drag_types); enum { @@ -73,13 +70,12 @@ static GObjectClass *parent_class = NULL; #define EGG_EDITABLE_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbarPrivate)) -struct EggEditableToolbarPrivate +struct _EggEditableToolbarPrivate { GtkUIManager *manager; EggToolbarsModel *model; gboolean edit_mode; GtkWidget *selected_toolbar; - GtkToolItem *fixed; GtkWidget *fixed_toolbar; gboolean pending; @@ -90,9 +86,9 @@ struct EggEditableToolbarPrivate GType egg_editable_toolbar_get_type (void) { - static GType egg_editable_toolbar_type = 0; + static GType type = 0; - if (egg_editable_toolbar_type == 0) + if (G_UNLIKELY (type == 0)) { static const GTypeInfo our_info = { sizeof (EggEditableToolbarClass), @@ -106,12 +102,12 @@ egg_editable_toolbar_get_type (void) (GInstanceInitFunc) egg_editable_toolbar_init }; - egg_editable_toolbar_type = g_type_register_static (GTK_TYPE_VBOX, - "EggEditableToolbar", - &our_info, 0); + type = g_type_register_static (GTK_TYPE_VBOX, + "EggEditableToolbar", + &our_info, 0); } - return egg_editable_toolbar_type; + return type; } static int @@ -253,7 +249,8 @@ drag_data_get_cb (GtkWidget *widget, } gtk_selection_data_set (selection_data, - selection_data->target, 8, (unsigned char *)target, strlen (target)); + selection_data->target, 8, + (const guchar *)target, strlen (target)); g_free (target); } @@ -448,7 +445,8 @@ drag_data_received_cb (GtkWidget *widget, target = gtk_drag_dest_find_target (widget, context, NULL); type = egg_toolbars_model_get_item_type (etoolbar->priv->model, target); - id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, (char *)selection_data->data); + id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, + (const char*)selection_data->data); /* This function can be called for two reasons * @@ -484,7 +482,7 @@ drag_data_received_cb (GtkWidget *widget, pos = gtk_toolbar_get_drop_index (GTK_TOOLBAR (widget), x, y); toolbar_pos = get_toolbar_position (etoolbar, widget); - if (data_is_separator ((char *)selection_data->data)) + if (data_is_separator ((const char*)selection_data->data)) { egg_toolbars_model_add_separator (etoolbar->priv->model, toolbar_pos, pos); @@ -703,7 +701,7 @@ create_dock (EggEditableToolbar *t) gtk_box_pack_start (GTK_BOX (hbox), toolbar, TRUE, TRUE, 0); gtk_drag_dest_set (toolbar, 0, - dest_drag_types, n_dest_drag_types, + dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE | GDK_ACTION_COPY); g_signal_connect (toolbar, "drag_drop", @@ -725,7 +723,8 @@ static void set_fixed_style (EggEditableToolbar *t, GtkToolbarStyle style) { g_return_if_fail (GTK_IS_TOOLBAR (t->priv->fixed_toolbar)); - gtk_toolbar_set_style (GTK_TOOLBAR (t->priv->fixed_toolbar), style); + gtk_toolbar_set_style (GTK_TOOLBAR (t->priv->fixed_toolbar), + style == GTK_TOOLBAR_ICONS ? GTK_TOOLBAR_BOTH_HORIZ : style); } static void @@ -747,19 +746,19 @@ toolbar_changed_cb (EggToolbarsModel *model, flags = egg_toolbars_model_get_flags (model, position); toolbar = get_toolbar_nth (t, position); - if (flags & EGG_TB_MODEL_ICONS_ONLY) + if (flags & EGG_TB_MODEL_ICONS) { style = GTK_TOOLBAR_ICONS; } - else if (flags & EGG_TB_MODEL_TEXT_ONLY) + else if (flags & EGG_TB_MODEL_TEXT) { style = GTK_TOOLBAR_TEXT; } - else if (flags & EGG_TB_MODEL_ICONS_TEXT) + else if (flags & EGG_TB_MODEL_BOTH) { style = GTK_TOOLBAR_BOTH; } - else if (flags & EGG_TB_MODEL_ICONS_TEXT_HORIZ) + else if (flags & EGG_TB_MODEL_BOTH_HORIZ) { style = GTK_TOOLBAR_BOTH_HORIZ; } @@ -808,7 +807,10 @@ update_fixed (EggEditableToolbar *t) { gtk_box_pack_end (GTK_BOX (dock), toolbar, FALSE, TRUE, 0); - gtk_widget_show_all (toolbar); + gtk_widget_show (toolbar); + + gtk_widget_set_size_request (dock, -1, -1); + gtk_widget_queue_resize_no_redraw (dock); } } @@ -839,6 +841,11 @@ toolbar_removed_cb (EggToolbarsModel *model, { GtkWidget *toolbar; + if (position == 0 && t->priv->fixed_toolbar != NULL) + { + unparent_fixed (t); + } + toolbar = get_dock_nth (t, position); gtk_widget_destroy (toolbar); @@ -907,22 +914,11 @@ egg_editable_toolbar_construct (EggEditableToolbar *t) for (i = 0; i < n_toolbars; i++) { GtkWidget *toolbar, *dock; - EggTbModelFlags flags; dock = create_dock (t); gtk_box_pack_start (GTK_BOX (t), dock, TRUE, TRUE, 0); toolbar = get_toolbar_nth (t, i); - flags = egg_toolbars_model_get_flags (model, i); - if (flags & EGG_TB_MODEL_ICONS_ONLY) - { - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); - if (i == 0 && t->priv->fixed_toolbar) - { - set_fixed_style (t, GTK_TOOLBAR_ICONS); - } - } - n_items = egg_toolbars_model_n_items (model, i); for (l = 0; l < n_items; l++) { @@ -955,6 +951,12 @@ egg_editable_toolbar_construct (EggEditableToolbar *t) } update_fixed (t); + + /* apply styles */ + for (i = 0; i < n_toolbars; i ++) + { + toolbar_changed_cb (model, i, t); + } } static void @@ -1267,35 +1269,27 @@ egg_editable_toolbar_hide (EggEditableToolbar *etoolbar, void egg_editable_toolbar_set_fixed (EggEditableToolbar *toolbar, - GtkToolItem *fixed) + GtkToolbar *fixed_toolbar) { g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (toolbar)); - g_return_if_fail (!fixed || GTK_IS_TOOL_ITEM (fixed)); + g_return_if_fail (!fixed_toolbar || GTK_IS_TOOLBAR (fixed_toolbar)); - if (!toolbar->priv->fixed_toolbar) + if (toolbar->priv->fixed_toolbar) { - toolbar->priv->fixed_toolbar = gtk_toolbar_new (); - gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar->priv->fixed_toolbar), FALSE); - g_object_ref (toolbar->priv->fixed_toolbar); - gtk_object_sink (GTK_OBJECT (toolbar->priv->fixed_toolbar)); + unparent_fixed (toolbar); + g_object_unref (toolbar->priv->fixed_toolbar); + toolbar->priv->fixed_toolbar = NULL; } - if (toolbar->priv->fixed) + if (fixed_toolbar) { - gtk_container_remove (GTK_CONTAINER (toolbar->priv->fixed_toolbar), - GTK_WIDGET (toolbar->priv->fixed)); - g_object_unref (toolbar->priv->fixed); + toolbar->priv->fixed_toolbar = GTK_WIDGET (fixed_toolbar); + gtk_toolbar_set_show_arrow (fixed_toolbar, FALSE); + g_object_ref (fixed_toolbar); + gtk_object_sink (GTK_OBJECT (fixed_toolbar)); } - toolbar->priv->fixed = fixed; - - if (fixed) - { - g_object_ref (fixed); - gtk_object_sink (GTK_OBJECT (fixed)); - - gtk_toolbar_insert (GTK_TOOLBAR (toolbar->priv->fixed_toolbar), fixed, 0); - } + update_fixed (toolbar); } void diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h index 2aa087b5..9f143da7 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2003-2004 Marco Pesenti Gritti - * Copyright (C) 2004 Christian Persch + * Copyright (C) 2003, 2004 Marco Pesenti Gritti + * Copyright (C) 2003, 2004, 2005 Christian Persch * * 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 @@ -32,8 +32,6 @@ G_BEGIN_DECLS -typedef struct EggEditableToolbarClass EggEditableToolbarClass; - #define EGG_TYPE_EDITABLE_TOOLBAR (egg_editable_toolbar_get_type ()) #define EGG_EDITABLE_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbar)) #define EGG_EDITABLE_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbarClass)) @@ -41,11 +39,11 @@ typedef struct EggEditableToolbarClass EggEditableToolbarClass; #define EGG_IS_EDITABLE_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_EDITABLE_TOOLBAR)) #define EGG_EDITABLE_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbarClass)) +typedef struct _EggEditableToolbar EggEditableToolbar; +typedef struct _EggEditableToolbarPrivate EggEditableToolbarPrivate; +typedef struct _EggEditableToolbarClass EggEditableToolbarClass; -typedef struct EggEditableToolbar EggEditableToolbar; -typedef struct EggEditableToolbarPrivate EggEditableToolbarPrivate; - -struct EggEditableToolbar +struct _EggEditableToolbar { GtkVBox parent_object; @@ -53,7 +51,7 @@ struct EggEditableToolbar EggEditableToolbarPrivate *priv; }; -struct EggEditableToolbarClass +struct _EggEditableToolbarClass { GtkVBoxClass parent_class; @@ -80,7 +78,7 @@ void egg_editable_toolbar_set_drag_dest (EggEditableToolbar *etoolbar, gint n_targets, const char *toolbar_name); void egg_editable_toolbar_set_fixed (EggEditableToolbar *etoolbar, - GtkToolItem *fixed); + GtkToolbar *fixed_toolbar); /* Private Functions */ diff --git a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c index 4158d0e6..bd79724a 100644 --- a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c +++ b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c @@ -18,6 +18,8 @@ * $Id$ */ +#include "config.h" + #include "egg-toolbar-editor.h" #include "egg-editable-toolbar.h" #include "eggintl.h" @@ -33,15 +35,13 @@ #include #include -static GtkTargetEntry dest_drag_types[] = { +static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; -static int n_dest_drag_types = G_N_ELEMENTS (dest_drag_types); -static GtkTargetEntry source_drag_types[] = { +static const GtkTargetEntry source_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; -static int n_source_drag_types = G_N_ELEMENTS (source_drag_types); static void egg_toolbar_editor_class_init (EggToolbarEditorClass *klass); static void egg_toolbar_editor_init (EggToolbarEditor *t); @@ -75,9 +75,9 @@ struct EggToolbarEditorPrivate GType egg_toolbar_editor_get_type (void) { - static GType egg_toolbar_editor_type = 0; + static GType type = 0; - if (egg_toolbar_editor_type == 0) + if (G_UNLIKELY (type == 0)) { static const GTypeInfo our_info = { sizeof (EggToolbarEditorClass), @@ -91,12 +91,12 @@ egg_toolbar_editor_get_type (void) (GInstanceInitFunc) egg_toolbar_editor_init }; - egg_toolbar_editor_type = g_type_register_static (GTK_TYPE_VBOX, - "EggToolbarEditor", - &our_info, 0); + type = g_type_register_static (GTK_TYPE_VBOX, + "EggToolbarEditor", + &our_info, 0); } - return egg_toolbar_editor_type; + return type; } static gint @@ -366,7 +366,8 @@ drag_data_get_cb (GtkWidget *widget, } gtk_selection_data_set (selection_data, - selection_data->target, 8, (unsigned char *)target, strlen (target)); + selection_data->target, 8, + (const guchar *)target, strlen (target)); } static gchar * @@ -450,7 +451,7 @@ editor_create_item (EggToolbarEditor *editor, gtk_widget_show (event_box); gtk_drag_source_set (event_box, GDK_BUTTON1_MASK, - source_drag_types, n_source_drag_types, action); + source_drag_types, G_N_ELEMENTS (source_drag_types), action); g_signal_connect (event_box, "drag_data_get", G_CALLBACK (drag_data_get_cb), editor); g_signal_connect (event_box, "drag_data_delete", @@ -507,7 +508,7 @@ update_editor_sheet (EggToolbarEditor *editor) gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table); gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL, - dest_drag_types, n_dest_drag_types, GDK_ACTION_MOVE); + dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE); g_signal_connect (table, "drag_data_received", G_CALLBACK (editor_drag_data_received_cb), editor); @@ -561,11 +562,6 @@ static void setup_editor (EggToolbarEditor *editor) { GtkWidget *scrolled_window; - GtkWidget *label_hbox; - GtkWidget *image; - GtkWidget *label; - - g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); gtk_container_set_border_width (GTK_CONTAINER (editor), 12); scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -574,18 +570,6 @@ setup_editor (EggToolbarEditor *editor) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (editor), scrolled_window, TRUE, TRUE, 0); - label_hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (label_hbox); - gtk_box_pack_start (GTK_BOX (editor), label_hbox, FALSE, FALSE, 0); - image = - gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); - gtk_widget_show (image); - gtk_box_pack_start (GTK_BOX (label_hbox), image, FALSE, FALSE, 0); - label = gtk_label_new (_("Drag an item onto the toolbars above to add it, " - "from the toolbars in the items table to remove it.")); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, TRUE, 0); } static void @@ -619,12 +603,12 @@ parse_item_list (EggToolbarEditor *t, { while (child) { - if (xmlStrEqual (child->name, (xmlChar *)"toolitem")) + if (xmlStrEqual (child->name, (const xmlChar*) "toolitem")) { xmlChar *name; - name = xmlGetProp (child, (xmlChar *)"name"); - egg_toolbar_editor_add_action (t, (char *)name); + name = xmlGetProp (child, (const xmlChar*) "name"); + egg_toolbar_editor_add_action (t, (const char*)name); xmlFree (name); } child = child->next; @@ -692,7 +676,7 @@ egg_toolbar_editor_load_actions (EggToolbarEditor *editor, while (child) { - if (xmlStrEqual (child->name, (xmlChar *)"available")) + if (xmlStrEqual (child->name, (const xmlChar*) "available")) { parse_item_list (editor, child->children); } diff --git a/cut-n-paste/toolbar-editor/egg-toolbars-model.c b/cut-n-paste/toolbar-editor/egg-toolbars-model.c index 10208cbb..cf1ee8e0 100644 --- a/cut-n-paste/toolbar-editor/egg-toolbars-model.c +++ b/cut-n-paste/toolbar-editor/egg-toolbars-model.c @@ -19,9 +19,7 @@ * $Id$ */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "egg-toolbars-model.h" #include "eggmarshalers.h" @@ -77,7 +75,7 @@ egg_toolbars_model_get_type (void) { static GType type = 0; - if (type == 0) + if (G_UNLIKELY (type == 0)) { static const GTypeInfo our_info = { sizeof (EggToolbarsModelClass), @@ -110,16 +108,16 @@ egg_toolbars_model_to_xml (EggToolbarsModel *t) tl = t->priv->toolbars; xmlIndentTreeOutput = TRUE; - doc = xmlNewDoc ((xmlChar *)"1.0"); - doc->children = xmlNewDocNode (doc, NULL, (xmlChar *)"toolbars", NULL); + doc = xmlNewDoc ((const xmlChar*) "1.0"); + doc->children = xmlNewDocNode (doc, NULL, (const xmlChar*) "toolbars", NULL); for (l1 = tl->children; l1 != NULL; l1 = l1->next) { xmlNodePtr tnode; EggToolbarsToolbar *toolbar = l1->data; - tnode = xmlNewChild (doc->children, NULL, (xmlChar *)"toolbar", NULL); - xmlSetProp (tnode, (xmlChar *)"name", (xmlChar *)toolbar->name); + tnode = xmlNewChild (doc->children, NULL, (const xmlChar*) "toolbar", NULL); + xmlSetProp (tnode, (const xmlChar*) "name", (const xmlChar*) toolbar->name); for (l2 = l1->children; l2 != NULL; l2 = l2->next) { @@ -128,16 +126,16 @@ egg_toolbars_model_to_xml (EggToolbarsModel *t) if (item->separator) { - node = xmlNewChild (tnode, NULL, (xmlChar *)"separator", NULL); + node = xmlNewChild (tnode, NULL, (const xmlChar*) "separator", NULL); } else { char *data; - node = xmlNewChild (tnode, NULL, (xmlChar *)"toolitem", NULL); + node = xmlNewChild (tnode, NULL, (const xmlChar*) "toolitem", NULL); data = egg_toolbars_model_get_item_data (t, item->type, item->id); - xmlSetProp (node, (xmlChar *)"type", (xmlChar *)item->type); - xmlSetProp (node, (xmlChar *)"name", (xmlChar *)data); + xmlSetProp (node, (const xmlChar*) "type", (const xmlChar*) item->type); + xmlSetProp (node, (const xmlChar*) "name", (const xmlChar*) data); g_free (data); } } @@ -214,7 +212,7 @@ egg_toolbars_model_save (EggToolbarsModel *t, doc = egg_toolbars_model_to_xml (t); root = xmlDocGetRootElement (doc); - xmlSetProp (root, (xmlChar *)"version", (xmlChar *)version); + xmlSetProp (root, (const xmlChar*) "version", (const xmlChar*) version); safe_save_xml (xml_file, doc); xmlFreeDoc (doc); } @@ -365,31 +363,31 @@ parse_item_list (EggToolbarsModel *t, { while (child) { - if (xmlStrEqual (child->name, (xmlChar *)"toolitem")) + if (xmlStrEqual (child->name, (const xmlChar*) "toolitem")) { xmlChar *name, *type; char *id; - name = xmlGetProp (child, (xmlChar *)"name"); - type = xmlGetProp (child, (xmlChar *)"type"); + name = xmlGetProp (child, (const xmlChar*) "name"); + type = xmlGetProp (child, (const xmlChar*) "type"); if (type == NULL) { - type = xmlStrdup ((xmlChar *)EGG_TOOLBAR_ITEM_TYPE); + type = xmlCharStrdup (EGG_TOOLBAR_ITEM_TYPE); } if (name != NULL && name[0] != '\0' && type != NULL) { - id = egg_toolbars_model_get_item_id (t, (char *)type, (char *)name); + id = egg_toolbars_model_get_item_id (t, (const char*)type, (const char*)name); if (id != NULL) { - egg_toolbars_model_add_item (t, position, -1, id, (char *)type); + egg_toolbars_model_add_item (t, position, -1, id, (const char*)type); } g_free (id); } xmlFree (name); xmlFree (type); } - else if (xmlStrEqual (child->name, (xmlChar *)"separator")) + else if (xmlStrEqual (child->name, (const xmlChar*) "separator")) { egg_toolbars_model_add_separator (t, position, -1); } @@ -425,21 +423,21 @@ parse_toolbars (EggToolbarsModel *t, { while (child) { - if (xmlStrEqual (child->name, (xmlChar *)"toolbar")) + if (xmlStrEqual (child->name, (const xmlChar*) "toolbar")) { xmlChar *name; xmlChar *style; int position; - name = xmlGetProp (child, (xmlChar *)"name"); - position = egg_toolbars_model_add_toolbar (t, -1, (char *)name); + name = xmlGetProp (child, (const xmlChar*) "name"); + position = egg_toolbars_model_add_toolbar (t, -1, (const char*) name); xmlFree (name); - style = xmlGetProp (child, (xmlChar *)"style"); - if (style && xmlStrEqual (style, (xmlChar *)"icons-only")) + style = xmlGetProp (child, (const xmlChar*) "style"); + if (style && xmlStrEqual (style, (const xmlChar*) "icons-only")) { /* FIXME: use toolbar position instead of 0 */ - egg_toolbars_model_set_flags (t, 0, EGG_TB_MODEL_ICONS_ONLY); + egg_toolbars_model_set_flags (t, 0, EGG_TB_MODEL_ICONS); } xmlFree (style); diff --git a/cut-n-paste/toolbar-editor/egg-toolbars-model.h b/cut-n-paste/toolbar-editor/egg-toolbars-model.h index 11d9bbe8..aaaa2140 100644 --- a/cut-n-paste/toolbar-editor/egg-toolbars-model.h +++ b/cut-n-paste/toolbar-editor/egg-toolbars-model.h @@ -14,6 +14,8 @@ * 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. + * + * $Id$ */ #ifndef EGG_TOOLBARS_MODEL_H @@ -25,7 +27,6 @@ G_BEGIN_DECLS - #define EGG_TYPE_TOOLBARS_MODEL (egg_toolbars_model_get_type ()) #define EGG_TOOLBARS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOOLBARS_MODEL, EggToolbarsModel)) #define EGG_TOOLBARS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TOOLBARS_MODEL, EggToolbarsModelClass)) @@ -42,10 +43,11 @@ typedef struct EggToolbarsModelClass EggToolbarsModelClass; typedef enum { EGG_TB_MODEL_NOT_REMOVABLE = 1 << 0, - EGG_TB_MODEL_ICONS_ONLY = 1 << 1, - EGG_TB_MODEL_TEXT_ONLY = 1 << 2, - EGG_TB_MODEL_ICONS_TEXT = 1 << 3, - EGG_TB_MODEL_ICONS_TEXT_HORIZ = 1 << 4, + EGG_TB_MODEL_BOTH = 1 << 1, + EGG_TB_MODEL_BOTH_HORIZ = 1 << 2, + EGG_TB_MODEL_ICONS = 1 << 3, + EGG_TB_MODEL_TEXT = 1 << 4, + EGG_TB_MODEL_STYLES_MASK = 0x1F, EGG_TB_MODEL_ACCEPT_ITEMS_ONLY = 1 << 5 } EggTbModelFlags; @@ -91,6 +93,7 @@ struct EggToolbarsModelClass const char *type); }; +GType egg_toolbars_model_flags_get_type (void); GType egg_toolbars_model_get_type (void); EggToolbarsModel *egg_toolbars_model_new (void); gboolean egg_toolbars_model_load (EggToolbarsModel *model, -- 2.43.5