aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-05-06 00:08:04 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-05-06 00:08:04 +0800
commit7457f676155191be13664f62ccbe2e1fcb184de4 (patch)
tree9016424e330af2cbda9c28872d178848d3da60e3
parent781a2569005c985af2ac82f329fc35d9e0e5d268 (diff)
downloadgsoc2013-epiphany-7457f676155191be13664f62ccbe2e1fcb184de4.tar
gsoc2013-epiphany-7457f676155191be13664f62ccbe2e1fcb184de4.tar.gz
gsoc2013-epiphany-7457f676155191be13664f62ccbe2e1fcb184de4.tar.bz2
gsoc2013-epiphany-7457f676155191be13664f62ccbe2e1fcb184de4.tar.lz
gsoc2013-epiphany-7457f676155191be13664f62ccbe2e1fcb184de4.tar.xz
gsoc2013-epiphany-7457f676155191be13664f62ccbe2e1fcb184de4.tar.zst
gsoc2013-epiphany-7457f676155191be13664f62ccbe2e1fcb184de4.zip
Update (removing toolbars with context menu works again).
2003-05-05 Marco Pesenti Gritti <marco@it.gnome.org> * lib/egg/egg-editable-toolbar.c: * lib/egg/egg-toolbar-editor.c: * lib/egg/egg-toolbar-editor.h: * lib/egg/egg-toolbars-model.c: * lib/egg/egg-toolbars-model.h: Update (removing toolbars with context menu works again). * src/window-commands.c: (toolbar_editor_help_cb), (window_cmd_edit_toolbar): Build the tbe dialog, update for new egg api. Fix position of new toolbars to be before bookmarks toolbar.
-rw-r--r--ChangeLog16
-rwxr-xr-xlib/egg/egg-editable-toolbar.c4
-rwxr-xr-xlib/egg/egg-toolbar-editor.c66
-rwxr-xr-xlib/egg/egg-toolbar-editor.h9
-rwxr-xr-xlib/egg/egg-toolbars-model.c14
-rwxr-xr-xlib/egg/egg-toolbars-model.h1
-rw-r--r--src/window-commands.c58
7 files changed, 80 insertions, 88 deletions
diff --git a/ChangeLog b/ChangeLog
index ea21e1c06..f4f037c8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-05-05 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/egg/egg-editable-toolbar.c:
+ * lib/egg/egg-toolbar-editor.c:
+ * lib/egg/egg-toolbar-editor.h:
+ * lib/egg/egg-toolbars-model.c:
+ * lib/egg/egg-toolbars-model.h:
+
+ Update (removing toolbars with context menu works again).
+
+ * src/window-commands.c: (toolbar_editor_help_cb),
+ (window_cmd_edit_toolbar):
+
+ Build the tbe dialog, update for new egg api.
+ Fix position of new toolbars to be before bookmarks toolbar.
+
2003-05-02 Jon Svendsen <jon-sven@frisurf.no>
* src/ephy-history-window.c: (cmd_clear), (cmd_close),
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 174b775fe..bf32c54ff 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -279,8 +279,6 @@ popup_toolbar_context_menu_cb (GtkWidget *toolbar,
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
-
- t->priv->selected_toolbar = NULL;
}
}
@@ -378,7 +376,7 @@ toolbar_added_cb (EggToolbarsModel *model,
gtk_widget_set_size_request (toolbar, -1, MIN_TOOLBAR_HEIGHT);
gtk_box_pack_start (GTK_BOX (t), toolbar, FALSE, FALSE, 0);
- /* FIXME reorder to match position */
+ gtk_box_reorder_child (GTK_BOX (t), toolbar, position);
}
static void
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c
index fd032cdd6..a373b520c 100755
--- a/lib/egg/egg-toolbar-editor.c
+++ b/lib/egg/egg-toolbar-editor.c
@@ -40,11 +40,6 @@ static void update_editor_sheet (EggToolbarEditor *editor);
enum
{
- RESPONSE_ADD_TOOLBAR
-};
-
-enum
-{
PROP_0,
PROP_MENU_MERGE,
PROP_TOOLBARS_MODEL
@@ -83,7 +78,7 @@ egg_toolbar_editor_get_type (void)
(GInstanceInitFunc) egg_toolbar_editor_init
};
- egg_toolbar_editor_type = g_type_register_static (GTK_TYPE_DIALOG,
+ egg_toolbar_editor_type = g_type_register_static (GTK_TYPE_VBOX,
"EggToolbarEditor",
&our_info, 0);
}
@@ -211,8 +206,7 @@ egg_toolbar_editor_finalize (GObject *object)
}
GtkWidget *
-egg_toolbar_editor_new (GtkWindow *parent,
- EggMenuMerge *merge,
+egg_toolbar_editor_new (EggMenuMerge *merge,
EggToolbarsModel *model)
{
EggToolbarEditor *t;
@@ -221,10 +215,6 @@ egg_toolbar_editor_new (GtkWindow *parent,
"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);
@@ -302,37 +292,6 @@ drag_data_get_cb (GtkWidget *widget,
selection_data->target, 8, target, strlen (target));
}
-static void
-editor_close (EggToolbarEditor *editor)
-{
- g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor));
- gtk_widget_destroy (GTK_WIDGET (editor));
-}
-
-static void
-editor_add_toolbar (EggToolbarEditor *editor)
-{
- g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor));
-
- egg_toolbars_model_add_toolbar (editor->priv->model, "UserCreated");
-}
-
-static void
-dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- EggToolbarEditor *editor)
-{
- switch (response_id)
- {
- case RESPONSE_ADD_TOOLBAR:
- editor_add_toolbar (editor);
- break;
- case GTK_RESPONSE_CLOSE:
- editor_close (editor);
- break;
- }
-}
-
static gchar *
elide_underscores (const gchar *original)
{
@@ -475,29 +434,22 @@ static void
setup_editor (EggToolbarEditor *editor)
{
GtkWidget *scrolled_window;
- GtkWidget *vbox;
GtkWidget *label_hbox;
GtkWidget *image;
GtkWidget *label;
g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor));
- gtk_dialog_set_has_separator (GTK_DIALOG (editor), FALSE);
- gtk_window_set_title (GTK_WINDOW (editor), "Toolbar editor");
-
- vbox = gtk_vbox_new (FALSE, 12);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
- gtk_widget_show (vbox);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (editor)->vbox), vbox);
+ gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
editor->priv->scrolled_window = scrolled_window;
gtk_widget_show (scrolled_window);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
+ 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 (vbox), label_hbox, FALSE, FALSE, 0);
+ 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);
@@ -507,14 +459,6 @@ setup_editor (EggToolbarEditor *editor)
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);
-
- gtk_dialog_add_button (GTK_DIALOG (editor),
- _("_Add a New Toolbar"), RESPONSE_ADD_TOOLBAR);
- gtk_dialog_add_button (GTK_DIALOG (editor),
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
-
- g_signal_connect (editor, "response",
- G_CALLBACK (dialog_response_cb), editor);
}
static void
diff --git a/lib/egg/egg-toolbar-editor.h b/lib/egg/egg-toolbar-editor.h
index 6c6861153..b351fcb89 100755
--- a/lib/egg/egg-toolbar-editor.h
+++ b/lib/egg/egg-toolbar-editor.h
@@ -19,7 +19,7 @@
#ifndef EGG_TOOLBAR_EDITOR_H
#define EGG_TOOLBAR_EDITOR_H
-#include <gtk/gtkdialog.h>
+#include <gtk/gtkvbox.h>
#include "egg-menu-merge.h"
#include "egg-toolbars-model.h"
@@ -41,19 +41,18 @@ typedef struct EggToolbarEditorPrivate EggToolbarEditorPrivate;
struct EggToolbarEditor
{
- GtkDialog parent_object;
+ GtkVBox parent_object;
EggToolbarEditorPrivate *priv;
};
struct EggToolbarEditorClass
{
- GtkDialogClass parent_class;
+ GtkVBoxClass parent_class;
};
GType egg_toolbar_editor_get_type (void);
-GtkWidget *egg_toolbar_editor_new (GtkWindow *parent,
- EggMenuMerge *merge,
+GtkWidget *egg_toolbar_editor_new (EggMenuMerge *merge,
EggToolbarsModel *model);
void egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
const char *xml_file);
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c
index e2a8ce9fb..94a89ba27 100755
--- a/lib/egg/egg-toolbars-model.c
+++ b/lib/egg/egg-toolbars-model.c
@@ -299,16 +299,22 @@ parse_item_list (EggToolbarsModel *t,
}
int
-egg_toolbars_model_add_toolbar (EggToolbarsModel *t, const char *name)
+egg_toolbars_model_add_toolbar (EggToolbarsModel *t,
+ int position,
+ const char *name)
{
GNode *node;
+ int real_position;
g_return_val_if_fail (IS_EGG_TOOLBARS_MODEL (t), -1);
node = g_node_new (toolbars_toolbar_new (name));
- g_node_insert (t->priv->toolbars, -1, node);
+ g_node_insert (t->priv->toolbars, position, node);
+
+ real_position = g_node_child_position (t->priv->toolbars, node);
- g_signal_emit (G_OBJECT (t), egg_toolbars_model_signals[TOOLBAR_ADDED], 0);
+ g_signal_emit (G_OBJECT (t), egg_toolbars_model_signals[TOOLBAR_ADDED],
+ 0, real_position);
return g_node_child_position (t->priv->toolbars, node);
}
@@ -325,7 +331,7 @@ parse_toolbars (EggToolbarsModel *t,
int position;
name = xmlGetProp (child, "name");
- position = egg_toolbars_model_add_toolbar (t, name);
+ position = egg_toolbars_model_add_toolbar (t, -1, name);
xmlFree (name);
parse_item_list (t, child->children, position);
diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h
index 4d0e82937..1440468fc 100755
--- a/lib/egg/egg-toolbars-model.h
+++ b/lib/egg/egg-toolbars-model.h
@@ -80,6 +80,7 @@ void egg_toolbars_model_load (EggToolbarsModel *t,
void egg_toolbars_model_save (EggToolbarsModel *t,
const char *xml_file);
int egg_toolbars_model_add_toolbar (EggToolbarsModel *t,
+ int position,
const char *name);
EggTbModelFlags egg_toolbars_model_get_flags (EggToolbarsModel *t,
int toolbar_position);
diff --git a/src/window-commands.c b/src/window-commands.c
index 12986e71e..22e1ef568 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -52,6 +52,11 @@
#include <gtk/gtkmessagedialog.h>
#include <gtk/gtkeditable.h>
+enum
+{
+ RESPONSE_ADD_TOOLBAR
+};
+
void
window_cmd_edit_find (EggAction *action,
EphyWindow *window)
@@ -658,12 +663,23 @@ toolbar_editor_destroy_cb (GtkWidget *tbe,
static void
toolbar_editor_help_cb (GtkDialog *dialog,
- gint response_id,
- EggToolbarEditor *editor)
+ gint response_id,
+ gpointer data)
{
+ EphyToolbarsModel *model;
+ int n;
+
switch (response_id)
{
- case GTK_RESPONSE_HELP:
+ case GTK_RESPONSE_CLOSE:
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ case RESPONSE_ADD_TOOLBAR:
+ model = ephy_shell_get_toolbars_model (ephy_shell);
+ n = egg_toolbars_model_n_toolbars (EGG_TOOLBARS_MODEL (model));
+ egg_toolbars_model_add_toolbar (EGG_TOOLBARS_MODEL (model),
+ n - 1, "UserCreated");
+ break;
+ case GTK_RESPONSE_HELP:
/* FIXME: Connect toolbar editor help */
break;
}
@@ -676,29 +692,41 @@ window_cmd_edit_toolbar (EggAction *action,
GtkWidget *editor;
EphyToolbarsModel *model;
Toolbar *t;
+ GtkWidget *dialog;
model = ephy_shell_get_toolbars_model (ephy_shell);
t = ephy_window_get_toolbar (window);
+ dialog = gtk_dialog_new ();
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Toolbar editor"));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (window));
+
editor = egg_toolbar_editor_new
- (GTK_WINDOW (window),
- EGG_MENU_MERGE (window->ui_merge),
+ (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);
+ egg_toolbar_editor_load_actions (EGG_TOOLBAR_EDITOR (editor),
+ ephy_file ("epiphany-toolbar.xml"));
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), editor);
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);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Add a New Toolbar"), RESPONSE_ADD_TOOLBAR);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_HELP, GTK_RESPONSE_HELP);
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (toolbar_editor_help_cb), NULL);
+ ephy_state_add_window (dialog,
+ "toolbar_editor",
+ 500, 330);
+ gtk_widget_show (dialog);
+
egg_editable_toolbar_set_edit_mode (EGG_EDITABLE_TOOLBAR (t), TRUE);
}