aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--ChangeLog13
-rwxr-xr-xlib/egg/egg-editable-toolbar.c38
-rwxr-xr-xlib/egg/egg-toolbar-editor.c9
-rwxr-xr-xlib/egg/egg-toolbar-editor.h4
-rw-r--r--src/window-commands.c21
5 files changed, 65 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 00483de26..30773c4dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+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.
+
2003-04-26 Xan Lopez <xan@masilla.org>
* src/window-commands.c: (window_cmd_help_about):
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);
diff --git a/src/window-commands.c b/src/window-commands.c
index 04eb2bebb..b6cf9e90e 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -651,6 +651,19 @@ toolbar_editor_destroy_cb (GtkWidget *tbe,
egg_editable_toolbar_set_edit_mode (EGG_EDITABLE_TOOLBAR (t), FALSE);
}
+static void
+toolbar_editor_help_cb (GtkDialog *dialog,
+ gint response_id,
+ EggToolbarEditor *editor)
+{
+ switch (response_id)
+ {
+ case GTK_RESPONSE_HELP:
+ /* FIXME: Connect toolbar editor help */
+ break;
+ }
+}
+
void
window_cmd_edit_toolbar (EggAction *action,
EphyWindow *window)
@@ -663,14 +676,20 @@ window_cmd_edit_toolbar (EggAction *action,
t = ephy_window_get_toolbar (window);
editor = egg_toolbar_editor_new
- (EGG_MENU_MERGE (window->ui_merge),
+ (GTK_WINDOW (window),
+ EGG_MENU_MERGE (window->ui_merge),
EGG_TOOLBARS_MODEL (model));
+ gtk_dialog_add_button (GTK_DIALOG (editor),
+ GTK_STOCK_HELP, GTK_RESPONSE_HELP);
ephy_state_add_window (editor,
"toolbar_editor",
500, 330);
g_signal_connect (editor, "destroy",
G_CALLBACK (toolbar_editor_destroy_cb),
t);
+ g_signal_connect (G_OBJECT (editor), "response",
+ G_CALLBACK (toolbar_editor_help_cb),
+ editor);
egg_toolbar_editor_load_actions (EGG_TOOLBAR_EDITOR (editor),
ephy_file ("epiphany-toolbar.xml"));
gtk_widget_show (editor);