aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCrispin Flowerday <gnome@flowerday.cx>2004-04-03 06:41:41 +0800
committerCrispin Flowerday <crispin@src.gnome.org>2004-04-03 06:41:41 +0800
commit76b869d6e0ff46160db9175408c3a0a0ea138bea (patch)
tree281074e43251b3707eeabe416ca42d371826a27b
parent1d907809af0cd53713c8e8891e686acaa104ad8f (diff)
downloadgsoc2013-epiphany-76b869d6e0ff46160db9175408c3a0a0ea138bea.tar.gz
gsoc2013-epiphany-76b869d6e0ff46160db9175408c3a0a0ea138bea.tar.zst
gsoc2013-epiphany-76b869d6e0ff46160db9175408c3a0a0ea138bea.zip
Synchronise changes from galeon, this fixes simple usage, stops crashes
2004-04-03 Crispin Flowerday <gnome@flowerday.cx> * lib/egg/egg-editable-toolbar.c: (set_fixed_style), (unset_fixed_style), (toolbar_changed_cb), (unparent_fixed), (update_fixed), (toolbars_clean), (egg_editable_toolbar_construct), (egg_editable_toolbar_set_model): * lib/egg/egg-toolbar-editor.c: (egg_toolbar_editor_load_actions): * lib/egg/egg-toolbars-model.h: Synchronise changes from galeon, this fixes simple usage, stops crashes when dragging items to and from other applications, and adds the ability to override the toolbar style.
-rw-r--r--ChangeLog13
-rwxr-xr-xlib/egg/egg-editable-toolbar.c50
-rwxr-xr-xlib/egg/egg-toolbar-editor.c5
-rwxr-xr-xlib/egg/egg-toolbars-model.h5
4 files changed, 57 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a86fd5fd..344df0d11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-04-03 Crispin Flowerday <gnome@flowerday.cx>
+
+ * lib/egg/egg-editable-toolbar.c: (set_fixed_style),
+ (unset_fixed_style), (toolbar_changed_cb), (unparent_fixed),
+ (update_fixed), (toolbars_clean), (egg_editable_toolbar_construct),
+ (egg_editable_toolbar_set_model):
+ * lib/egg/egg-toolbar-editor.c: (egg_toolbar_editor_load_actions):
+ * lib/egg/egg-toolbars-model.h:
+
+ Synchronise changes from galeon, this fixes simple usage, stops
+ crashes when dragging items to and from other applications, and
+ adds the ability to override the toolbar style.
+
2004-04-03 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-notebook.c: (notebook_drag_data_received_cb):
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 57c2681a8..b9eb0e840 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -48,12 +48,12 @@ static void egg_editable_toolbar_finalize (GObject *object);
#define MIN_TOOLBAR_HEIGHT 20
static GtkTargetEntry source_drag_types[] = {
- {EGG_TOOLBAR_ITEM_TYPE, 0, 0},
+ {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0},
};
static int n_source_drag_types = G_N_ELEMENTS (source_drag_types);
static GtkTargetEntry dest_drag_types[] = {
- {EGG_TOOLBAR_ITEM_TYPE, 0, 0},
+ {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0},
};
static int n_dest_drag_types = G_N_ELEMENTS (dest_drag_types);
@@ -672,12 +672,14 @@ create_dock (EggEditableToolbar *t)
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);
}
static void
unset_fixed_style (EggEditableToolbar *t)
{
+ g_return_if_fail (GTK_IS_TOOLBAR (t->priv->fixed_toolbar));
gtk_toolbar_unset_style (GTK_TOOLBAR (t->priv->fixed_toolbar));
}
@@ -688,32 +690,49 @@ toolbar_changed_cb (EggToolbarsModel *model,
{
GtkWidget *toolbar;
EggTbModelFlags flags;
+ GtkToolbarStyle style;
flags = egg_toolbars_model_get_flags (model, position);
toolbar = get_toolbar_nth (t, position);
if (flags & EGG_TB_MODEL_ICONS_ONLY)
{
- gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
- if (position == 0)
- {
- set_fixed_style (t, GTK_TOOLBAR_ICONS);
- }
+ style = GTK_TOOLBAR_ICONS;
+ }
+ else if (flags & EGG_TB_MODEL_TEXT_ONLY)
+ {
+ style = GTK_TOOLBAR_TEXT;
+ }
+ else if (flags & EGG_TB_MODEL_ICONS_TEXT)
+ {
+ style = GTK_TOOLBAR_BOTH;
+ }
+ else if (flags & EGG_TB_MODEL_ICONS_TEXT_HORIZ)
+ {
+ style = GTK_TOOLBAR_BOTH_HORIZ;
}
else
{
gtk_toolbar_unset_style (GTK_TOOLBAR (toolbar));
- if (position == 0)
+ if (position == 0 && t->priv->fixed_toolbar)
{
unset_fixed_style (t);
}
+ return;
}
+
+ gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), style);
+ if (position == 0 && t->priv->fixed_toolbar)
+ {
+ set_fixed_style (t, style);
+ }
}
static void
unparent_fixed (EggEditableToolbar *t)
{
GtkWidget *toolbar, *dock;
+ g_return_if_fail (GTK_IS_TOOLBAR (t->priv->fixed_toolbar));
toolbar = t->priv->fixed_toolbar;
dock = get_dock_nth (t, 0);
@@ -728,6 +747,7 @@ static void
update_fixed (EggEditableToolbar *t)
{
GtkWidget *toolbar, *dock;
+ if (!t->priv->fixed_toolbar) return;
toolbar = t->priv->fixed_toolbar;
dock = get_dock_nth (t, 0);
@@ -826,8 +846,11 @@ toolbars_clean (EggEditableToolbar *t)
{
GList *children, *l;
- unset_fixed_style (t);
- unparent_fixed (t);
+ if (t->priv->fixed_toolbar)
+ {
+ unset_fixed_style (t);
+ unparent_fixed (t);
+ }
children = gtk_container_get_children (GTK_CONTAINER (t));
@@ -862,7 +885,7 @@ egg_editable_toolbar_construct (EggEditableToolbar *t)
if (flags & EGG_TB_MODEL_ICONS_ONLY)
{
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
- if (i == 0)
+ if (i == 0 && t->priv->fixed_toolbar)
{
set_fixed_style (t, GTK_TOOLBAR_ICONS);
}
@@ -930,7 +953,10 @@ egg_editable_toolbar_set_model (EggEditableToolbar *t,
t->priv->model = g_object_ref (model);
toolbars_clean (t);
- egg_editable_toolbar_construct (t);
+ if (t->priv->merge != NULL)
+ {
+ egg_editable_toolbar_construct (t);
+ }
g_signal_connect_object (model, "item_added",
G_CALLBACK (item_added_cb), t, 0);
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c
index 991f4843b..34cbd6b48 100755
--- a/lib/egg/egg-toolbar-editor.c
+++ b/lib/egg/egg-toolbar-editor.c
@@ -34,12 +34,12 @@
#include <gtk/gtkhbox.h>
static GtkTargetEntry dest_drag_types[] = {
- {EGG_TOOLBAR_ITEM_TYPE, 0, 0},
+ {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[] = {
- {EGG_TOOLBAR_ITEM_TYPE, 0, 0},
+ {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0},
};
static int n_source_drag_types = G_N_ELEMENTS (source_drag_types);
@@ -694,7 +694,6 @@ egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
xmlDocPtr doc;
xmlNodePtr root;
xmlNodePtr child;
- GList *l;
doc = xmlParseFile (xml_file);
root = xmlDocGetRootElement (doc);
diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h
index 07146cb38..1f5451585 100755
--- a/lib/egg/egg-toolbars-model.h
+++ b/lib/egg/egg-toolbars-model.h
@@ -42,7 +42,10 @@ typedef struct EggToolbarsModelPrivate EggToolbarsModelPrivate;
typedef enum
{
EGG_TB_MODEL_NOT_REMOVABLE = 1 << 0,
- EGG_TB_MODEL_ICONS_ONLY = 1 << 1
+ 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,
} EggTbModelFlags;
struct EggToolbarsModel