aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Bordoley <bordoley@msu.edu>2003-04-27 16:35:50 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-27 16:35:50 +0800
commit34c164d7175456a25362d00981d1cc38a339baf2 (patch)
tree1e2bf50d082477e4b60d859eeffb52efb9e2eb30 /lib
parent9605e12bd4a9238f989e6f1c662781b848555cac (diff)
downloadgsoc2013-epiphany-34c164d7175456a25362d00981d1cc38a339baf2.tar
gsoc2013-epiphany-34c164d7175456a25362d00981d1cc38a339baf2.tar.gz
gsoc2013-epiphany-34c164d7175456a25362d00981d1cc38a339baf2.tar.bz2
gsoc2013-epiphany-34c164d7175456a25362d00981d1cc38a339baf2.tar.lz
gsoc2013-epiphany-34c164d7175456a25362d00981d1cc38a339baf2.tar.xz
gsoc2013-epiphany-34c164d7175456a25362d00981d1cc38a339baf2.tar.zst
gsoc2013-epiphany-34c164d7175456a25362d00981d1cc38a339baf2.zip
Update.
2003-04-27 David Bordoley <bordoley@msu.edu> * lib/egg/egg-editable-toolbar.c: * lib/egg/egg-toolbar-editor.c: * lib/egg/egg-toolbar-editor.h: Update. * src/window-commands.c: (toolbar_editor_help_cb), (window_cmd_edit_toolbar): Add and help button.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/egg/egg-editable-toolbar.c38
-rwxr-xr-xlib/egg/egg-toolbar-editor.c9
-rwxr-xr-xlib/egg/egg-toolbar-editor.h4
3 files changed, 32 insertions, 19 deletions
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index a877eb96e..ff7b78266 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -53,6 +53,7 @@ struct EggEditableToolbarPrivate
EggMenuMerge *merge;
EggToolbarsModel *model;
gboolean edit_mode;
+ GtkWidget *selected_toolbar;
};
GType
@@ -223,12 +224,12 @@ drag_data_get_cb (GtkWidget *widget,
}
static void
-remove_toolbar_cb (GtkWidget *toolbar,
+remove_toolbar_cb (GtkWidget *menuitem,
EggEditableToolbar *etoolbar)
{
int pos;
- pos = get_toolbar_position (etoolbar, toolbar);
+ pos = get_toolbar_position (etoolbar, etoolbar->priv->selected_toolbar);
egg_toolbars_model_remove_toolbar (etoolbar->priv->model, pos);
}
@@ -240,20 +241,25 @@ popup_toolbar_context_menu_cb (GtkWidget *toolbar,
GtkWidget *item;
GtkWidget *image;
- menu = gtk_menu_new ();
-
- item = gtk_image_menu_item_new_with_mnemonic (_("_Remove Toolbar"));
- gtk_widget_show (item);
- image = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
- gtk_widget_show (image);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- g_signal_connect (item, "activate",
- G_CALLBACK (remove_toolbar_cb),
- t);
-
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 2,
- gtk_get_current_event_time ());
+ if (t->priv->edit_mode)
+ {
+ t->priv->selected_toolbar = toolbar;
+
+ menu = gtk_menu_new ();
+
+ item = gtk_image_menu_item_new_with_mnemonic (_("_Remove Toolbar"));
+ gtk_widget_show (item);
+ image = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ g_signal_connect (item, "activate",
+ G_CALLBACK (remove_toolbar_cb),
+ t);
+
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 2,
+ gtk_get_current_event_time ());
+ }
}
static GtkWidget *
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c
index 8993d4042..b957875ad 100755
--- a/lib/egg/egg-toolbar-editor.c
+++ b/lib/egg/egg-toolbar-editor.c
@@ -210,7 +210,8 @@ egg_toolbar_editor_finalize (GObject *object)
}
GtkWidget *
-egg_toolbar_editor_new (EggMenuMerge *merge,
+egg_toolbar_editor_new (GtkWindow *parent,
+ EggMenuMerge *merge,
EggToolbarsModel *model)
{
EggToolbarEditor *t;
@@ -219,6 +220,10 @@ egg_toolbar_editor_new (EggMenuMerge *merge,
"MenuMerge", merge,
"ToolbarsModel", model,
NULL));
+ if (parent != NULL)
+ {
+ gtk_window_set_transient_for (GTK_WINDOW (t), parent);
+ }
g_return_val_if_fail (t->priv != NULL, NULL);
@@ -535,7 +540,7 @@ parse_item_list (EggToolbarEditor *t,
}
}
-gboolean
+static gboolean
model_has_action (EggToolbarsModel *model, EggAction *action)
{
int i, l, n_items, n_toolbars;
diff --git a/lib/egg/egg-toolbar-editor.h b/lib/egg/egg-toolbar-editor.h
index 71cdfe31e..6c6861153 100755
--- a/lib/egg/egg-toolbar-editor.h
+++ b/lib/egg/egg-toolbar-editor.h
@@ -50,8 +50,10 @@ struct EggToolbarEditorClass
GtkDialogClass parent_class;
};
+
GType egg_toolbar_editor_get_type (void);
-GtkWidget *egg_toolbar_editor_new (EggMenuMerge *merge,
+GtkWidget *egg_toolbar_editor_new (GtkWindow *parent,
+ EggMenuMerge *merge,
EggToolbarsModel *model);
void egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
const char *xml_file);