[gtranslator] Update toolbar editor.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Update toolbar editor.
- Date: Fri, 9 Apr 2010 15:51:03 +0000 (UTC)
commit a064768fb135828eab1bffd70d2b0fe6e84677fc
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Fri Apr 9 17:50:42 2010 +0200
Update toolbar editor.
src/toolbareditor/egg-editable-toolbar.c | 852 +++++++++++++++---------------
src/toolbareditor/egg-editable-toolbar.h | 71 ++--
src/toolbareditor/egg-toolbar-editor.c | 216 ++++----
src/toolbareditor/egg-toolbar-editor.h | 17 +-
src/toolbareditor/egg-toolbars-model.c | 592 +++++++++++-----------
src/toolbareditor/egg-toolbars-model.h | 181 ++++---
6 files changed, 970 insertions(+), 959 deletions(-)
---
diff --git a/src/toolbareditor/egg-editable-toolbar.c b/src/toolbareditor/egg-editable-toolbar.c
index c6042a2..ca6534c 100644
--- a/src/toolbareditor/egg-editable-toolbar.c
+++ b/src/toolbareditor/egg-editable-toolbar.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: egg-editable-toolbar.c 937 2009-04-07 11:16:53Z friemann $
+ * $Id$
*/
#include "config.h"
@@ -29,7 +29,7 @@
#include <glib/gi18n.h>
#include <string.h>
-static GdkPixbuf *new_separator_pixbuf (void);
+static GdkPixbuf * new_separator_pixbuf (void);
#define MIN_TOOLBAR_HEIGHT 20
#define EGG_ITEM_NAME "egg-item-name"
@@ -76,15 +76,16 @@ struct _EggEditableToolbarPrivate
char *popup_path;
- guint dnd_pending;
- GtkToolbar *dnd_toolbar;
+ guint dnd_pending;
+ GtkToolbar *dnd_toolbar;
GtkToolItem *dnd_toolitem;
};
G_DEFINE_TYPE (EggEditableToolbar, egg_editable_toolbar, GTK_TYPE_VBOX);
static int
-get_dock_position (EggEditableToolbar * etoolbar, GtkWidget * dock)
+get_dock_position (EggEditableToolbar *etoolbar,
+ GtkWidget *dock)
{
GList *l;
int result;
@@ -97,13 +98,13 @@ get_dock_position (EggEditableToolbar * etoolbar, GtkWidget * dock)
}
static int
-get_toolbar_position (EggEditableToolbar * etoolbar, GtkWidget * toolbar)
+get_toolbar_position (EggEditableToolbar *etoolbar, GtkWidget *toolbar)
{
return get_dock_position (etoolbar, toolbar->parent);
}
static int
-get_n_toolbars (EggEditableToolbar * etoolbar)
+get_n_toolbars (EggEditableToolbar *etoolbar)
{
GList *l;
int result;
@@ -116,7 +117,8 @@ get_n_toolbars (EggEditableToolbar * etoolbar)
}
static GtkWidget *
-get_dock_nth (EggEditableToolbar * etoolbar, int position)
+get_dock_nth (EggEditableToolbar *etoolbar,
+ int position)
{
GList *l;
GtkWidget *result;
@@ -129,7 +131,8 @@ get_dock_nth (EggEditableToolbar * etoolbar, int position)
}
static GtkWidget *
-get_toolbar_nth (EggEditableToolbar * etoolbar, int position)
+get_toolbar_nth (EggEditableToolbar *etoolbar,
+ int position)
{
GList *l;
GtkWidget *dock;
@@ -146,7 +149,8 @@ get_toolbar_nth (EggEditableToolbar * etoolbar, int position)
}
static GtkAction *
-find_action (EggEditableToolbar * etoolbar, const char *name)
+find_action (EggEditableToolbar *etoolbar,
+ const char *name)
{
GList *l;
GtkAction *action = NULL;
@@ -161,15 +165,16 @@ find_action (EggEditableToolbar * etoolbar, const char *name)
tmp = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name);
if (tmp)
- action = tmp;
+ action = tmp;
}
return action;
}
static void
-drag_data_delete_cb (GtkWidget * widget,
- GdkDragContext * context, EggEditableToolbar * etoolbar)
+drag_data_delete_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ EggEditableToolbar *etoolbar)
{
int pos, toolbar_pos;
@@ -178,15 +183,17 @@ drag_data_delete_cb (GtkWidget * widget,
g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (etoolbar));
pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (widget->parent),
- GTK_TOOL_ITEM (widget));
+ GTK_TOOL_ITEM (widget));
toolbar_pos = get_toolbar_position (etoolbar, widget->parent);
- egg_toolbars_model_remove_item (etoolbar->priv->model, toolbar_pos, pos);
+ egg_toolbars_model_remove_item (etoolbar->priv->model,
+ toolbar_pos, pos);
}
static void
-drag_begin_cb (GtkWidget * widget,
- GdkDragContext * context, EggEditableToolbar * etoolbar)
+drag_begin_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ EggEditableToolbar *etoolbar)
{
GtkAction *action;
gint flags;
@@ -199,22 +206,23 @@ drag_begin_cb (GtkWidget * widget,
action = gtk_widget_get_action (widget);
#endif
- if (action == NULL)
- return;
+ if (action == NULL) return;
flags = egg_toolbars_model_get_name_flags (etoolbar->priv->model,
- gtk_action_get_name (action));
+ gtk_action_get_name (action));
if (!(flags & EGG_TB_MODEL_NAME_INFINITE))
{
flags &= ~EGG_TB_MODEL_NAME_USED;
egg_toolbars_model_set_name_flags (etoolbar->priv->model,
- gtk_action_get_name (action), flags);
+ gtk_action_get_name (action),
+ flags);
}
}
static void
-drag_end_cb (GtkWidget * widget,
- GdkDragContext * context, EggEditableToolbar * etoolbar)
+drag_end_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ EggEditableToolbar *etoolbar)
{
GtkAction *action;
gint flags;
@@ -229,27 +237,27 @@ drag_end_cb (GtkWidget * widget,
action = gtk_widget_get_action (widget);
#endif
- if (action == NULL)
- return;
+ if (action == NULL) return;
flags = egg_toolbars_model_get_name_flags (etoolbar->priv->model,
- gtk_action_get_name
- (action));
+ gtk_action_get_name (action));
if (!(flags & EGG_TB_MODEL_NAME_INFINITE))
{
- flags |= EGG_TB_MODEL_NAME_USED;
- egg_toolbars_model_set_name_flags (etoolbar->priv->model,
- gtk_action_get_name (action),
- flags);
- }
+ flags |= EGG_TB_MODEL_NAME_USED;
+ egg_toolbars_model_set_name_flags (etoolbar->priv->model,
+ gtk_action_get_name (action),
+ flags);
+ }
}
}
static void
-drag_data_get_cb (GtkWidget * widget,
- GdkDragContext * context,
- GtkSelectionData * selection_data,
- guint info, guint32 time, EggEditableToolbar * etoolbar)
+drag_data_get_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint32 time,
+ EggEditableToolbar *etoolbar)
{
EggToolbarsModel *model;
const char *name;
@@ -261,31 +269,26 @@ drag_data_get_cb (GtkWidget * widget,
name = g_object_get_data (G_OBJECT (widget), EGG_ITEM_NAME);
if (name == NULL)
{
- name =
- g_object_get_data (G_OBJECT (gtk_widget_get_parent (widget)),
- EGG_ITEM_NAME);
+ name = g_object_get_data (G_OBJECT (gtk_widget_get_parent (widget)), EGG_ITEM_NAME);
g_return_if_fail (name != NULL);
}
data = egg_toolbars_model_get_data (model, selection_data->target, name);
if (data != NULL)
{
- gtk_selection_data_set (selection_data, selection_data->target, 8,
- (unsigned char *) data, strlen (data));
+ gtk_selection_data_set (selection_data, selection_data->target, 8, (unsigned char *)data, strlen (data));
g_free (data);
}
}
static void
-move_item_cb (GtkAction * action, EggEditableToolbar * etoolbar)
+move_item_cb (GtkAction *action,
+ EggEditableToolbar *etoolbar)
{
- GtkWidget *toolitem =
- gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar),
- GTK_TYPE_TOOL_ITEM);
- GtkTargetList *list =
- gtk_target_list_new (dest_drag_types, G_N_ELEMENTS (dest_drag_types));
+ GtkWidget *toolitem = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar), GTK_TYPE_TOOL_ITEM);
+ GtkTargetList *list = gtk_target_list_new (dest_drag_types, G_N_ELEMENTS (dest_drag_types));
- GdkEvent *realevent = gtk_get_current_event ();
+ GdkEvent *realevent = gtk_get_current_event();
GdkEventMotion event;
event.type = GDK_MOTION_NOTIFY;
event.window = realevent->any.window;
@@ -296,23 +299,23 @@ move_item_cb (GtkAction * action, EggEditableToolbar * etoolbar)
gdk_event_get_coords (realevent, &event.x, &event.y);
gdk_event_get_root_coords (realevent, &event.x_root, &event.y_root);
- gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, (GdkEvent *) & event);
+ gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, (GdkEvent *)&event);
gtk_target_list_unref (list);
}
static void
-remove_item_cb (GtkAction * action, EggEditableToolbar * etoolbar)
+remove_item_cb (GtkAction *action,
+ EggEditableToolbar *etoolbar)
{
- GtkWidget *toolitem =
- gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar),
- GTK_TYPE_TOOL_ITEM);
+ GtkWidget *toolitem = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar), GTK_TYPE_TOOL_ITEM);
int pos, toolbar_pos;
toolbar_pos = get_toolbar_position (etoolbar, toolitem->parent);
pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolitem->parent),
- GTK_TOOL_ITEM (toolitem));
+ GTK_TOOL_ITEM (toolitem));
- egg_toolbars_model_remove_item (etoolbar->priv->model, toolbar_pos, pos);
+ egg_toolbars_model_remove_item (etoolbar->priv->model,
+ toolbar_pos, pos);
if (egg_toolbars_model_n_items (etoolbar->priv->model, toolbar_pos) == 0)
{
@@ -321,7 +324,8 @@ remove_item_cb (GtkAction * action, EggEditableToolbar * etoolbar)
}
static void
-remove_toolbar_cb (GtkAction * action, EggEditableToolbar * etoolbar)
+remove_toolbar_cb (GtkAction *action,
+ EggEditableToolbar *etoolbar)
{
GtkWidget *selected = egg_editable_toolbar_get_selected (etoolbar);
GtkWidget *toolbar = gtk_widget_get_ancestor (selected, GTK_TYPE_TOOLBAR);
@@ -332,17 +336,19 @@ remove_toolbar_cb (GtkAction * action, EggEditableToolbar * etoolbar)
}
static void
-popup_context_deactivate (GtkMenuShell * menu, EggEditableToolbar * etoolbar)
+popup_context_deactivate (GtkMenuShell *menu,
+ EggEditableToolbar *etoolbar)
{
egg_editable_toolbar_set_selected (etoolbar, NULL);
g_object_notify (G_OBJECT (etoolbar), "selected");
}
static void
-popup_context_menu_cb (GtkWidget * toolbar,
- gint x,
- gint y,
- gint button_number, EggEditableToolbar * etoolbar)
+popup_context_menu_cb (GtkWidget *toolbar,
+ gint x,
+ gint y,
+ gint button_number,
+ EggEditableToolbar *etoolbar)
{
if (etoolbar->priv->popup_path != NULL)
{
@@ -352,20 +358,19 @@ popup_context_menu_cb (GtkWidget * toolbar,
g_object_notify (G_OBJECT (etoolbar), "selected");
menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
- etoolbar->priv->
- popup_path));
+ etoolbar->priv->popup_path));
g_return_if_fail (menu != NULL);
- gtk_menu_popup (menu, NULL, NULL, NULL, NULL, button_number,
- gtk_get_current_event_time ());
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, button_number, gtk_get_current_event_time ());
g_signal_connect_object (menu, "selection-done",
- G_CALLBACK (popup_context_deactivate),
- etoolbar, 0);
+ G_CALLBACK (popup_context_deactivate),
+ etoolbar, 0);
}
}
static gboolean
-button_press_event_cb (GtkWidget * widget,
- GdkEventButton * event, EggEditableToolbar * etoolbar)
+button_press_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ EggEditableToolbar *etoolbar)
{
if (event->button == 3 && etoolbar->priv->popup_path != NULL)
{
@@ -375,14 +380,12 @@ button_press_event_cb (GtkWidget * widget,
g_object_notify (G_OBJECT (etoolbar), "selected");
menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
- etoolbar->priv->
- popup_path));
+ etoolbar->priv->popup_path));
g_return_val_if_fail (menu != NULL, FALSE);
- gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button,
- event->time);
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time);
g_signal_connect_object (menu, "selection-done",
- G_CALLBACK (popup_context_deactivate),
- etoolbar, 0);
+ G_CALLBACK (popup_context_deactivate),
+ etoolbar, 0);
return TRUE;
}
@@ -391,7 +394,7 @@ button_press_event_cb (GtkWidget * widget,
}
static void
-configure_item_sensitivity (GtkToolItem * item, EggEditableToolbar * etoolbar)
+configure_item_sensitivity (GtkToolItem *item, EggEditableToolbar *etoolbar)
{
GtkAction *action;
char *name;
@@ -405,13 +408,14 @@ configure_item_sensitivity (GtkToolItem * item, EggEditableToolbar * etoolbar)
}
gtk_tool_item_set_use_drag_window (item,
- (etoolbar->priv->edit_mode > 0) ||
- GTK_IS_SEPARATOR_TOOL_ITEM (item));
+ (etoolbar->priv->edit_mode > 0) ||
+ GTK_IS_SEPARATOR_TOOL_ITEM (item));
}
static void
-configure_item_cursor (GtkToolItem * item, EggEditableToolbar * etoolbar)
+configure_item_cursor (GtkToolItem *item,
+ EggEditableToolbar *etoolbar)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
GtkWidget *widget = GTK_WIDGET (item);
@@ -421,28 +425,26 @@ configure_item_cursor (GtkToolItem * item, EggEditableToolbar * etoolbar)
if (priv->edit_mode > 0)
{
GdkCursor *cursor;
- GdkScreen *screen;
+ GdkScreen *screen;
GdkPixbuf *pixbuf = NULL;
- screen = gtk_widget_get_screen (GTK_WIDGET (etoolbar));
+ screen = gtk_widget_get_screen (GTK_WIDGET (etoolbar));
- cursor =
- gdk_cursor_new_for_display (gdk_screen_get_display (screen),
- GDK_HAND2);
+ cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
+ GDK_HAND2);
gdk_window_set_cursor (widget->window, cursor);
gdk_cursor_unref (cursor);
gtk_drag_source_set (widget, GDK_BUTTON1_MASK, dest_drag_types,
- G_N_ELEMENTS (dest_drag_types),
- GDK_ACTION_MOVE);
+ G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE);
if (GTK_IS_SEPARATOR_TOOL_ITEM (item))
{
pixbuf = new_separator_pixbuf ();
}
else
{
- char *icon_name = NULL;
- char *stock_id = NULL;
+ char *icon_name=NULL;
+ char *stock_id=NULL;
GtkAction *action;
char *name;
@@ -451,9 +453,10 @@ configure_item_cursor (GtkToolItem * item, EggEditableToolbar * etoolbar)
if (action)
{
- g_object_get (action,
- "icon-name", &icon_name,
- "stock-id", &stock_id, NULL);
+ g_object_get (action,
+ "icon-name", &icon_name,
+ "stock-id", &stock_id,
+ NULL);
}
if (icon_name)
{
@@ -474,14 +477,12 @@ configure_item_cursor (GtkToolItem * item, EggEditableToolbar * etoolbar)
}
pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name,
- MIN (width, height), 0,
- NULL);
+ MIN (width, height), 0, NULL);
}
else if (stock_id)
{
pixbuf = gtk_widget_render_icon (widget, stock_id,
- GTK_ICON_SIZE_LARGE_TOOLBAR,
- NULL);
+ GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
}
g_free (icon_name);
g_free (stock_id);
@@ -497,14 +498,14 @@ configure_item_cursor (GtkToolItem * item, EggEditableToolbar * etoolbar)
}
else
{
- gdk_window_set_cursor (GTK_WIDGET (item)->window, NULL);
+ gdk_window_set_cursor (GTK_WIDGET(item)->window, NULL);
}
}
}
static void
-configure_item_tooltip (GtkToolItem * item)
+configure_item_tooltip (GtkToolItem *item)
{
GtkAction *action;
@@ -522,38 +523,43 @@ configure_item_tooltip (GtkToolItem * item)
static void
-connect_widget_signals (GtkWidget * proxy, EggEditableToolbar * etoolbar)
+connect_widget_signals (GtkWidget *proxy, EggEditableToolbar *etoolbar)
{
if (GTK_IS_CONTAINER (proxy))
{
- gtk_container_forall (GTK_CONTAINER (proxy),
- (GtkCallback) connect_widget_signals,
- (gpointer) etoolbar);
+ gtk_container_forall (GTK_CONTAINER (proxy),
+ (GtkCallback) connect_widget_signals,
+ (gpointer) etoolbar);
}
if (GTK_IS_TOOL_ITEM (proxy))
{
g_signal_connect_object (proxy, "drag_begin",
- G_CALLBACK (drag_begin_cb), etoolbar, 0);
+ G_CALLBACK (drag_begin_cb),
+ etoolbar, 0);
g_signal_connect_object (proxy, "drag_end",
- G_CALLBACK (drag_end_cb), etoolbar, 0);
+ G_CALLBACK (drag_end_cb),
+ etoolbar, 0);
g_signal_connect_object (proxy, "drag_data_get",
- G_CALLBACK (drag_data_get_cb), etoolbar, 0);
+ G_CALLBACK (drag_data_get_cb),
+ etoolbar, 0);
g_signal_connect_object (proxy, "drag_data_delete",
- G_CALLBACK (drag_data_delete_cb), etoolbar, 0);
+ G_CALLBACK (drag_data_delete_cb),
+ etoolbar, 0);
}
if (GTK_IS_BUTTON (proxy) || GTK_IS_TOOL_ITEM (proxy))
{
g_signal_connect_object (proxy, "button-press-event",
- G_CALLBACK (button_press_event_cb),
- etoolbar, 0);
+ G_CALLBACK (button_press_event_cb),
+ etoolbar, 0);
}
}
static void
-action_sensitive_cb (GtkAction * action,
- GParamSpec * pspec, GtkToolItem * item)
+action_sensitive_cb (GtkAction *action,
+ GParamSpec *pspec,
+ GtkToolItem *item)
{
EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR
(gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR));
@@ -565,7 +571,8 @@ action_sensitive_cb (GtkAction * action,
}
static GtkToolItem *
-create_item_from_action (EggEditableToolbar * etoolbar, const char *name)
+create_item_from_action (EggEditableToolbar *etoolbar,
+ const char *name)
{
GtkToolItem *item;
@@ -578,8 +585,7 @@ create_item_from_action (EggEditableToolbar * etoolbar, const char *name)
else
{
GtkAction *action = find_action (etoolbar, name);
- if (action == NULL)
- return NULL;
+ if (action == NULL) return NULL;
item = GTK_TOOL_ITEM (gtk_action_create_tool_item (action));
@@ -587,7 +593,7 @@ create_item_from_action (EggEditableToolbar * etoolbar, const char *name)
* such demand may have been made yet, so do it ourselves.
*/
gtk_action_set_accel_group
- (action, gtk_ui_manager_get_accel_group (etoolbar->priv->manager));
+ (action, gtk_ui_manager_get_accel_group(etoolbar->priv->manager));
g_signal_connect_object (action, "notify::sensitive",
G_CALLBACK (action_sensitive_cb), item, 0);
@@ -602,28 +608,28 @@ create_item_from_action (EggEditableToolbar * etoolbar, const char *name)
}
static GtkToolItem *
-create_item_from_position (EggEditableToolbar * etoolbar,
- int toolbar_position, int position)
+create_item_from_position (EggEditableToolbar *etoolbar,
+ int toolbar_position,
+ int position)
{
GtkToolItem *item;
const char *name;
- name =
- egg_toolbars_model_item_nth (etoolbar->priv->model, toolbar_position,
- position);
+ name = egg_toolbars_model_item_nth (etoolbar->priv->model, toolbar_position, position);
item = create_item_from_action (etoolbar, name);
return item;
}
static void
-toolbar_drag_data_received_cb (GtkToolbar * toolbar,
- GdkDragContext * context,
- gint x,
- gint y,
- GtkSelectionData * selection_data,
- guint info,
- guint time, EggEditableToolbar * etoolbar)
+toolbar_drag_data_received_cb (GtkToolbar *toolbar,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ EggEditableToolbar *etoolbar)
{
/* This function can be called for two reasons
*
@@ -637,7 +643,7 @@ toolbar_drag_data_received_cb (GtkToolbar * toolbar,
*/
GdkAtom type = selection_data->type;
- const char *data = (char *) selection_data->data;
+ const char *data = (char *)selection_data->data;
int ipos = -1;
char *name = NULL;
@@ -647,14 +653,10 @@ toolbar_drag_data_received_cb (GtkToolbar * toolbar,
if (selection_data->length >= 0)
{
ipos = gtk_toolbar_get_drop_index (toolbar, x, y);
- name =
- egg_toolbars_model_get_name (etoolbar->priv->model, type, data,
- FALSE);
+ name = egg_toolbars_model_get_name (etoolbar->priv->model, type, data, FALSE);
if (name != NULL)
- {
- used =
- ((egg_toolbars_model_get_name_flags (etoolbar->priv->model, name)
- & EGG_TB_MODEL_NAME_USED) != 0);
+ {
+ used = ((egg_toolbars_model_get_name_flags (etoolbar->priv->model, name) & EGG_TB_MODEL_NAME_USED) != 0);
}
}
@@ -665,11 +667,9 @@ toolbar_drag_data_received_cb (GtkToolbar * toolbar,
if (name != NULL && etoolbar->priv->dnd_toolbar == toolbar && !used)
{
- etoolbar->priv->dnd_toolitem =
- create_item_from_action (etoolbar, name);
+ etoolbar->priv->dnd_toolitem = create_item_from_action (etoolbar, name);
gtk_toolbar_set_drop_highlight_item (etoolbar->priv->dnd_toolbar,
- etoolbar->priv->dnd_toolitem,
- ipos);
+ etoolbar->priv->dnd_toolitem, ipos);
}
}
else
@@ -681,23 +681,18 @@ toolbar_drag_data_received_cb (GtkToolbar * toolbar,
/* If we don't have a name to use yet, try to create one. */
if (name == NULL && selection_data->length >= 0)
{
- name =
- egg_toolbars_model_get_name (etoolbar->priv->model, type, data,
- TRUE);
+ name = egg_toolbars_model_get_name (etoolbar->priv->model, type, data, TRUE);
}
if (name != NULL && !used)
{
gint tpos = get_toolbar_position (etoolbar, GTK_WIDGET (toolbar));
- egg_toolbars_model_add_item (etoolbar->priv->model, tpos, ipos,
- name);
- gtk_drag_finish (context, TRUE, context->action == GDK_ACTION_MOVE,
- time);
+ egg_toolbars_model_add_item (etoolbar->priv->model, tpos, ipos, name);
+ gtk_drag_finish (context, TRUE, context->action == GDK_ACTION_MOVE, time);
}
else
{
- gtk_drag_finish (context, FALSE, context->action == GDK_ACTION_MOVE,
- time);
+ gtk_drag_finish (context, FALSE, context->action == GDK_ACTION_MOVE, time);
}
}
@@ -705,10 +700,12 @@ toolbar_drag_data_received_cb (GtkToolbar * toolbar,
}
static gboolean
-toolbar_drag_drop_cb (GtkToolbar * toolbar,
- GdkDragContext * context,
- gint x,
- gint y, guint time, EggEditableToolbar * etoolbar)
+toolbar_drag_drop_cb (GtkToolbar *toolbar,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time,
+ EggEditableToolbar *etoolbar)
{
GdkAtom target;
@@ -723,13 +720,14 @@ toolbar_drag_drop_cb (GtkToolbar * toolbar,
}
static gboolean
-toolbar_drag_motion_cb (GtkToolbar * toolbar,
- GdkDragContext * context,
- gint x,
- gint y, guint time, EggEditableToolbar * etoolbar)
-{
- GdkAtom target =
- gtk_drag_dest_find_target (GTK_WIDGET (toolbar), context, NULL);
+toolbar_drag_motion_cb (GtkToolbar *toolbar,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time,
+ EggEditableToolbar *etoolbar)
+{
+ GdkAtom target = gtk_drag_dest_find_target (GTK_WIDGET (toolbar), context, NULL);
if (target == GDK_NONE)
{
gdk_drag_status (context, 0, time);
@@ -748,11 +746,9 @@ toolbar_drag_motion_cb (GtkToolbar * toolbar,
/* If a highlight item is available, use it. */
else if (etoolbar->priv->dnd_toolitem)
{
- gint ipos =
- gtk_toolbar_get_drop_index (etoolbar->priv->dnd_toolbar, x, y);
+ gint ipos = gtk_toolbar_get_drop_index (etoolbar->priv->dnd_toolbar, x, y);
gtk_toolbar_set_drop_highlight_item (etoolbar->priv->dnd_toolbar,
- etoolbar->priv->dnd_toolitem,
- ipos);
+ etoolbar->priv->dnd_toolitem, ipos);
}
gdk_drag_status (context, context->suggested_action, time);
@@ -761,9 +757,10 @@ toolbar_drag_motion_cb (GtkToolbar * toolbar,
}
static void
-toolbar_drag_leave_cb (GtkToolbar * toolbar,
- GdkDragContext * context,
- guint time, EggEditableToolbar * etoolbar)
+toolbar_drag_leave_cb (GtkToolbar *toolbar,
+ GdkDragContext *context,
+ guint time,
+ EggEditableToolbar *etoolbar)
{
gtk_toolbar_set_drop_highlight_item (toolbar, NULL, 0);
@@ -776,7 +773,8 @@ toolbar_drag_leave_cb (GtkToolbar * toolbar,
}
static void
-configure_drag_dest (EggEditableToolbar * etoolbar, GtkToolbar * toolbar)
+configure_drag_dest (EggEditableToolbar *etoolbar,
+ GtkToolbar *toolbar)
{
EggToolbarsItemType *type;
GtkTargetList *targets;
@@ -784,24 +782,24 @@ configure_drag_dest (EggEditableToolbar * etoolbar, GtkToolbar * toolbar)
/* Make every toolbar able to receive drag-drops. */
gtk_drag_dest_set (GTK_WIDGET (toolbar), 0,
- dest_drag_types, G_N_ELEMENTS (dest_drag_types),
- GDK_ACTION_MOVE | GDK_ACTION_COPY);
+ dest_drag_types, G_N_ELEMENTS (dest_drag_types),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY);
/* Add any specialist drag-drop abilities. */
targets = gtk_drag_dest_get_target_list (GTK_WIDGET (toolbar));
list = egg_toolbars_model_get_types (etoolbar->priv->model);
while (list)
- {
- type = list->data;
- if (type->new_name != NULL || type->get_name != NULL)
- gtk_target_list_add (targets, type->type, 0, 0);
- list = list->next;
- }
+ {
+ type = list->data;
+ if (type->new_name != NULL || type->get_name != NULL)
+ gtk_target_list_add (targets, type->type, 0, 0);
+ list = list->next;
+ }
}
static void
-toggled_visibility_cb (GtkToggleAction * action,
- EggEditableToolbar * etoolbar)
+toggled_visibility_cb (GtkToggleAction *action,
+ EggEditableToolbar *etoolbar)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
GtkWidget *dock;
@@ -832,19 +830,19 @@ toggled_visibility_cb (GtkToggleAction * action,
if (visible)
{
- flags &= ~(EGG_TB_MODEL_HIDDEN);
- }
+ flags &= ~(EGG_TB_MODEL_HIDDEN);
+ }
else
- {
- flags |= (EGG_TB_MODEL_HIDDEN);
- }
+ {
+ flags |= (EGG_TB_MODEL_HIDDEN);
+ }
egg_toolbars_model_set_flags (priv->model, i, flags);
}
}
static void
-toolbar_visibility_refresh (EggEditableToolbar * etoolbar)
+toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
gint n_toolbars, n_items, i, j, k;
@@ -888,46 +886,43 @@ toolbar_visibility_refresh (EggEditableToolbar * etoolbar)
const char *name;
name = egg_toolbars_model_item_nth (priv->model, i, j);
- if (name == NULL)
- continue;
+ if (name == NULL) continue;
action = find_action (etoolbar, name);
- if (action == NULL)
- continue;
+ if (action == NULL) continue;
g_value_init (&value, G_TYPE_STRING);
g_object_get_property (G_OBJECT (action), "label", &value);
name = g_value_get_string (&value);
if (name == NULL)
- {
- g_value_unset (&value);
- continue;
- }
- k += g_utf8_strlen (name, -1) + 2;
- if (j > 0)
- {
- g_string_append (string, ", ");
- if (j > 1 && k > 25)
- {
- g_value_unset (&value);
- break;
- }
- }
- g_string_append (string, name);
- g_value_unset (&value);
- }
+ {
+ g_value_unset (&value);
+ continue;
+ }
+ k += g_utf8_strlen (name, -1) + 2;
+ if (j > 0)
+ {
+ g_string_append (string, ", ");
+ if (j > 1 && k > 25)
+ {
+ g_value_unset (&value);
+ break;
+ }
+ }
+ g_string_append (string, name);
+ g_value_unset (&value);
+ }
if (j < n_items)
{
- g_string_append (string, " ...");
+ g_string_append (string, " ...");
}
tmp = g_string_free (string, FALSE);
for (j = 0, k = 0; tmp[j]; j++)
- {
- if (tmp[j] == '_')
- continue;
- tmp[k] = tmp[j];
- k++;
- }
+ {
+ if (tmp[j] == '_') continue;
+ tmp[k] = tmp[j];
+ k++;
+ }
tmp[k] = 0;
/* Translaters: This string is for a toggle to display a toolbar.
* The name of the toolbar is automatically computed from the widgets
@@ -939,38 +934,35 @@ toolbar_visibility_refresh (EggEditableToolbar * etoolbar)
action_label = g_strdup_printf (_("Show â??_%sâ??"), tmp);
g_free (tmp);
- sprintf (action_name, "ToolbarToggle%d", i);
+ sprintf(action_name, "ToolbarToggle%d", i);
if (i >= priv->visibility_actions->len)
{
- action =
- gtk_toggle_action_new (action_name, action_label, NULL, NULL);
- g_ptr_array_add (priv->visibility_actions, action);
- g_signal_connect_object (action, "toggled",
- G_CALLBACK (toggled_visibility_cb),
- etoolbar, 0);
- gtk_action_group_add_action (priv->actions, GTK_ACTION (action));
- }
+ action = gtk_toggle_action_new (action_name, action_label, NULL, NULL);
+ g_ptr_array_add (priv->visibility_actions, action);
+ g_signal_connect_object (action, "toggled",
+ G_CALLBACK (toggled_visibility_cb),
+ etoolbar, 0);
+ gtk_action_group_add_action (priv->actions, GTK_ACTION (action));
+ }
else
{
- action = g_ptr_array_index (priv->visibility_actions, i);
- g_object_set (action, "label", action_label, NULL);
+ action = g_ptr_array_index (priv->visibility_actions, i);
+ g_object_set (action, "label", action_label, NULL);
}
- gtk_action_set_visible (GTK_ACTION (action),
- (egg_toolbars_model_get_flags (priv->model, i) &
- EGG_TB_MODEL_NOT_REMOVABLE) == 0);
+ gtk_action_set_visible (GTK_ACTION (action), (egg_toolbars_model_get_flags (priv->model, i)
+ & EGG_TB_MODEL_NOT_REMOVABLE) == 0);
gtk_action_set_sensitive (GTK_ACTION (action), showing);
gtk_toggle_action_set_active (action, GTK_WIDGET_VISIBLE
- (get_dock_nth (etoolbar, i)));
+ (get_dock_nth (etoolbar, i)));
- for (list = priv->visibility_paths; list != NULL;
- list = g_list_next (list))
+ for (list = priv->visibility_paths; list != NULL; list = g_list_next (list))
{
- gtk_ui_manager_add_ui (priv->manager, priv->visibility_id,
- (const char *) list->data, action_name,
- action_name, GTK_UI_MANAGER_MENUITEM, FALSE);
- }
+ gtk_ui_manager_add_ui (priv->manager, priv->visibility_id,
+ (const char *)list->data, action_name, action_name,
+ GTK_UI_MANAGER_MENUITEM, FALSE);
+ }
g_free (action_label);
}
@@ -987,7 +979,7 @@ toolbar_visibility_refresh (EggEditableToolbar * etoolbar)
}
static GtkWidget *
-create_dock (EggEditableToolbar * etoolbar)
+create_dock (EggEditableToolbar *etoolbar)
{
GtkWidget *toolbar, *hbox;
@@ -999,16 +991,16 @@ create_dock (EggEditableToolbar * etoolbar)
gtk_box_pack_start (GTK_BOX (hbox), toolbar, TRUE, TRUE, 0);
g_signal_connect (toolbar, "drag_drop",
- G_CALLBACK (toolbar_drag_drop_cb), etoolbar);
+ G_CALLBACK (toolbar_drag_drop_cb), etoolbar);
g_signal_connect (toolbar, "drag_motion",
- G_CALLBACK (toolbar_drag_motion_cb), etoolbar);
+ G_CALLBACK (toolbar_drag_motion_cb), etoolbar);
g_signal_connect (toolbar, "drag_leave",
- G_CALLBACK (toolbar_drag_leave_cb), etoolbar);
+ G_CALLBACK (toolbar_drag_leave_cb), etoolbar);
g_signal_connect (toolbar, "drag_data_received",
- G_CALLBACK (toolbar_drag_data_received_cb), etoolbar);
+ G_CALLBACK (toolbar_drag_data_received_cb), etoolbar);
g_signal_connect (toolbar, "popup_context_menu",
- G_CALLBACK (popup_context_menu_cb), etoolbar);
+ G_CALLBACK (popup_context_menu_cb), etoolbar);
configure_drag_dest (etoolbar, GTK_TOOLBAR (toolbar));
@@ -1016,24 +1008,24 @@ create_dock (EggEditableToolbar * etoolbar)
}
static void
-set_fixed_style (EggEditableToolbar * t, GtkToolbarStyle style)
+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_ICONS ? GTK_TOOLBAR_BOTH_HORIZ : style);
+ style == GTK_TOOLBAR_ICONS ? GTK_TOOLBAR_BOTH_HORIZ : style);
}
static void
-unset_fixed_style (EggEditableToolbar * t)
+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));
}
static void
-toolbar_changed_cb (EggToolbarsModel * model,
- int position, EggEditableToolbar * etoolbar)
+toolbar_changed_cb (EggToolbarsModel *model,
+ int position,
+ EggEditableToolbar *etoolbar)
{
GtkWidget *toolbar;
EggTbModelFlags flags;
@@ -1043,30 +1035,30 @@ toolbar_changed_cb (EggToolbarsModel * model,
toolbar = get_toolbar_nth (etoolbar, position);
if (flags & EGG_TB_MODEL_ICONS)
- {
- style = GTK_TOOLBAR_ICONS;
- }
+ {
+ style = GTK_TOOLBAR_ICONS;
+ }
else if (flags & EGG_TB_MODEL_TEXT)
- {
- style = GTK_TOOLBAR_TEXT;
- }
+ {
+ style = GTK_TOOLBAR_TEXT;
+ }
else if (flags & EGG_TB_MODEL_BOTH)
- {
- style = GTK_TOOLBAR_BOTH;
- }
+ {
+ style = GTK_TOOLBAR_BOTH;
+ }
else if (flags & EGG_TB_MODEL_BOTH_HORIZ)
- {
- style = GTK_TOOLBAR_BOTH_HORIZ;
- }
+ {
+ style = GTK_TOOLBAR_BOTH_HORIZ;
+ }
else
- {
- gtk_toolbar_unset_style (GTK_TOOLBAR (toolbar));
- if (position == 0 && etoolbar->priv->fixed_toolbar)
- {
- unset_fixed_style (etoolbar);
- }
- return;
- }
+ {
+ gtk_toolbar_unset_style (GTK_TOOLBAR (toolbar));
+ if (position == 0 && etoolbar->priv->fixed_toolbar)
+ {
+ unset_fixed_style (etoolbar);
+ }
+ return;
+ }
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), style);
if (position == 0 && etoolbar->priv->fixed_toolbar)
@@ -1078,7 +1070,7 @@ toolbar_changed_cb (EggToolbarsModel * model,
}
static void
-unparent_fixed (EggEditableToolbar * etoolbar)
+unparent_fixed (EggEditableToolbar *etoolbar)
{
GtkWidget *toolbar, *dock;
g_return_if_fail (GTK_IS_TOOLBAR (etoolbar->priv->fixed_toolbar));
@@ -1093,11 +1085,10 @@ unparent_fixed (EggEditableToolbar * etoolbar)
}
static void
-update_fixed (EggEditableToolbar * etoolbar)
+update_fixed (EggEditableToolbar *etoolbar)
{
GtkWidget *toolbar, *dock;
- if (!etoolbar->priv->fixed_toolbar)
- return;
+ if (!etoolbar->priv->fixed_toolbar) return;
toolbar = etoolbar->priv->fixed_toolbar;
dock = get_dock_nth (etoolbar, 0);
@@ -1114,14 +1105,14 @@ update_fixed (EggEditableToolbar * etoolbar)
}
static void
-toolbar_added_cb (EggToolbarsModel * model,
- int position, EggEditableToolbar * etoolbar)
+toolbar_added_cb (EggToolbarsModel *model,
+ int position,
+ EggEditableToolbar *etoolbar)
{
GtkWidget *dock;
dock = create_dock (etoolbar);
- if ((egg_toolbars_model_get_flags (model, position) & EGG_TB_MODEL_HIDDEN)
- == 0)
+ if ((egg_toolbars_model_get_flags (model, position) & EGG_TB_MODEL_HIDDEN) == 0)
gtk_widget_show (dock);
gtk_widget_set_size_request (dock, -1, MIN_TOOLBAR_HEIGHT);
@@ -1138,8 +1129,9 @@ toolbar_added_cb (EggToolbarsModel * model,
}
static void
-toolbar_removed_cb (EggToolbarsModel * model,
- int position, EggEditableToolbar * etoolbar)
+toolbar_removed_cb (EggToolbarsModel *model,
+ int position,
+ EggEditableToolbar *etoolbar)
{
GtkWidget *dock;
@@ -1157,8 +1149,10 @@ toolbar_removed_cb (EggToolbarsModel * model,
}
static void
-item_added_cb (EggToolbarsModel * model,
- int tpos, int ipos, EggEditableToolbar * etoolbar)
+item_added_cb (EggToolbarsModel *model,
+ int tpos,
+ int ipos,
+ EggEditableToolbar *etoolbar)
{
GtkWidget *dock;
GtkWidget *toolbar;
@@ -1166,8 +1160,7 @@ item_added_cb (EggToolbarsModel * model,
toolbar = get_toolbar_nth (etoolbar, tpos);
item = create_item_from_position (etoolbar, tpos, ipos);
- if (item == NULL)
- return;
+ if (item == NULL) return;
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, ipos);
@@ -1184,9 +1177,10 @@ item_added_cb (EggToolbarsModel * model,
}
static void
-item_removed_cb (EggToolbarsModel * model,
- int toolbar_position,
- int position, EggEditableToolbar * etoolbar)
+item_removed_cb (EggToolbarsModel *model,
+ int toolbar_position,
+ int position,
+ EggEditableToolbar *etoolbar)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
@@ -1195,7 +1189,7 @@ item_removed_cb (EggToolbarsModel * model,
toolbar = get_toolbar_nth (etoolbar, toolbar_position);
item = GTK_WIDGET (gtk_toolbar_get_nth_item
- (GTK_TOOLBAR (toolbar), position));
+ (GTK_TOOLBAR (toolbar), position));
g_return_if_fail (item != NULL);
if (item == priv->selected)
@@ -1209,7 +1203,7 @@ item_removed_cb (EggToolbarsModel * model,
}
static void
-egg_editable_toolbar_build (EggEditableToolbar * etoolbar)
+egg_editable_toolbar_build (EggEditableToolbar *etoolbar)
{
int i, l, n_items, n_toolbars;
EggToolbarsModel *model = etoolbar->priv->model;
@@ -1224,8 +1218,7 @@ egg_editable_toolbar_build (EggEditableToolbar * etoolbar)
GtkWidget *toolbar, *dock;
dock = create_dock (etoolbar);
- if ((egg_toolbars_model_get_flags (model, i) & EGG_TB_MODEL_HIDDEN) ==
- 0)
+ if ((egg_toolbars_model_get_flags (model, i) & EGG_TB_MODEL_HIDDEN) == 0)
gtk_widget_show (dock);
gtk_box_pack_start (GTK_BOX (etoolbar), dock, TRUE, TRUE, 0);
toolbar = get_toolbar_nth (etoolbar, i);
@@ -1238,10 +1231,10 @@ egg_editable_toolbar_build (EggEditableToolbar * etoolbar)
item = create_item_from_position (etoolbar, i, l);
if (item)
{
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, l);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, l);
connect_widget_signals (GTK_WIDGET (item), etoolbar);
- configure_item_tooltip (item);
+ configure_item_tooltip (item);
configure_item_sensitivity (item, etoolbar);
}
else
@@ -1254,21 +1247,21 @@ egg_editable_toolbar_build (EggEditableToolbar * etoolbar)
if (n_items == 0)
{
- gtk_widget_set_size_request (dock, -1, MIN_TOOLBAR_HEIGHT);
+ gtk_widget_set_size_request (dock, -1, MIN_TOOLBAR_HEIGHT);
}
}
update_fixed (etoolbar);
/* apply styles */
- for (i = 0; i < n_toolbars; i++)
+ for (i = 0; i < n_toolbars; i ++)
{
toolbar_changed_cb (model, i, etoolbar);
}
}
static void
-egg_editable_toolbar_disconnect_model (EggEditableToolbar * toolbar)
+egg_editable_toolbar_disconnect_model (EggEditableToolbar *toolbar)
{
EggToolbarsModel *model = toolbar->priv->model;
@@ -1285,7 +1278,7 @@ egg_editable_toolbar_disconnect_model (EggEditableToolbar * toolbar)
}
static void
-egg_editable_toolbar_deconstruct (EggEditableToolbar * toolbar)
+egg_editable_toolbar_deconstruct (EggEditableToolbar *toolbar)
{
EggToolbarsModel *model = toolbar->priv->model;
GList *children;
@@ -1294,8 +1287,8 @@ egg_editable_toolbar_deconstruct (EggEditableToolbar * toolbar)
if (toolbar->priv->fixed_toolbar)
{
- unset_fixed_style (toolbar);
- unparent_fixed (toolbar);
+ unset_fixed_style (toolbar);
+ unparent_fixed (toolbar);
}
children = gtk_container_get_children (GTK_CONTAINER (toolbar));
@@ -1304,13 +1297,12 @@ egg_editable_toolbar_deconstruct (EggEditableToolbar * toolbar)
}
void
-egg_editable_toolbar_set_model (EggEditableToolbar * etoolbar,
- EggToolbarsModel * model)
+egg_editable_toolbar_set_model (EggEditableToolbar *etoolbar,
+ EggToolbarsModel *model)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
- if (priv->model == model)
- return;
+ if (priv->model == model) return;
if (priv->model)
{
@@ -1327,19 +1319,19 @@ egg_editable_toolbar_set_model (EggEditableToolbar * etoolbar,
toolbar_visibility_refresh (etoolbar);
g_signal_connect (model, "item_added",
- G_CALLBACK (item_added_cb), etoolbar);
+ G_CALLBACK (item_added_cb), etoolbar);
g_signal_connect (model, "item_removed",
- G_CALLBACK (item_removed_cb), etoolbar);
+ G_CALLBACK (item_removed_cb), etoolbar);
g_signal_connect (model, "toolbar_added",
- G_CALLBACK (toolbar_added_cb), etoolbar);
+ G_CALLBACK (toolbar_added_cb), etoolbar);
g_signal_connect (model, "toolbar_removed",
- G_CALLBACK (toolbar_removed_cb), etoolbar);
+ G_CALLBACK (toolbar_removed_cb), etoolbar);
g_signal_connect (model, "toolbar_changed",
- G_CALLBACK (toolbar_changed_cb), etoolbar);
+ G_CALLBACK (toolbar_changed_cb), etoolbar);
}
static void
-egg_editable_toolbar_init (EggEditableToolbar * etoolbar)
+egg_editable_toolbar_init (EggEditableToolbar *etoolbar)
{
EggEditableToolbarPrivate *priv;
@@ -1348,11 +1340,11 @@ egg_editable_toolbar_init (EggEditableToolbar * etoolbar)
priv->save_hidden = TRUE;
g_signal_connect (etoolbar, "notify::visible",
- G_CALLBACK (toolbar_visibility_refresh), NULL);
+ G_CALLBACK (toolbar_visibility_refresh), NULL);
}
static void
-egg_editable_toolbar_dispose (GObject * object)
+egg_editable_toolbar_dispose (GObject *object)
{
EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR (object);
EggEditableToolbarPrivate *priv = etoolbar->priv;
@@ -1379,9 +1371,9 @@ egg_editable_toolbar_dispose (GObject * object)
{
if (priv->visibility_id)
{
- gtk_ui_manager_remove_ui (priv->manager, priv->visibility_id);
- priv->visibility_id = 0;
- }
+ gtk_ui_manager_remove_ui (priv->manager, priv->visibility_id);
+ priv->visibility_id = 0;
+ }
g_object_unref (priv->manager);
priv->manager = NULL;
@@ -1398,77 +1390,65 @@ egg_editable_toolbar_dispose (GObject * object)
}
static void
-egg_editable_toolbar_set_ui_manager (EggEditableToolbar * etoolbar,
- GtkUIManager * manager)
+egg_editable_toolbar_set_ui_manager (EggEditableToolbar *etoolbar,
+ GtkUIManager *manager)
{
static const GtkActionEntry actions[] = {
- {"MoveToolItem", STOCK_DRAG_MODE, N_("_Move on Toolbar"), NULL,
- N_("Move the selected item on the toolbar"), G_CALLBACK (move_item_cb)},
- {"RemoveToolItem", GTK_STOCK_REMOVE, N_("_Remove from Toolbar"), NULL,
- N_("Remove the selected item from the toolbar"),
- G_CALLBACK (remove_item_cb)},
- {"RemoveToolbar", GTK_STOCK_DELETE, N_("_Delete Toolbar"), NULL,
- N_("Remove the selected toolbar"), G_CALLBACK (remove_toolbar_cb)},
+ { "MoveToolItem", STOCK_DRAG_MODE, N_("_Move on Toolbar"), NULL,
+ N_("Move the selected item on the toolbar"), G_CALLBACK (move_item_cb) },
+ { "RemoveToolItem", GTK_STOCK_REMOVE, N_("_Remove from Toolbar"), NULL,
+ N_("Remove the selected item from the toolbar"), G_CALLBACK (remove_item_cb) },
+ { "RemoveToolbar", GTK_STOCK_DELETE, N_("_Delete Toolbar"), NULL,
+ N_("Remove the selected toolbar"), G_CALLBACK (remove_toolbar_cb) },
};
etoolbar->priv->manager = g_object_ref (manager);
etoolbar->priv->actions = gtk_action_group_new ("ToolbarActions");
- gtk_action_group_set_translation_domain (etoolbar->priv->actions,
- GETTEXT_PACKAGE);
+ gtk_action_group_set_translation_domain (etoolbar->priv->actions, GETTEXT_PACKAGE);
gtk_action_group_add_actions (etoolbar->priv->actions, actions,
- G_N_ELEMENTS (actions), etoolbar);
+ G_N_ELEMENTS (actions), etoolbar);
gtk_ui_manager_insert_action_group (manager, etoolbar->priv->actions, -1);
g_object_unref (etoolbar->priv->actions);
toolbar_visibility_refresh (etoolbar);
}
-GtkWidget *
-egg_editable_toolbar_get_selected (EggEditableToolbar * etoolbar)
+GtkWidget * egg_editable_toolbar_get_selected (EggEditableToolbar *etoolbar)
{
return etoolbar->priv->selected;
}
void
-egg_editable_toolbar_set_selected (EggEditableToolbar * etoolbar,
- GtkWidget * widget)
+egg_editable_toolbar_set_selected (EggEditableToolbar *etoolbar,
+ GtkWidget *widget)
{
GtkWidget *toolbar, *toolitem;
gboolean editable;
etoolbar->priv->selected = widget;
- toolbar =
- (widget != NULL) ? gtk_widget_get_ancestor (widget,
- GTK_TYPE_TOOLBAR) : NULL;
- toolitem =
- (widget != NULL) ? gtk_widget_get_ancestor (widget,
- GTK_TYPE_TOOL_ITEM) : NULL;
+ toolbar = (widget != NULL) ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOLBAR) : NULL;
+ toolitem = (widget != NULL) ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM) : NULL;
- if (toolbar != NULL)
+ if(toolbar != NULL)
{
gint tpos = get_toolbar_position (etoolbar, toolbar);
- editable =
- ((egg_toolbars_model_get_flags (etoolbar->priv->model, tpos) &
- EGG_TB_MODEL_NOT_EDITABLE) == 0);
+ editable = ((egg_toolbars_model_get_flags (etoolbar->priv->model, tpos) & EGG_TB_MODEL_NOT_EDITABLE) == 0);
}
else
{
editable = FALSE;
}
- gtk_action_set_visible (find_action (etoolbar, "RemoveToolbar"),
- (toolbar != NULL)
- && (etoolbar->priv->edit_mode > 0));
- gtk_action_set_visible (find_action (etoolbar, "RemoveToolItem"),
- (toolitem != NULL) && editable);
- gtk_action_set_visible (find_action (etoolbar, "MoveToolItem"),
- (toolitem != NULL) && editable);
+ gtk_action_set_visible (find_action (etoolbar, "RemoveToolbar"), (toolbar != NULL) && (etoolbar->priv->edit_mode > 0));
+ gtk_action_set_visible (find_action (etoolbar, "RemoveToolItem"), (toolitem != NULL) && editable);
+ gtk_action_set_visible (find_action (etoolbar, "MoveToolItem"), (toolitem != NULL) && editable);
}
static void
-set_edit_mode (EggEditableToolbar * etoolbar, gboolean mode)
+set_edit_mode (EggEditableToolbar *etoolbar,
+ gboolean mode)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
int i, l, n_items;
@@ -1487,7 +1467,7 @@ set_edit_mode (EggEditableToolbar * etoolbar, gboolean mode)
if (i == 0)
{
- for (i = get_n_toolbars (etoolbar) - 1; i >= 0; i--)
+ for (i = get_n_toolbars (etoolbar)-1; i >= 0; i--)
{
GtkWidget *toolbar;
@@ -1515,24 +1495,23 @@ set_edit_mode (EggEditableToolbar * etoolbar, gboolean mode)
}
static void
-egg_editable_toolbar_set_property (GObject * object,
- guint prop_id,
- const GValue * value, GParamSpec * pspec)
+egg_editable_toolbar_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR (object);
switch (prop_id)
{
case PROP_UI_MANAGER:
- egg_editable_toolbar_set_ui_manager (etoolbar,
- g_value_get_object (value));
+ egg_editable_toolbar_set_ui_manager (etoolbar, g_value_get_object (value));
break;
case PROP_TOOLBARS_MODEL:
egg_editable_toolbar_set_model (etoolbar, g_value_get_object (value));
break;
case PROP_SELECTED:
- egg_editable_toolbar_set_selected (etoolbar,
- g_value_get_object (value));
+ egg_editable_toolbar_set_selected (etoolbar, g_value_get_object (value));
break;
case PROP_POPUP_PATH:
etoolbar->priv->popup_path = g_strdup (g_value_get_string (value));
@@ -1547,9 +1526,10 @@ egg_editable_toolbar_set_property (GObject * object,
}
static void
-egg_editable_toolbar_get_property (GObject * object,
- guint prop_id,
- GValue * value, GParamSpec * pspec)
+egg_editable_toolbar_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR (object);
@@ -1565,7 +1545,7 @@ egg_editable_toolbar_get_property (GObject * object,
g_value_set_object (value, etoolbar->priv->selected);
break;
case PROP_EDIT_MODE:
- g_value_set_boolean (value, etoolbar->priv->edit_mode > 0);
+ g_value_set_boolean (value, etoolbar->priv->edit_mode>0);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1574,7 +1554,7 @@ egg_editable_toolbar_get_property (GObject * object,
}
static void
-egg_editable_toolbar_class_init (EggEditableToolbarClass * klass)
+egg_editable_toolbar_class_init (EggEditableToolbarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1584,86 +1564,77 @@ egg_editable_toolbar_class_init (EggEditableToolbarClass * klass)
egg_editable_toolbar_signals[ACTION_REQUEST] =
g_signal_new ("action_request",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggEditableToolbarClass, action_request),
- NULL, NULL, g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggEditableToolbarClass, action_request),
+ NULL, NULL, g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
g_object_class_install_property (object_class,
- PROP_UI_MANAGER,
- g_param_spec_object ("ui-manager",
- "UI-Mmanager",
- "UI Manager",
- GTK_TYPE_UI_MANAGER,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
- g_object_class_install_property (object_class, PROP_TOOLBARS_MODEL,
- g_param_spec_object ("model", "Model",
- "Toolbars Model",
- EGG_TYPE_TOOLBARS_MODEL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
- g_object_class_install_property (object_class, PROP_SELECTED,
- g_param_spec_object ("selected",
- "Selected",
- "Selected toolitem",
- GTK_TYPE_TOOL_ITEM,
- G_PARAM_READABLE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ PROP_UI_MANAGER,
+ g_param_spec_object ("ui-manager",
+ "UI-Mmanager",
+ "UI Manager",
+ GTK_TYPE_UI_MANAGER,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class,
+ PROP_TOOLBARS_MODEL,
+ g_param_spec_object ("model",
+ "Model",
+ "Toolbars Model",
+ EGG_TYPE_TOOLBARS_MODEL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class,
+ PROP_SELECTED,
+ g_param_spec_object ("selected",
+ "Selected",
+ "Selected toolitem",
+ GTK_TYPE_TOOL_ITEM,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property (object_class,
- PROP_POPUP_PATH,
- g_param_spec_string ("popup-path",
- "popup-path",
- "popup-path",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ PROP_POPUP_PATH,
+ g_param_spec_string ("popup-path",
+ "popup-path",
+ "popup-path",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property (object_class,
- PROP_EDIT_MODE,
- g_param_spec_boolean ("edit-mode",
- "Edit-Mode",
- "Edit Mode",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ PROP_EDIT_MODE,
+ g_param_spec_boolean ("edit-mode",
+ "Edit-Mode",
+ "Edit Mode",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_type_class_add_private (object_class, sizeof (EggEditableToolbarPrivate));
}
GtkWidget *
-egg_editable_toolbar_new (GtkUIManager * manager, const char *popup_path)
+egg_editable_toolbar_new (GtkUIManager *manager,
+ const char *popup_path)
{
- return GTK_WIDGET (g_object_new (EGG_TYPE_EDITABLE_TOOLBAR,
- "ui-manager", manager,
- "popup-path", popup_path, NULL));
+ return GTK_WIDGET (g_object_new (EGG_TYPE_EDITABLE_TOOLBAR,
+ "ui-manager", manager,
+ "popup-path", popup_path,
+ NULL));
}
GtkWidget *
-egg_editable_toolbar_new_with_model (GtkUIManager * manager,
- EggToolbarsModel * model,
+egg_editable_toolbar_new_with_model (GtkUIManager *manager,
+ EggToolbarsModel *model,
const char *popup_path)
{
return GTK_WIDGET (g_object_new (EGG_TYPE_EDITABLE_TOOLBAR,
"ui-manager", manager,
"model", model,
- "popup-path", popup_path, NULL));
+ "popup-path", popup_path,
+ NULL));
}
gboolean
-egg_editable_toolbar_get_edit_mode (EggEditableToolbar * etoolbar)
+egg_editable_toolbar_get_edit_mode (EggEditableToolbar *etoolbar)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
@@ -1671,23 +1642,24 @@ egg_editable_toolbar_get_edit_mode (EggEditableToolbar * etoolbar)
}
void
-egg_editable_toolbar_set_edit_mode (EggEditableToolbar * etoolbar,
- gboolean mode)
+egg_editable_toolbar_set_edit_mode (EggEditableToolbar *etoolbar,
+ gboolean mode)
{
set_edit_mode (etoolbar, mode);
g_object_notify (G_OBJECT (etoolbar), "edit-mode");
}
void
-egg_editable_toolbar_add_visibility (EggEditableToolbar * etoolbar,
- const char *path)
+egg_editable_toolbar_add_visibility (EggEditableToolbar *etoolbar,
+ const char *path)
{
etoolbar->priv->visibility_paths = g_list_prepend
- (etoolbar->priv->visibility_paths, g_strdup (path));
+ (etoolbar->priv->visibility_paths, g_strdup (path));
}
void
-egg_editable_toolbar_show (EggEditableToolbar * etoolbar, const char *name)
+egg_editable_toolbar_show (EggEditableToolbar *etoolbar,
+ const char *name)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
EggToolbarsModel *model = priv->model;
@@ -1707,7 +1679,8 @@ egg_editable_toolbar_show (EggEditableToolbar * etoolbar, const char *name)
}
void
-egg_editable_toolbar_hide (EggEditableToolbar * etoolbar, const char *name)
+egg_editable_toolbar_hide (EggEditableToolbar *etoolbar,
+ const char *name)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
EggToolbarsModel *model = priv->model;
@@ -1720,15 +1693,15 @@ egg_editable_toolbar_hide (EggEditableToolbar * etoolbar, const char *name)
toolbar_name = egg_toolbars_model_toolbar_nth (model, i);
if (strcmp (toolbar_name, name) == 0)
- {
- gtk_widget_hide (get_dock_nth (etoolbar, i));
- }
+ {
+ gtk_widget_hide (get_dock_nth (etoolbar, i));
+ }
}
}
void
-egg_editable_toolbar_set_fixed (EggEditableToolbar * etoolbar,
- GtkToolbar * toolbar)
+egg_editable_toolbar_set_fixed (EggEditableToolbar *etoolbar,
+ GtkToolbar *toolbar)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
@@ -1755,7 +1728,8 @@ egg_editable_toolbar_set_fixed (EggEditableToolbar * etoolbar,
#define DEFAULT_ICON_WIDTH 0
static void
-fake_expose_widget (GtkWidget * widget, GdkPixmap * pixmap)
+fake_expose_widget (GtkWidget *widget,
+ GdkPixmap *pixmap)
{
GdkWindow *tmp_window;
GdkEventExpose event;
@@ -1769,7 +1743,7 @@ fake_expose_widget (GtkWidget * widget, GdkPixmap * pixmap)
tmp_window = widget->window;
widget->window = pixmap;
- gtk_widget_send_expose (widget, (GdkEvent *) & event);
+ gtk_widget_send_expose (widget, (GdkEvent *) &event);
widget->window = tmp_window;
}
@@ -1779,7 +1753,7 @@ fake_expose_widget (GtkWidget * widget, GdkPixmap * pixmap)
* with large toolbar icons.
*/
static GdkPixbuf *
-new_pixbuf_from_widget (GtkWidget * widget)
+new_pixbuf_from_widget (GtkWidget *widget)
{
GtkWidget *window;
GdkPixbuf *pixbuf;
@@ -1795,9 +1769,10 @@ new_pixbuf_from_widget (GtkWidget * widget)
screen = gtk_widget_get_screen (widget);
- if (!gtk_icon_size_lookup_for_settings
- (gtk_settings_get_for_screen (screen), GTK_ICON_SIZE_LARGE_TOOLBAR,
- NULL, &icon_height))
+ if (!gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen),
+ GTK_ICON_SIZE_LARGE_TOOLBAR,
+ NULL,
+ &icon_height))
{
icon_height = DEFAULT_ICON_HEIGHT;
}
@@ -1816,7 +1791,7 @@ new_pixbuf_from_widget (GtkWidget * widget)
* This is needed mostly for pixmap based themes.
*/
gtk_window_set_default_size (GTK_WINDOW (window), icon_width, icon_height);
- gtk_window_get_size (GTK_WINDOW (window), &icon_width, &icon_height);
+ gtk_window_get_size (GTK_WINDOW (window),&icon_width, &icon_height);
gtk_widget_size_request (window, &requisition);
allocation.x = 0;
@@ -1829,8 +1804,7 @@ new_pixbuf_from_widget (GtkWidget * widget)
/* Create a pixmap */
visual = gtk_widget_get_visual (window);
pixmap = gdk_pixmap_new (NULL, icon_width, icon_height, visual->depth);
- gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap),
- gtk_widget_get_colormap (window));
+ gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), gtk_widget_get_colormap (window));
/* Draw the window */
gtk_widget_ensure_style (window);
@@ -1840,10 +1814,8 @@ new_pixbuf_from_widget (GtkWidget * widget)
fake_expose_widget (window, pixmap);
fake_expose_widget (widget, pixmap);
- pixbuf =
- gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, icon_width, icon_height);
- gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, icon_width,
- icon_height);
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, icon_width, icon_height);
+ gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, icon_width, icon_height);
gtk_widget_destroy (window);
@@ -1862,7 +1834,7 @@ new_separator_pixbuf (void)
}
static void
-update_separator_image (GtkImage * image)
+update_separator_image (GtkImage *image)
{
GdkPixbuf *pixbuf = new_separator_pixbuf ();
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
@@ -1870,7 +1842,9 @@ update_separator_image (GtkImage * image)
}
static gboolean
-style_set_cb (GtkWidget * widget, GtkStyle * previous_style, GtkImage * image)
+style_set_cb (GtkWidget *widget,
+ GtkStyle *previous_style,
+ GtkImage *image)
{
update_separator_image (image);
@@ -1883,13 +1857,13 @@ _egg_editable_toolbar_new_separator_image (void)
GtkWidget *image = gtk_image_new ();
update_separator_image (GTK_IMAGE (image));
g_signal_connect (G_OBJECT (image), "style_set",
- G_CALLBACK (style_set_cb), GTK_IMAGE (image));
+ G_CALLBACK (style_set_cb), GTK_IMAGE (image));
return image;
}
EggToolbarsModel *
-egg_editable_toolbar_get_model (EggEditableToolbar * etoolbar)
+egg_editable_toolbar_get_model (EggEditableToolbar *etoolbar)
{
return etoolbar->priv->model;
}
diff --git a/src/toolbareditor/egg-editable-toolbar.h b/src/toolbareditor/egg-editable-toolbar.h
index 0ef1928..8537ba8 100644
--- a/src/toolbareditor/egg-editable-toolbar.h
+++ b/src/toolbareditor/egg-editable-toolbar.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: egg-editable-toolbar.h 891 2008-08-08 21:14:52Z friemann $
+ * $Id$
*/
#ifndef EGG_EDITABLE_TOOLBAR_H
@@ -27,21 +27,23 @@
#include <gtk/gtk.h>
G_BEGIN_DECLS
+
#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))
#define EGG_IS_EDITABLE_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_EDITABLE_TOOLBAR))
#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 _EggEditableToolbar EggEditableToolbar;
typedef struct _EggEditableToolbarPrivate EggEditableToolbarPrivate;
-typedef struct _EggEditableToolbarClass EggEditableToolbarClass;
+typedef struct _EggEditableToolbarClass EggEditableToolbarClass;
struct _EggEditableToolbar
{
GtkVBox parent_object;
- /*< private > */
+ /*< private >*/
EggEditableToolbarPrivate *priv;
};
@@ -49,42 +51,41 @@ struct _EggEditableToolbarClass
{
GtkVBoxClass parent_class;
- void (*action_request) (EggEditableToolbar * etoolbar,
- const char *action_name);
+ void (* action_request) (EggEditableToolbar *etoolbar,
+ const char *action_name);
};
-GType egg_editable_toolbar_get_type (void);
-GtkWidget *egg_editable_toolbar_new (GtkUIManager * manager,
- const char *visibility_path);
-GtkWidget *egg_editable_toolbar_new_with_model (GtkUIManager * manager,
- EggToolbarsModel * model,
- const char *visibility_path);
-void egg_editable_toolbar_set_model (EggEditableToolbar * etoolbar,
- EggToolbarsModel * model);
-EggToolbarsModel *egg_editable_toolbar_get_model (EggEditableToolbar *
- etoolbar);
-GtkUIManager *egg_editable_toolbar_get_manager (EggEditableToolbar *
- etoolbar);
-void egg_editable_toolbar_set_edit_mode (EggEditableToolbar * etoolbar,
- gboolean mode);
-gboolean egg_editable_toolbar_get_edit_mode (EggEditableToolbar * etoolbar);
-void egg_editable_toolbar_show (EggEditableToolbar * etoolbar,
- const char *name);
-void egg_editable_toolbar_hide (EggEditableToolbar * etoolbar,
- const char *name);
-void egg_editable_toolbar_set_fixed (EggEditableToolbar * etoolbar,
- GtkToolbar * fixed_toolbar);
-
-GtkWidget *egg_editable_toolbar_get_selected (EggEditableToolbar * etoolbar);
-void egg_editable_toolbar_set_selected (EggEditableToolbar * etoolbar,
- GtkWidget * widget);
-
-void egg_editable_toolbar_add_visibility (EggEditableToolbar * etoolbar,
- const char *path);
+GType egg_editable_toolbar_get_type (void);
+GtkWidget *egg_editable_toolbar_new (GtkUIManager *manager,
+ const char *visibility_path);
+GtkWidget *egg_editable_toolbar_new_with_model (GtkUIManager *manager,
+ EggToolbarsModel *model,
+ const char *visibility_path);
+void egg_editable_toolbar_set_model (EggEditableToolbar *etoolbar,
+ EggToolbarsModel *model);
+EggToolbarsModel *egg_editable_toolbar_get_model (EggEditableToolbar *etoolbar);
+GtkUIManager *egg_editable_toolbar_get_manager (EggEditableToolbar *etoolbar);
+void egg_editable_toolbar_set_edit_mode (EggEditableToolbar *etoolbar,
+ gboolean mode);
+gboolean egg_editable_toolbar_get_edit_mode (EggEditableToolbar *etoolbar);
+void egg_editable_toolbar_show (EggEditableToolbar *etoolbar,
+ const char *name);
+void egg_editable_toolbar_hide (EggEditableToolbar *etoolbar,
+ const char *name);
+void egg_editable_toolbar_set_fixed (EggEditableToolbar *etoolbar,
+ GtkToolbar *fixed_toolbar);
+
+GtkWidget * egg_editable_toolbar_get_selected (EggEditableToolbar *etoolbar);
+void egg_editable_toolbar_set_selected (EggEditableToolbar *etoolbar,
+ GtkWidget *widget);
+
+void egg_editable_toolbar_add_visibility (EggEditableToolbar *etoolbar,
+ const char *path);
/* Private Functions */
-GtkWidget *_egg_editable_toolbar_new_separator_image (void);
+GtkWidget *_egg_editable_toolbar_new_separator_image (void);
G_END_DECLS
+
#endif
diff --git a/src/toolbareditor/egg-toolbar-editor.c b/src/toolbareditor/egg-toolbar-editor.c
index 1402b6e..5e9529a 100644
--- a/src/toolbareditor/egg-toolbar-editor.c
+++ b/src/toolbareditor/egg-toolbar-editor.c
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: egg-toolbar-editor.c 929 2009-02-19 14:49:56Z friemann $
+ * $Id$
*/
#include "config.h"
@@ -37,8 +37,8 @@ static const GtkTargetEntry source_drag_types[] = {
};
-static void egg_toolbar_editor_finalize (GObject * object);
-static void update_editor_sheet (EggToolbarEditor * editor);
+static void egg_toolbar_editor_finalize (GObject *object);
+static void update_editor_sheet (EggToolbarEditor *editor);
enum
{
@@ -52,7 +52,7 @@ enum
SIGNAL_HANDLER_ITEM_ADDED,
SIGNAL_HANDLER_ITEM_REMOVED,
SIGNAL_HANDLER_TOOLBAR_REMOVED,
- SIGNAL_HANDLER_LIST_SIZE /* Array size */
+ SIGNAL_HANDLER_LIST_SIZE /* Array size */
};
#define EGG_TOOLBAR_EDITOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EGG_TYPE_TOOLBAR_EDITOR, EggToolbarEditorPrivate))
@@ -64,17 +64,18 @@ struct EggToolbarEditorPrivate
GtkWidget *table;
GtkWidget *scrolled_window;
- GList *actions_list;
- GList *factory_list;
+ GList *actions_list;
+ GList *factory_list;
/* These handlers need to be sanely disconnected when switching models */
- gulong sig_handlers[SIGNAL_HANDLER_LIST_SIZE];
+ gulong sig_handlers[SIGNAL_HANDLER_LIST_SIZE];
};
G_DEFINE_TYPE (EggToolbarEditor, egg_toolbar_editor, GTK_TYPE_VBOX);
static gint
-compare_items (gconstpointer a, gconstpointer b)
+compare_items (gconstpointer a,
+ gconstpointer b)
{
const GtkWidget *item1 = a;
const GtkWidget *item2 = b;
@@ -88,7 +89,8 @@ compare_items (gconstpointer a, gconstpointer b)
}
static GtkAction *
-find_action (EggToolbarEditor * t, const char *name)
+find_action (EggToolbarEditor *t,
+ const char *name)
{
GList *l;
GtkAction *action = NULL;
@@ -104,15 +106,15 @@ find_action (EggToolbarEditor * t, const char *name)
tmp = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name);
if (tmp)
- action = tmp;
+ action = tmp;
}
return action;
}
static void
-egg_toolbar_editor_set_ui_manager (EggToolbarEditor * t,
- GtkUIManager * manager)
+egg_toolbar_editor_set_ui_manager (EggToolbarEditor *t,
+ GtkUIManager *manager)
{
g_return_if_fail (GTK_IS_UI_MANAGER (manager));
@@ -120,21 +122,24 @@ egg_toolbar_editor_set_ui_manager (EggToolbarEditor * t,
}
static void
-item_added_or_removed_cb (EggToolbarsModel * model,
- int tpos, int ipos, EggToolbarEditor * editor)
+item_added_or_removed_cb (EggToolbarsModel *model,
+ int tpos,
+ int ipos,
+ EggToolbarEditor *editor)
{
update_editor_sheet (editor);
}
static void
-toolbar_removed_cb (EggToolbarsModel * model,
- int position, EggToolbarEditor * editor)
+toolbar_removed_cb (EggToolbarsModel *model,
+ int position,
+ EggToolbarEditor *editor)
{
update_editor_sheet (editor);
}
static void
-egg_toolbar_editor_disconnect_model (EggToolbarEditor * t)
+egg_toolbar_editor_disconnect_model (EggToolbarEditor *t)
{
EggToolbarEditorPrivate *priv = t->priv;
EggToolbarsModel *model = priv->model;
@@ -147,18 +152,19 @@ egg_toolbar_editor_disconnect_model (EggToolbarEditor * t)
if (handler != 0)
{
- if (g_signal_handler_is_connected (model, handler))
- {
- g_signal_handler_disconnect (model, handler);
- }
+ if (g_signal_handler_is_connected (model, handler))
+ {
+ g_signal_handler_disconnect (model, handler);
+ }
- priv->sig_handlers[i] = 0;
+ priv->sig_handlers[i] = 0;
}
}
}
void
-egg_toolbar_editor_set_model (EggToolbarEditor * t, EggToolbarsModel * model)
+egg_toolbar_editor_set_model (EggToolbarEditor *t,
+ EggToolbarsModel *model)
{
EggToolbarEditorPrivate *priv;
@@ -169,8 +175,7 @@ egg_toolbar_editor_set_model (EggToolbarEditor * t, EggToolbarsModel * model)
if (priv->model)
{
- if (G_UNLIKELY (priv->model == model))
- return;
+ if (G_UNLIKELY (priv->model == model)) return;
egg_toolbar_editor_disconnect_model (t);
g_object_unref (priv->model);
@@ -182,19 +187,20 @@ egg_toolbar_editor_set_model (EggToolbarEditor * t, EggToolbarsModel * model)
priv->sig_handlers[SIGNAL_HANDLER_ITEM_ADDED] =
g_signal_connect_object (model, "item_added",
- G_CALLBACK (item_added_or_removed_cb), t, 0);
+ G_CALLBACK (item_added_or_removed_cb), t, 0);
priv->sig_handlers[SIGNAL_HANDLER_ITEM_REMOVED] =
g_signal_connect_object (model, "item_removed",
- G_CALLBACK (item_added_or_removed_cb), t, 0);
+ G_CALLBACK (item_added_or_removed_cb), t, 0);
priv->sig_handlers[SIGNAL_HANDLER_TOOLBAR_REMOVED] =
g_signal_connect_object (model, "toolbar_removed",
- G_CALLBACK (toolbar_removed_cb), t, 0);
+ G_CALLBACK (toolbar_removed_cb), t, 0);
}
static void
-egg_toolbar_editor_set_property (GObject * object,
- guint prop_id,
- const GValue * value, GParamSpec * pspec)
+egg_toolbar_editor_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
EggToolbarEditor *t = EGG_TOOLBAR_EDITOR (object);
@@ -210,9 +216,10 @@ egg_toolbar_editor_set_property (GObject * object,
}
static void
-egg_toolbar_editor_get_property (GObject * object,
- guint prop_id,
- GValue * value, GParamSpec * pspec)
+egg_toolbar_editor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
EggToolbarEditor *t = EGG_TOOLBAR_EDITOR (object);
@@ -228,7 +235,7 @@ egg_toolbar_editor_get_property (GObject * object,
}
static void
-egg_toolbar_editor_class_init (EggToolbarEditorClass * klass)
+egg_toolbar_editor_class_init (EggToolbarEditorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -237,31 +244,27 @@ egg_toolbar_editor_class_init (EggToolbarEditorClass * klass)
object_class->get_property = egg_toolbar_editor_get_property;
g_object_class_install_property (object_class,
- PROP_UI_MANAGER,
- g_param_spec_object ("ui-manager",
- "UI-Manager",
- "UI Manager",
- GTK_TYPE_UI_MANAGER,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB |
- G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class, PROP_TOOLBARS_MODEL,
- g_param_spec_object ("model", "Model",
- "Toolbars Model",
- EGG_TYPE_TOOLBARS_MODEL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB |
- G_PARAM_CONSTRUCT));
+ PROP_UI_MANAGER,
+ g_param_spec_object ("ui-manager",
+ "UI-Manager",
+ "UI Manager",
+ GTK_TYPE_UI_MANAGER,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
+ PROP_TOOLBARS_MODEL,
+ g_param_spec_object ("model",
+ "Model",
+ "Toolbars Model",
+ EGG_TYPE_TOOLBARS_MODEL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
+ G_PARAM_CONSTRUCT));
g_type_class_add_private (object_class, sizeof (EggToolbarEditorPrivate));
}
static void
-egg_toolbar_editor_finalize (GObject * object)
+egg_toolbar_editor_finalize (GObject *object)
{
EggToolbarEditor *editor = EGG_TOOLBAR_EDITOR (object);
@@ -283,30 +286,36 @@ egg_toolbar_editor_finalize (GObject * object)
}
GtkWidget *
-egg_toolbar_editor_new (GtkUIManager * manager, EggToolbarsModel * model)
+egg_toolbar_editor_new (GtkUIManager *manager,
+ EggToolbarsModel *model)
{
return GTK_WIDGET (g_object_new (EGG_TYPE_TOOLBAR_EDITOR,
- "ui-manager", manager,
- "model", model, NULL));
+ "ui-manager", manager,
+ "model", model,
+ NULL));
}
static void
-drag_begin_cb (GtkWidget * widget, GdkDragContext * context)
+drag_begin_cb (GtkWidget *widget,
+ GdkDragContext *context)
{
gtk_widget_hide (widget);
}
static void
-drag_end_cb (GtkWidget * widget, GdkDragContext * context)
+drag_end_cb (GtkWidget *widget,
+ GdkDragContext *context)
{
gtk_widget_show (widget);
}
static void
-drag_data_get_cb (GtkWidget * widget,
- GdkDragContext * context,
- GtkSelectionData * selection_data,
- guint info, guint32 time, EggToolbarEditor * editor)
+drag_data_get_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint32 time,
+ EggToolbarEditor *editor)
{
const char *target;
@@ -314,11 +323,11 @@ drag_data_get_cb (GtkWidget * widget,
g_return_if_fail (target != NULL);
gtk_selection_data_set (selection_data, selection_data->target, 8,
- (const guchar *) target, strlen (target));
+ (const guchar *) target, strlen (target));
}
static gchar *
-elide_underscores (const gchar * original)
+elide_underscores (const gchar *original)
{
gchar *q, *result;
const gchar *p;
@@ -330,12 +339,12 @@ elide_underscores (const gchar * original)
for (p = original; *p; p++)
{
if (!last_underscore && *p == '_')
- last_underscore = TRUE;
+ last_underscore = TRUE;
else
- {
- last_underscore = FALSE;
- *q++ = *p;
- }
+ {
+ last_underscore = FALSE;
+ *q++ = *p;
+ }
}
*q = '\0';
@@ -344,7 +353,7 @@ elide_underscores (const gchar * original)
}
static void
-set_drag_cursor (GtkWidget * widget)
+set_drag_cursor (GtkWidget *widget)
{
GdkCursor *cursor;
GdkScreen *screen;
@@ -352,13 +361,13 @@ set_drag_cursor (GtkWidget * widget)
screen = gtk_widget_get_screen (widget);
cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
- GDK_HAND2);
+ GDK_HAND2);
gdk_window_set_cursor (widget->window, cursor);
gdk_cursor_unref (cursor);
}
static void
-event_box_realize_cb (GtkWidget * widget, GtkImage * icon)
+event_box_realize_cb (GtkWidget *widget, GtkImage *icon)
{
GtkImageType type;
@@ -372,7 +381,7 @@ event_box_realize_cb (GtkWidget * widget, GtkImage * icon)
gtk_image_get_stock (icon, &stock_id, NULL);
pixbuf = gtk_widget_render_icon (widget, stock_id,
- GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
+ GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
gtk_drag_source_set_icon_pixbuf (widget, pixbuf);
g_object_unref (pixbuf);
}
@@ -392,10 +401,10 @@ event_box_realize_cb (GtkWidget * widget, GtkImage * icon)
if (!gtk_icon_size_lookup_for_settings (settings,
GTK_ICON_SIZE_LARGE_TOOLBAR,
- &width, &height))
+ &width, &height))
{
- width = height = 24;
- }
+ width = height = 24;
+ }
pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name,
MIN (width, height), 0, NULL);
@@ -414,9 +423,10 @@ event_box_realize_cb (GtkWidget * widget, GtkImage * icon)
}
static GtkWidget *
-editor_create_item (EggToolbarEditor * editor,
- GtkImage * icon,
- const char *label_text, GdkDragAction action)
+editor_create_item (EggToolbarEditor *editor,
+ GtkImage *icon,
+ const char *label_text,
+ GdkDragAction action)
{
GtkWidget *event_box;
GtkWidget *vbox;
@@ -427,20 +437,19 @@ editor_create_item (EggToolbarEditor * editor,
gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
gtk_widget_show (event_box);
gtk_drag_source_set (event_box,
- GDK_BUTTON1_MASK,
- 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);
+ GDK_BUTTON1_MASK,
+ 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_after (event_box, "realize",
- G_CALLBACK (event_box_realize_cb), icon);
+ G_CALLBACK (event_box_realize_cb), icon);
if (action == GDK_ACTION_MOVE)
{
g_signal_connect (event_box, "drag_begin",
- G_CALLBACK (drag_begin_cb), NULL);
+ G_CALLBACK (drag_begin_cb), NULL);
g_signal_connect (event_box, "drag_end",
- G_CALLBACK (drag_end_cb), NULL);
+ G_CALLBACK (drag_end_cb), NULL);
}
vbox = gtk_vbox_new (0, FALSE);
@@ -459,8 +468,9 @@ editor_create_item (EggToolbarEditor * editor,
}
static GtkWidget *
-editor_create_item_from_name (EggToolbarEditor * editor,
- const char *name, GdkDragAction drag_action)
+editor_create_item_from_name (EggToolbarEditor *editor,
+ const char * name,
+ GdkDragAction drag_action)
{
GtkWidget *item;
const char *item_name;
@@ -489,12 +499,14 @@ editor_create_item_from_name (EggToolbarEditor * editor,
g_object_get (action,
"icon-name", &icon_name,
- "stock-id", &stock_id, "short-label", &short_label, NULL);
+ "stock-id", &stock_id,
+ "short-label", &short_label,
+ NULL);
/* This is a workaround to catch named icons. */
if (icon_name)
icon = gtk_image_new_from_icon_name (icon_name,
- GTK_ICON_SIZE_LARGE_TOOLBAR);
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
else
icon = gtk_image_new_from_stock (stock_id ? stock_id : GTK_STOCK_DND,
GTK_ICON_SIZE_LARGE_TOOLBAR);
@@ -518,7 +530,7 @@ editor_create_item_from_name (EggToolbarEditor * editor,
}
static gint
-append_table (GtkTable * table, GList * items, gint y, gint width)
+append_table (GtkTable *table, GList *items, gint y, gint width)
{
if (items != NULL)
{
@@ -537,8 +549,7 @@ append_table (GtkTable * table, GList * items, gint y, gint width)
gtk_widget_show (alignment);
gtk_widget_show (item);
- gtk_table_attach_defaults (table, alignment, 0, width, y - 1,
- y + 1);
+ gtk_table_attach_defaults (table, alignment, 0, width, y-1, y+1);
}
for (; items != NULL; items = items->next)
@@ -554,7 +565,7 @@ append_table (GtkTable * table, GList * items, gint y, gint width)
x = 0;
y++;
}
- gtk_table_attach_defaults (table, alignment, x, x + 1, y, y + 1);
+ gtk_table_attach_defaults (table, alignment, x, x+1, y, y+1);
x++;
}
@@ -564,7 +575,7 @@ append_table (GtkTable * table, GList * items, gint y, gint width)
}
static void
-update_editor_sheet (EggToolbarEditor * editor)
+update_editor_sheet (EggToolbarEditor *editor)
{
gint y;
GPtrArray *items;
@@ -581,7 +592,7 @@ update_editor_sheet (EggToolbarEditor * editor)
gtk_table_set_row_spacings (GTK_TABLE (table), 24);
gtk_widget_show (table);
gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL,
- dest_drag_types, G_N_ELEMENTS (dest_drag_types),
+ dest_drag_types, G_N_ELEMENTS (dest_drag_types),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
/* Build two lists of items (one for copying, one for moving). */
@@ -634,7 +645,7 @@ update_editor_sheet (EggToolbarEditor * editor)
}
static void
-setup_editor (EggToolbarEditor * editor)
+setup_editor (EggToolbarEditor *editor)
{
GtkWidget *scrolled_window;
@@ -643,12 +654,12 @@ setup_editor (EggToolbarEditor * editor)
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_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (editor), scrolled_window, TRUE, TRUE, 0);
}
static void
-egg_toolbar_editor_init (EggToolbarEditor * t)
+egg_toolbar_editor_init (EggToolbarEditor *t)
{
t->priv = EGG_TOOLBAR_EDITOR_GET_PRIVATE (t);
@@ -657,3 +668,4 @@ egg_toolbar_editor_init (EggToolbarEditor * t)
setup_editor (t);
}
+
diff --git a/src/toolbareditor/egg-toolbar-editor.h b/src/toolbareditor/egg-toolbar-editor.h
index 42f0a38..ba6e1a9 100644
--- a/src/toolbareditor/egg-toolbar-editor.h
+++ b/src/toolbareditor/egg-toolbar-editor.h
@@ -23,7 +23,9 @@
#include "egg-toolbars-model.h"
-G_BEGIN_DECLS typedef struct EggToolbarEditorClass EggToolbarEditorClass;
+G_BEGIN_DECLS
+
+typedef struct EggToolbarEditorClass EggToolbarEditorClass;
#define EGG_TYPE_TOOLBAR_EDITOR (egg_toolbar_editor_get_type ())
#define EGG_TOOLBAR_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOOLBAR_EDITOR, EggToolbarEditor))
@@ -40,7 +42,7 @@ struct EggToolbarEditor
{
GtkVBox parent_object;
- /*< private > */
+ /*< private >*/
EggToolbarEditorPrivate *priv;
};
@@ -50,11 +52,12 @@ struct EggToolbarEditorClass
};
-GType egg_toolbar_editor_get_type (void);
-GtkWidget *egg_toolbar_editor_new (GtkUIManager * manager,
- EggToolbarsModel * model);
-void egg_toolbar_editor_set_model (EggToolbarEditor * t,
- EggToolbarsModel * model);
+GType egg_toolbar_editor_get_type (void);
+GtkWidget *egg_toolbar_editor_new (GtkUIManager *manager,
+ EggToolbarsModel *model);
+void egg_toolbar_editor_set_model (EggToolbarEditor *t,
+ EggToolbarsModel *model);
G_END_DECLS
+
#endif
diff --git a/src/toolbareditor/egg-toolbars-model.c b/src/toolbareditor/egg-toolbars-model.c
index 325f039..b9a5f44 100644
--- a/src/toolbareditor/egg-toolbars-model.c
+++ b/src/toolbareditor/egg-toolbars-model.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: egg-toolbars-model.c 929 2009-02-19 14:49:56Z friemann $
+ * $Id$
*/
#include "config.h"
@@ -30,7 +30,7 @@
#include <libxml/tree.h>
#include <gdk/gdk.h>
-static void egg_toolbars_model_finalize (GObject * object);
+static void egg_toolbars_model_finalize (GObject *object);
enum
{
@@ -65,7 +65,9 @@ struct EggToolbarsModelPrivate
};
G_DEFINE_TYPE (EggToolbarsModel, egg_toolbars_model, G_TYPE_OBJECT)
- static xmlDocPtr egg_toolbars_model_to_xml (EggToolbarsModel * model)
+
+static xmlDocPtr
+egg_toolbars_model_to_xml (EggToolbarsModel *model)
{
GNode *l1, *l2, *tl;
GList *l3;
@@ -76,45 +78,34 @@ G_DEFINE_TYPE (EggToolbarsModel, egg_toolbars_model, G_TYPE_OBJECT)
tl = model->priv->toolbars;
xmlIndentTreeOutput = TRUE;
- doc = xmlNewDoc ((const xmlChar *) "1.0");
- doc->children =
- xmlNewDocNode (doc, NULL, (const 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, (const xmlChar *) "toolbar", NULL);
- xmlSetProp (tnode, (const xmlChar *) "name",
- (const xmlChar *) toolbar->name);
- xmlSetProp (tnode, (const xmlChar *) "hidden",
- (toolbar->
- flags & EGG_TB_MODEL_HIDDEN) ? (const xmlChar *) "true"
- : (const xmlChar *) "false");
- xmlSetProp (tnode, (const xmlChar *) "editable",
- (toolbar->
- flags & EGG_TB_MODEL_NOT_EDITABLE) ? (const xmlChar *)
- "false" : (const xmlChar *) "true");
+ tnode = xmlNewChild (doc->children, NULL, (const xmlChar*) "toolbar", NULL);
+ xmlSetProp (tnode, (const xmlChar*) "name", (const xmlChar*) toolbar->name);
+ xmlSetProp (tnode, (const xmlChar*) "hidden",
+ (toolbar->flags&EGG_TB_MODEL_HIDDEN) ? (const xmlChar*) "true" : (const xmlChar*) "false");
+ xmlSetProp (tnode, (const xmlChar*) "editable",
+ (toolbar->flags&EGG_TB_MODEL_NOT_EDITABLE) ? (const xmlChar*) "false" : (const xmlChar*) "true");
for (l2 = l1->children; l2 != NULL; l2 = l2->next)
- {
- xmlNodePtr node;
- EggToolbarsItem *item = l2->data;
+ {
+ xmlNodePtr node;
+ EggToolbarsItem *item = l2->data;
if (strcmp (item->name, "_separator") == 0)
{
- node =
- xmlNewChild (tnode, NULL, (const xmlChar *) "separator",
- NULL);
+ node = xmlNewChild (tnode, NULL, (const xmlChar*) "separator", NULL);
continue;
}
- node =
- xmlNewChild (tnode, NULL, (const xmlChar *) "toolitem", NULL);
- xmlSetProp (node, (const xmlChar *) "name",
- (const xmlChar *) item->name);
+ node = xmlNewChild (tnode, NULL, (const xmlChar*) "toolitem", NULL);
+ xmlSetProp (node, (const xmlChar*) "name", (const xmlChar*) item->name);
/* Add 'data' nodes for each data type which can be written out for this
* item. Only write types which can be used to restore the data. */
@@ -129,19 +120,16 @@ G_DEFINE_TYPE (EggToolbarsModel, egg_toolbars_model, G_TYPE_OBJECT)
tmp = type->get_data (type, item->name);
if (tmp != NULL)
{
- dnode =
- xmlNewTextChild (node, NULL, (const xmlChar *) "data",
- (const xmlChar *) tmp);
+ dnode = xmlNewTextChild (node, NULL, (const xmlChar*) "data", (const xmlChar*) tmp);
g_free (tmp);
tmp = gdk_atom_name (type->type);
- xmlSetProp (dnode, (const xmlChar *) "type",
- (const xmlChar *) tmp);
+ xmlSetProp (dnode, (const xmlChar*) "type", (const xmlChar*) tmp);
g_free (tmp);
}
}
- }
- }
+ }
+ }
}
return doc;
@@ -150,62 +138,63 @@ G_DEFINE_TYPE (EggToolbarsModel, egg_toolbars_model, G_TYPE_OBJECT)
static gboolean
safe_save_xml (const char *xml_file, xmlDocPtr doc)
{
- char *tmp_file;
- char *old_file;
- gboolean old_exist;
- gboolean retval = TRUE;
-
- tmp_file = g_strconcat (xml_file, ".tmp", NULL);
- old_file = g_strconcat (xml_file, ".old", NULL);
-
- if (xmlSaveFormatFile (tmp_file, doc, 1) <= 0)
- {
- g_warning ("Failed to write XML data to %s", tmp_file);
- goto failed;
- }
-
- old_exist = g_file_test (xml_file, G_FILE_TEST_EXISTS);
-
- if (old_exist)
- {
- if (rename (xml_file, old_file) < 0)
- {
- g_warning ("Failed to rename %s to %s", xml_file, old_file);
- retval = FALSE;
- goto failed;
- }
- }
-
- if (rename (tmp_file, xml_file) < 0)
- {
- g_warning ("Failed to rename %s to %s", tmp_file, xml_file);
-
- if (rename (old_file, xml_file) < 0)
- {
- g_warning ("Failed to restore %s from %s", xml_file, tmp_file);
- }
- retval = FALSE;
- goto failed;
- }
-
- if (old_exist)
- {
- if (unlink (old_file) < 0)
- {
- g_warning ("Failed to delete old file %s", old_file);
- }
- }
-
-failed:
- g_free (old_file);
- g_free (tmp_file);
-
- return retval;
+ char *tmp_file;
+ char *old_file;
+ gboolean old_exist;
+ gboolean retval = TRUE;
+
+ tmp_file = g_strconcat (xml_file, ".tmp", NULL);
+ old_file = g_strconcat (xml_file, ".old", NULL);
+
+ if (xmlSaveFormatFile (tmp_file, doc, 1) <= 0)
+ {
+ g_warning ("Failed to write XML data to %s", tmp_file);
+ goto failed;
+ }
+
+ old_exist = g_file_test (xml_file, G_FILE_TEST_EXISTS);
+
+ if (old_exist)
+ {
+ if (rename (xml_file, old_file) < 0)
+ {
+ g_warning ("Failed to rename %s to %s", xml_file, old_file);
+ retval = FALSE;
+ goto failed;
+ }
+ }
+
+ if (rename (tmp_file, xml_file) < 0)
+ {
+ g_warning ("Failed to rename %s to %s", tmp_file, xml_file);
+
+ if (rename (old_file, xml_file) < 0)
+ {
+ g_warning ("Failed to restore %s from %s", xml_file, tmp_file);
+ }
+ retval = FALSE;
+ goto failed;
+ }
+
+ if (old_exist)
+ {
+ if (unlink (old_file) < 0)
+ {
+ g_warning ("Failed to delete old file %s", old_file);
+ }
+ }
+
+ failed:
+ g_free (old_file);
+ g_free (tmp_file);
+
+ return retval;
}
void
-egg_toolbars_model_save_toolbars (EggToolbarsModel * model,
- const char *xml_file, const char *version)
+egg_toolbars_model_save_toolbars (EggToolbarsModel *model,
+ const char *xml_file,
+ const char *version)
{
xmlDocPtr doc;
xmlNodePtr root;
@@ -214,31 +203,32 @@ egg_toolbars_model_save_toolbars (EggToolbarsModel * model,
doc = egg_toolbars_model_to_xml (model);
root = xmlDocGetRootElement (doc);
- xmlSetProp (root, (const xmlChar *) "version", (const xmlChar *) version);
+ xmlSetProp (root, (const xmlChar*) "version", (const xmlChar*) version);
safe_save_xml (xml_file, doc);
xmlFreeDoc (doc);
}
static gboolean
-is_unique (EggToolbarsModel * model, EggToolbarsItem * idata)
+is_unique (EggToolbarsModel *model,
+ EggToolbarsItem *idata)
{
EggToolbarsItem *idata2;
GNode *toolbar, *item;
- for (toolbar = g_node_first_child (model->priv->toolbars);
- toolbar != NULL; toolbar = g_node_next_sibling (toolbar))
+ for(toolbar = g_node_first_child (model->priv->toolbars);
+ toolbar != NULL; toolbar = g_node_next_sibling (toolbar))
{
- for (item = g_node_first_child (toolbar);
- item != NULL; item = g_node_next_sibling (item))
+ for(item = g_node_first_child (toolbar);
+ item != NULL; item = g_node_next_sibling (item))
{
- idata2 = item->data;
+ idata2 = item->data;
- if (idata != idata2 && strcmp (idata->name, idata2->name) == 0)
- {
- return FALSE;
- }
- }
+ if (idata != idata2 && strcmp (idata->name, idata2->name) == 0)
+ {
+ return FALSE;
+ }
+ }
}
return TRUE;
@@ -257,7 +247,7 @@ toolbar_node_new (const char *name)
}
static GNode *
-item_node_new (const char *name, EggToolbarsModel * model)
+item_node_new (const char *name, EggToolbarsModel *model)
{
EggToolbarsItem *item;
int flags;
@@ -267,28 +257,26 @@ item_node_new (const char *name, EggToolbarsModel * model)
item = g_new (EggToolbarsItem, 1);
item->name = g_strdup (name);
- flags =
- GPOINTER_TO_INT (g_hash_table_lookup (model->priv->flags, item->name));
+ flags = GPOINTER_TO_INT (g_hash_table_lookup (model->priv->flags, item->name));
if ((flags & EGG_TB_MODEL_NAME_INFINITE) == 0)
g_hash_table_insert (model->priv->flags,
- g_strdup (item->name),
- GINT_TO_POINTER (flags | EGG_TB_MODEL_NAME_USED));
+ g_strdup (item->name),
+ GINT_TO_POINTER (flags | EGG_TB_MODEL_NAME_USED));
return g_node_new (item);
}
static void
-item_node_free (GNode * item_node, EggToolbarsModel * model)
+item_node_free (GNode *item_node, EggToolbarsModel *model)
{
EggToolbarsItem *item = item_node->data;
int flags;
- flags =
- GPOINTER_TO_INT (g_hash_table_lookup (model->priv->flags, item->name));
+ flags = GPOINTER_TO_INT (g_hash_table_lookup (model->priv->flags, item->name));
if ((flags & EGG_TB_MODEL_NAME_INFINITE) == 0 && is_unique (model, item))
g_hash_table_insert (model->priv->flags,
- g_strdup (item->name),
- GINT_TO_POINTER (flags & ~EGG_TB_MODEL_NAME_USED));
+ g_strdup (item->name),
+ GINT_TO_POINTER (flags & ~EGG_TB_MODEL_NAME_USED));
g_free (item->name);
g_free (item);
@@ -297,12 +285,12 @@ item_node_free (GNode * item_node, EggToolbarsModel * model)
}
static void
-toolbar_node_free (GNode * toolbar_node, EggToolbarsModel * model)
+toolbar_node_free (GNode *toolbar_node, EggToolbarsModel *model)
{
EggToolbarsToolbar *toolbar = toolbar_node->data;
g_node_children_foreach (toolbar_node, G_TRAVERSE_ALL,
- (GNodeForeachFunc) item_node_free, model);
+ (GNodeForeachFunc) item_node_free, model);
g_free (toolbar->name);
g_free (toolbar);
@@ -311,7 +299,8 @@ toolbar_node_free (GNode * toolbar_node, EggToolbarsModel * model)
}
EggTbModelFlags
-egg_toolbars_model_get_flags (EggToolbarsModel * model, int toolbar_position)
+egg_toolbars_model_get_flags (EggToolbarsModel *model,
+ int toolbar_position)
{
GNode *toolbar_node;
EggToolbarsToolbar *toolbar;
@@ -325,8 +314,9 @@ egg_toolbars_model_get_flags (EggToolbarsModel * model, int toolbar_position)
}
void
-egg_toolbars_model_set_flags (EggToolbarsModel * model,
- int toolbar_position, EggTbModelFlags flags)
+egg_toolbars_model_set_flags (EggToolbarsModel *model,
+ int toolbar_position,
+ EggTbModelFlags flags)
{
GNode *toolbar_node;
EggToolbarsToolbar *toolbar;
@@ -339,23 +329,23 @@ egg_toolbars_model_set_flags (EggToolbarsModel * model,
toolbar->flags = flags;
g_signal_emit (G_OBJECT (model), signals[TOOLBAR_CHANGED],
- 0, toolbar_position);
+ 0, toolbar_position);
}
char *
-egg_toolbars_model_get_data (EggToolbarsModel * model,
- GdkAtom type, const char *name)
+egg_toolbars_model_get_data (EggToolbarsModel *model,
+ GdkAtom type,
+ const char *name)
{
EggToolbarsItemType *t;
char *data = NULL;
GList *l;
- if (type == GDK_NONE
- || type == gdk_atom_intern (EGG_TOOLBAR_ITEM_TYPE, FALSE))
+ if (type == GDK_NONE || type == gdk_atom_intern (EGG_TOOLBAR_ITEM_TYPE, FALSE))
{
g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (*name != 0, NULL);
+ g_return_val_if_fail (*name != 0, NULL);
return strdup (name);
}
@@ -365,8 +355,7 @@ egg_toolbars_model_get_data (EggToolbarsModel * model,
if (t->type == type && t->get_data != NULL)
{
data = t->get_data (t, name);
- if (data != NULL)
- break;
+ if (data != NULL) break;
}
}
@@ -374,15 +363,16 @@ egg_toolbars_model_get_data (EggToolbarsModel * model,
}
char *
-egg_toolbars_model_get_name (EggToolbarsModel * model,
- GdkAtom type, const char *data, gboolean create)
+egg_toolbars_model_get_name (EggToolbarsModel *model,
+ GdkAtom type,
+ const char *data,
+ gboolean create)
{
EggToolbarsItemType *t;
char *name = NULL;
GList *l;
- if (type == GDK_NONE
- || type == gdk_atom_intern (EGG_TOOLBAR_ITEM_TYPE, FALSE))
+ if (type == GDK_NONE || type == gdk_atom_intern (EGG_TOOLBAR_ITEM_TYPE, FALSE))
{
g_return_val_if_fail (data, NULL);
g_return_val_if_fail (*data, NULL);
@@ -414,8 +404,10 @@ egg_toolbars_model_get_name (EggToolbarsModel * model,
}
static gboolean
-impl_add_item (EggToolbarsModel * model,
- int toolbar_position, int position, const char *name)
+impl_add_item (EggToolbarsModel *model,
+ int toolbar_position,
+ int position,
+ const char *name)
{
GNode *parent_node;
GNode *child_node;
@@ -431,23 +423,25 @@ impl_add_item (EggToolbarsModel * model,
real_position = g_node_child_position (parent_node, child_node);
g_signal_emit (G_OBJECT (model), signals[ITEM_ADDED], 0,
- toolbar_position, real_position);
+ toolbar_position, real_position);
return TRUE;
}
gboolean
-egg_toolbars_model_add_item (EggToolbarsModel * model,
- int toolbar_position,
- int position, const char *name)
+egg_toolbars_model_add_item (EggToolbarsModel *model,
+ int toolbar_position,
+ int position,
+ const char *name)
{
EggToolbarsModelClass *klass = EGG_TOOLBARS_MODEL_GET_CLASS (model);
return klass->add_item (model, toolbar_position, position, name);
}
int
-egg_toolbars_model_add_toolbar (EggToolbarsModel * model,
- int position, const char *name)
+egg_toolbars_model_add_toolbar (EggToolbarsModel *model,
+ int position,
+ const char *name)
{
GNode *node;
int real_position;
@@ -459,28 +453,29 @@ egg_toolbars_model_add_toolbar (EggToolbarsModel * model,
real_position = g_node_child_position (model->priv->toolbars, node);
- g_signal_emit (G_OBJECT (model), signals[TOOLBAR_ADDED], 0, real_position);
+ g_signal_emit (G_OBJECT (model), signals[TOOLBAR_ADDED],
+ 0, real_position);
return g_node_child_position (model->priv->toolbars, node);
}
static char *
-parse_data_list (EggToolbarsModel * model, xmlNodePtr child, gboolean create)
+parse_data_list (EggToolbarsModel *model,
+ xmlNodePtr child,
+ gboolean create)
{
char *name = NULL;
while (child && name == NULL)
{
- if (xmlStrEqual (child->name, (const xmlChar *) "data"))
+ if (xmlStrEqual (child->name, (const xmlChar*) "data"))
{
- xmlChar *type = xmlGetProp (child, (const xmlChar *) "type");
+ xmlChar *type = xmlGetProp (child, (const xmlChar*) "type");
xmlChar *data = xmlNodeGetContent (child);
if (type != NULL)
{
- GdkAtom atom = gdk_atom_intern ((const char *) type, TRUE);
- name =
- egg_toolbars_model_get_name (model, atom, (const char *) data,
- create);
+ GdkAtom atom = gdk_atom_intern ((const char*) type, TRUE);
+ name = egg_toolbars_model_get_name (model, atom, (const char*) data, create);
}
xmlFree (type);
@@ -494,12 +489,14 @@ parse_data_list (EggToolbarsModel * model, xmlNodePtr child, gboolean create)
}
static void
-parse_item_list (EggToolbarsModel * model, xmlNodePtr child, int position)
+parse_item_list (EggToolbarsModel *model,
+ xmlNodePtr child,
+ int position)
{
while (child)
{
- if (xmlStrEqual (child->name, (const xmlChar *) "toolitem"))
- {
+ if (xmlStrEqual (child->name, (const xmlChar*) "toolitem"))
+ {
char *name;
/* Try to get the name using the data elements first,
@@ -513,20 +510,15 @@ parse_item_list (EggToolbarsModel * model, xmlNodePtr child, int position)
/* If that fails, try to use the name. */
if (name == NULL)
{
- xmlChar *type = xmlGetProp (child, (const xmlChar *) "type");
- xmlChar *data = xmlGetProp (child, (const xmlChar *) "name");
- GdkAtom atom =
- type ? gdk_atom_intern ((const char *) type, TRUE) : GDK_NONE;
+ xmlChar *type = xmlGetProp (child, (const xmlChar*) "type");
+ xmlChar *data = xmlGetProp (child, (const xmlChar*) "name");
+ GdkAtom atom = type ? gdk_atom_intern ((const char*) type, TRUE) : GDK_NONE;
/* If an old format, try to use it. */
- name =
- egg_toolbars_model_get_name (model, atom, (const char *) data,
- FALSE);
+ name = egg_toolbars_model_get_name (model, atom, (const char*) data, FALSE);
if (name == NULL)
{
- name =
- egg_toolbars_model_get_name (model, atom,
- (const char *) data, TRUE);
+ name = egg_toolbars_model_get_name (model, atom, (const char*) data, TRUE);
}
xmlFree (type);
@@ -538,75 +530,74 @@ parse_item_list (EggToolbarsModel * model, xmlNodePtr child, int position)
egg_toolbars_model_add_item (model, position, -1, name);
g_free (name);
}
- }
- else if (xmlStrEqual (child->name, (const xmlChar *) "separator"))
- {
+ }
+ else if (xmlStrEqual (child->name, (const xmlChar*) "separator"))
+ {
egg_toolbars_model_add_item (model, position, -1, "_separator");
- }
+ }
child = child->next;
}
}
static void
-parse_toolbars (EggToolbarsModel * model, xmlNodePtr child)
+parse_toolbars (EggToolbarsModel *model,
+ xmlNodePtr child)
{
while (child)
{
- if (xmlStrEqual (child->name, (const xmlChar *) "toolbar"))
- {
- xmlChar *string;
- int position;
+ if (xmlStrEqual (child->name, (const xmlChar*) "toolbar"))
+ {
+ xmlChar *string;
+ int position;
EggTbModelFlags flags;
- string = xmlGetProp (child, (const xmlChar *) "name");
- position =
- egg_toolbars_model_add_toolbar (model, -1, (const char *) string);
+ string = xmlGetProp (child, (const xmlChar*) "name");
+ position = egg_toolbars_model_add_toolbar (model, -1, (const char*) string);
flags = egg_toolbars_model_get_flags (model, position);
- xmlFree (string);
+ xmlFree (string);
- string = xmlGetProp (child, (const xmlChar *) "editable");
- if (string && xmlStrEqual (string, (const xmlChar *) "false"))
+ string = xmlGetProp (child, (const xmlChar*) "editable");
+ if (string && xmlStrEqual (string, (const xmlChar*) "false"))
flags |= EGG_TB_MODEL_NOT_EDITABLE;
- xmlFree (string);
+ xmlFree (string);
- string = xmlGetProp (child, (const xmlChar *) "hidden");
- if (string && xmlStrEqual (string, (const xmlChar *) "true"))
+ string = xmlGetProp (child, (const xmlChar*) "hidden");
+ if (string && xmlStrEqual (string, (const xmlChar*) "true"))
flags |= EGG_TB_MODEL_HIDDEN;
- xmlFree (string);
+ xmlFree (string);
- string = xmlGetProp (child, (const xmlChar *) "style");
- if (string && xmlStrEqual (string, (const xmlChar *) "icons-only"))
+ string = xmlGetProp (child, (const xmlChar*) "style");
+ if (string && xmlStrEqual (string, (const xmlChar*) "icons-only"))
flags |= EGG_TB_MODEL_ICONS;
- xmlFree (string);
+ xmlFree (string);
egg_toolbars_model_set_flags (model, position, flags);
- parse_item_list (model, child->children, position);
- }
+ parse_item_list (model, child->children, position);
+ }
child = child->next;
}
}
gboolean
-egg_toolbars_model_load_toolbars (EggToolbarsModel * model,
- const char *xml_file)
+egg_toolbars_model_load_toolbars (EggToolbarsModel *model,
+ const char *xml_file)
{
xmlDocPtr doc;
xmlNodePtr root;
g_return_val_if_fail (EGG_IS_TOOLBARS_MODEL (model), FALSE);
- if (!xml_file || !g_file_test (xml_file, G_FILE_TEST_EXISTS))
- return FALSE;
+ if (!xml_file || !g_file_test (xml_file, G_FILE_TEST_EXISTS)) return FALSE;
doc = xmlParseFile (xml_file);
if (doc == NULL)
- {
- g_warning ("Failed to load XML data from %s", xml_file);
- return FALSE;
- }
+ {
+ g_warning ("Failed to load XML data from %s", xml_file);
+ return FALSE;
+ }
root = xmlDocGetRootElement (doc);
parse_toolbars (model, root->children);
@@ -617,58 +608,60 @@ egg_toolbars_model_load_toolbars (EggToolbarsModel * model,
}
static void
-parse_available_list (EggToolbarsModel * model, xmlNodePtr child)
+parse_available_list (EggToolbarsModel *model,
+ xmlNodePtr child)
{
gint flags;
while (child)
{
- if (xmlStrEqual (child->name, (const xmlChar *) "toolitem"))
- {
- xmlChar *name;
-
- name = xmlGetProp (child, (const xmlChar *) "name");
- flags = egg_toolbars_model_get_name_flags
- (model, (const char *) name);
- egg_toolbars_model_set_name_flags
- (model, (const char *) name, flags | EGG_TB_MODEL_NAME_KNOWN);
- xmlFree (name);
- }
+ if (xmlStrEqual (child->name, (const xmlChar*) "toolitem"))
+ {
+ xmlChar *name;
+
+ name = xmlGetProp (child, (const xmlChar*) "name");
+ flags = egg_toolbars_model_get_name_flags
+ (model, (const char*)name);
+ egg_toolbars_model_set_name_flags
+ (model, (const char*)name, flags | EGG_TB_MODEL_NAME_KNOWN);
+ xmlFree (name);
+ }
child = child->next;
}
}
static void
-parse_names (EggToolbarsModel * model, xmlNodePtr child)
+parse_names (EggToolbarsModel *model,
+ xmlNodePtr child)
{
while (child)
{
- if (xmlStrEqual (child->name, (const xmlChar *) "available"))
- {
- parse_available_list (model, child->children);
- }
+ if (xmlStrEqual (child->name, (const xmlChar*) "available"))
+ {
+ parse_available_list (model, child->children);
+ }
child = child->next;
}
}
gboolean
-egg_toolbars_model_load_names (EggToolbarsModel * model, const char *xml_file)
+egg_toolbars_model_load_names (EggToolbarsModel *model,
+ const char *xml_file)
{
xmlDocPtr doc;
xmlNodePtr root;
g_return_val_if_fail (EGG_IS_TOOLBARS_MODEL (model), FALSE);
- if (!xml_file || !g_file_test (xml_file, G_FILE_TEST_EXISTS))
- return FALSE;
+ if (!xml_file || !g_file_test (xml_file, G_FILE_TEST_EXISTS)) return FALSE;
doc = xmlParseFile (xml_file);
if (doc == NULL)
- {
- g_warning ("Failed to load XML data from %s", xml_file);
- return FALSE;
- }
+ {
+ g_warning ("Failed to load XML data from %s", xml_file);
+ return FALSE;
+ }
root = xmlDocGetRootElement (doc);
parse_names (model, root->children);
@@ -679,10 +672,10 @@ egg_toolbars_model_load_names (EggToolbarsModel * model, const char *xml_file)
}
static void
-egg_toolbars_model_class_init (EggToolbarsModelClass * klass)
+egg_toolbars_model_class_init (EggToolbarsModelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- volatile GType flags_type; /* work around gcc's optimiser */
+ volatile GType flags_type; /* work around gcc's optimiser */
/* make sure the flags type is known */
flags_type = EGG_TYPE_TB_MODEL_FLAGS;
@@ -693,63 +686,62 @@ egg_toolbars_model_class_init (EggToolbarsModelClass * klass)
signals[ITEM_ADDED] =
g_signal_new ("item_added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolbarsModelClass, item_added),
- NULL, NULL, _egg_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggToolbarsModelClass, item_added),
+ NULL, NULL, _egg_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
signals[TOOLBAR_ADDED] =
g_signal_new ("toolbar_added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_added),
- NULL, NULL, g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_added),
+ NULL, NULL, g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
signals[ITEM_REMOVED] =
g_signal_new ("item_removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolbarsModelClass, item_removed),
- NULL, NULL, _egg_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggToolbarsModelClass, item_removed),
+ NULL, NULL, _egg_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
signals[TOOLBAR_REMOVED] =
g_signal_new ("toolbar_removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_removed),
- NULL, NULL, g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_removed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
signals[TOOLBAR_CHANGED] =
g_signal_new ("toolbar_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_changed),
- NULL, NULL, g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
g_type_class_add_private (object_class, sizeof (EggToolbarsModelPrivate));
}
static void
-egg_toolbars_model_init (EggToolbarsModel * model)
+egg_toolbars_model_init (EggToolbarsModel *model)
{
- model->priv = EGG_TOOLBARS_MODEL_GET_PRIVATE (model);
+ model->priv =EGG_TOOLBARS_MODEL_GET_PRIVATE (model);
model->priv->toolbars = g_node_new (NULL);
- model->priv->flags =
- g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ model->priv->flags = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
egg_toolbars_model_set_name_flags (model, "_separator",
- EGG_TB_MODEL_NAME_KNOWN |
- EGG_TB_MODEL_NAME_INFINITE);
+ EGG_TB_MODEL_NAME_KNOWN |
+ EGG_TB_MODEL_NAME_INFINITE);
}
static void
-egg_toolbars_model_finalize (GObject * object)
+egg_toolbars_model_finalize (GObject *object)
{
EggToolbarsModel *model = EGG_TOOLBARS_MODEL (object);
g_node_children_foreach (model->priv->toolbars, G_TRAVERSE_ALL,
- (GNodeForeachFunc) toolbar_node_free, model);
+ (GNodeForeachFunc) toolbar_node_free, model);
g_node_destroy (model->priv->toolbars);
g_hash_table_destroy (model->priv->flags);
@@ -763,7 +755,8 @@ egg_toolbars_model_new (void)
}
void
-egg_toolbars_model_remove_toolbar (EggToolbarsModel * model, int position)
+egg_toolbars_model_remove_toolbar (EggToolbarsModel *model,
+ int position)
{
GNode *node;
EggTbModelFlags flags;
@@ -779,13 +772,15 @@ egg_toolbars_model_remove_toolbar (EggToolbarsModel * model, int position)
toolbar_node_free (node, model);
- g_signal_emit (G_OBJECT (model), signals[TOOLBAR_REMOVED], 0, position);
+ g_signal_emit (G_OBJECT (model), signals[TOOLBAR_REMOVED],
+ 0, position);
}
}
void
-egg_toolbars_model_remove_item (EggToolbarsModel * model,
- int toolbar_position, int position)
+egg_toolbars_model_remove_item (EggToolbarsModel *model,
+ int toolbar_position,
+ int position)
{
GNode *node, *toolbar;
@@ -800,14 +795,15 @@ egg_toolbars_model_remove_item (EggToolbarsModel * model,
item_node_free (node, model);
g_signal_emit (G_OBJECT (model), signals[ITEM_REMOVED], 0,
- toolbar_position, position);
+ toolbar_position, position);
}
void
-egg_toolbars_model_move_item (EggToolbarsModel * model,
- int toolbar_position,
- int position,
- int new_toolbar_position, int new_position)
+egg_toolbars_model_move_item (EggToolbarsModel *model,
+ int toolbar_position,
+ int position,
+ int new_toolbar_position,
+ int new_position)
{
GNode *node, *toolbar, *new_toolbar;
@@ -816,8 +812,7 @@ egg_toolbars_model_move_item (EggToolbarsModel * model,
toolbar = g_node_nth_child (model->priv->toolbars, toolbar_position);
g_return_if_fail (toolbar != NULL);
- new_toolbar =
- g_node_nth_child (model->priv->toolbars, new_toolbar_position);
+ new_toolbar = g_node_nth_child (model->priv->toolbars, new_toolbar_position);
g_return_if_fail (new_toolbar != NULL);
node = g_node_nth_child (toolbar, position);
@@ -826,16 +821,17 @@ egg_toolbars_model_move_item (EggToolbarsModel * model,
g_node_unlink (node);
g_signal_emit (G_OBJECT (model), signals[ITEM_REMOVED], 0,
- toolbar_position, position);
+ toolbar_position, position);
g_node_insert (new_toolbar, new_position, node);
g_signal_emit (G_OBJECT (model), signals[ITEM_ADDED], 0,
- new_toolbar_position, new_position);
+ new_toolbar_position, new_position);
}
void
-egg_toolbars_model_delete_item (EggToolbarsModel * model, const char *name)
+egg_toolbars_model_delete_item (EggToolbarsModel *model,
+ const char *name)
{
EggToolbarsItem *idata;
EggToolbarsToolbar *tdata;
@@ -855,40 +851,43 @@ egg_toolbars_model_delete_item (EggToolbarsModel * model, const char *name)
/* Don't delete toolbars that were already empty */
if (item == NULL)
{
- toolbar = g_node_next_sibling (toolbar);
- continue;
+ toolbar = g_node_next_sibling (toolbar);
+ continue;
}
while (item != NULL)
{
- next = g_node_next_sibling (item);
- idata = item->data;
- if (strcmp (idata->name, name) == 0)
- {
- item_node_free (item, model);
- g_signal_emit (G_OBJECT (model),
- signals[ITEM_REMOVED], 0, tpos, ipos);
- }
- else
- {
- ipos++;
- }
-
- item = next;
+ next = g_node_next_sibling (item);
+ idata = item->data;
+ if (strcmp (idata->name, name) == 0)
+ {
+ item_node_free (item, model);
+ g_signal_emit (G_OBJECT (model),
+ signals[ITEM_REMOVED],
+ 0, tpos, ipos);
+ }
+ else
+ {
+ ipos++;
+ }
+
+ item = next;
}
next = g_node_next_sibling (toolbar);
tdata = toolbar->data;
if (!(tdata->flags & EGG_TB_MODEL_NOT_REMOVABLE) &&
- g_node_first_child (toolbar) == NULL)
+ g_node_first_child (toolbar) == NULL)
{
- toolbar_node_free (toolbar, model);
+ toolbar_node_free (toolbar, model);
- g_signal_emit (G_OBJECT (model), signals[TOOLBAR_REMOVED], 0, tpos);
+ g_signal_emit (G_OBJECT (model),
+ signals[TOOLBAR_REMOVED],
+ 0, tpos);
}
else
{
- tpos++;
+ tpos++;
}
toolbar = next;
@@ -896,7 +895,8 @@ egg_toolbars_model_delete_item (EggToolbarsModel * model, const char *name)
}
int
-egg_toolbars_model_n_items (EggToolbarsModel * model, int toolbar_position)
+egg_toolbars_model_n_items (EggToolbarsModel *model,
+ int toolbar_position)
{
GNode *toolbar;
@@ -907,8 +907,9 @@ egg_toolbars_model_n_items (EggToolbarsModel * model, int toolbar_position)
}
const char *
-egg_toolbars_model_item_nth (EggToolbarsModel * model,
- int toolbar_position, int position)
+egg_toolbars_model_item_nth (EggToolbarsModel *model,
+ int toolbar_position,
+ int position)
{
GNode *toolbar;
GNode *item;
@@ -925,13 +926,14 @@ egg_toolbars_model_item_nth (EggToolbarsModel * model,
}
int
-egg_toolbars_model_n_toolbars (EggToolbarsModel * model)
+egg_toolbars_model_n_toolbars (EggToolbarsModel *model)
{
return g_node_n_children (model->priv->toolbars);
}
const char *
-egg_toolbars_model_toolbar_nth (EggToolbarsModel * model, int position)
+egg_toolbars_model_toolbar_nth (EggToolbarsModel *model,
+ int position)
{
GNode *toolbar;
EggToolbarsToolbar *tdata;
@@ -945,27 +947,27 @@ egg_toolbars_model_toolbar_nth (EggToolbarsModel * model, int position)
}
GList *
-egg_toolbars_model_get_types (EggToolbarsModel * model)
+egg_toolbars_model_get_types (EggToolbarsModel *model)
{
return model->priv->types;
}
void
-egg_toolbars_model_set_types (EggToolbarsModel * model, GList * types)
+egg_toolbars_model_set_types (EggToolbarsModel *model, GList *types)
{
model->priv->types = types;
}
static void
-fill_avail_array (gpointer key, gpointer value, GPtrArray * array)
+fill_avail_array (gpointer key, gpointer value, GPtrArray *array)
{
int flags = GPOINTER_TO_INT (value);
if ((flags & EGG_TB_MODEL_NAME_KNOWN) && !(flags & EGG_TB_MODEL_NAME_USED))
- g_ptr_array_add (array, key);
+ g_ptr_array_add (array, key);
}
GPtrArray *
-egg_toolbars_model_get_name_avail (EggToolbarsModel * model)
+egg_toolbars_model_get_name_avail (EggToolbarsModel *model)
{
GPtrArray *array = g_ptr_array_new ();
g_hash_table_foreach (model->priv->flags, (GHFunc) fill_avail_array, array);
@@ -973,15 +975,13 @@ egg_toolbars_model_get_name_avail (EggToolbarsModel * model)
}
gint
-egg_toolbars_model_get_name_flags (EggToolbarsModel * model, const char *name)
+egg_toolbars_model_get_name_flags (EggToolbarsModel *model, const char *name)
{
return GPOINTER_TO_INT (g_hash_table_lookup (model->priv->flags, name));
}
void
-egg_toolbars_model_set_name_flags (EggToolbarsModel * model, const char *name,
- gint flags)
+egg_toolbars_model_set_name_flags (EggToolbarsModel *model, const char *name, gint flags)
{
- g_hash_table_insert (model->priv->flags, g_strdup (name),
- GINT_TO_POINTER (flags));
+ g_hash_table_insert (model->priv->flags, g_strdup (name), GINT_TO_POINTER (flags));
}
diff --git a/src/toolbareditor/egg-toolbars-model.h b/src/toolbareditor/egg-toolbars-model.h
index 051a702..baca486 100644
--- a/src/toolbareditor/egg-toolbars-model.h
+++ b/src/toolbareditor/egg-toolbars-model.h
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: egg-toolbars-model.h 929 2009-02-19 14:49:56Z friemann $
+ * $Id$
*/
#ifndef EGG_TOOLBARS_MODEL_H
@@ -26,43 +26,45 @@
#include <gdk/gdk.h>
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))
#define EGG_IS_TOOLBARS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TOOLBARS_MODEL))
#define EGG_IS_TOOLBARS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TOOLBARS_MODEL))
#define EGG_TOOLBARS_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TOOLBARS_MODEL, EggToolbarsModelClass))
-typedef struct EggToolbarsModel EggToolbarsModel;
-typedef struct EggToolbarsModelPrivate EggToolbarsModelPrivate;
-typedef struct EggToolbarsModelClass EggToolbarsModelClass;
+
+typedef struct EggToolbarsModel EggToolbarsModel;
+typedef struct EggToolbarsModelPrivate EggToolbarsModelPrivate;
+typedef struct EggToolbarsModelClass EggToolbarsModelClass;
#define EGG_TOOLBAR_ITEM_TYPE "application/x-toolbar-item"
typedef enum
{
- EGG_TB_MODEL_NOT_REMOVABLE = 1 << 0,
- EGG_TB_MODEL_NOT_EDITABLE = 1 << 1,
- EGG_TB_MODEL_BOTH = 1 << 2,
- EGG_TB_MODEL_BOTH_HORIZ = 1 << 3,
- EGG_TB_MODEL_ICONS = 1 << 4,
- EGG_TB_MODEL_TEXT = 1 << 5,
- EGG_TB_MODEL_STYLES_MASK = 0x3C,
+ EGG_TB_MODEL_NOT_REMOVABLE = 1 << 0,
+ EGG_TB_MODEL_NOT_EDITABLE = 1 << 1,
+ EGG_TB_MODEL_BOTH = 1 << 2,
+ EGG_TB_MODEL_BOTH_HORIZ = 1 << 3,
+ EGG_TB_MODEL_ICONS = 1 << 4,
+ EGG_TB_MODEL_TEXT = 1 << 5,
+ EGG_TB_MODEL_STYLES_MASK = 0x3C,
EGG_TB_MODEL_ACCEPT_ITEMS_ONLY = 1 << 6,
- EGG_TB_MODEL_HIDDEN = 1 << 7
+ EGG_TB_MODEL_HIDDEN = 1 << 7
} EggTbModelFlags;
typedef enum
{
- EGG_TB_MODEL_NAME_USED = 1 << 0,
- EGG_TB_MODEL_NAME_INFINITE = 1 << 1,
- EGG_TB_MODEL_NAME_KNOWN = 1 << 2
+ EGG_TB_MODEL_NAME_USED = 1 << 0,
+ EGG_TB_MODEL_NAME_INFINITE = 1 << 1,
+ EGG_TB_MODEL_NAME_KNOWN = 1 << 2
} EggTbModelNameFlags;
struct EggToolbarsModel
{
GObject parent_object;
- /*< private > */
+ /*< private >*/
EggToolbarsModelPrivate *priv;
};
@@ -71,18 +73,24 @@ struct EggToolbarsModelClass
GObjectClass parent_class;
/* Signals */
- void (*item_added) (EggToolbarsModel * model,
- int toolbar_position, int position);
- void (*item_removed) (EggToolbarsModel * model,
- int toolbar_position, int position);
- void (*toolbar_added) (EggToolbarsModel * model, int position);
- void (*toolbar_changed) (EggToolbarsModel * model, int position);
- void (*toolbar_removed) (EggToolbarsModel * model, int position);
+ void (* item_added) (EggToolbarsModel *model,
+ int toolbar_position,
+ int position);
+ void (* item_removed) (EggToolbarsModel *model,
+ int toolbar_position,
+ int position);
+ void (* toolbar_added) (EggToolbarsModel *model,
+ int position);
+ void (* toolbar_changed) (EggToolbarsModel *model,
+ int position);
+ void (* toolbar_removed) (EggToolbarsModel *model,
+ int position);
/* Virtual Table */
- gboolean (*add_item) (EggToolbarsModel * t,
- int toolbar_position,
- int position, const char *name);
+ gboolean (* add_item) (EggToolbarsModel *t,
+ int toolbar_position,
+ int position,
+ const char *name);
};
typedef struct EggToolbarsItemType EggToolbarsItemType;
@@ -91,79 +99,92 @@ struct EggToolbarsItemType
{
GdkAtom type;
- gboolean (*has_data) (EggToolbarsItemType * type, const char *name);
- char *(*get_data) (EggToolbarsItemType * type, const char *name);
+ gboolean (* has_data) (EggToolbarsItemType *type,
+ const char *name);
+ char * (* get_data) (EggToolbarsItemType *type,
+ const char *name);
- char *(*new_name) (EggToolbarsItemType * type, const char *data);
- char *(*get_name) (EggToolbarsItemType * type, const char *data);
+ char * (* new_name) (EggToolbarsItemType *type,
+ const char *data);
+ char * (* get_name) (EggToolbarsItemType *type,
+ const char *data);
};
-GType egg_tb_model_flags_get_type (void);
-GType egg_toolbars_model_get_type (void);
-EggToolbarsModel *egg_toolbars_model_new (void);
-gboolean egg_toolbars_model_load_names (EggToolbarsModel * model,
- const char *xml_file);
-gboolean egg_toolbars_model_load_toolbars (EggToolbarsModel * model,
- const char *xml_file);
-void egg_toolbars_model_save_toolbars (EggToolbarsModel * model,
- const char *xml_file,
- const char *version);
+GType egg_tb_model_flags_get_type (void);
+GType egg_toolbars_model_get_type (void);
+EggToolbarsModel *egg_toolbars_model_new (void);
+gboolean egg_toolbars_model_load_names (EggToolbarsModel *model,
+ const char *xml_file);
+gboolean egg_toolbars_model_load_toolbars (EggToolbarsModel *model,
+ const char *xml_file);
+void egg_toolbars_model_save_toolbars (EggToolbarsModel *model,
+ const char *xml_file,
+ const char *version);
/* Functions for manipulating the types of portable data this toolbar understands. */
-GList *egg_toolbars_model_get_types (EggToolbarsModel * model);
-void egg_toolbars_model_set_types (EggToolbarsModel * model, GList * types);
+GList * egg_toolbars_model_get_types (EggToolbarsModel *model);
+void egg_toolbars_model_set_types (EggToolbarsModel *model,
+ GList *types);
/* Functions for converting between name and portable data. */
-char *egg_toolbars_model_get_name (EggToolbarsModel * model,
- GdkAtom type,
- const char *data, gboolean create);
-char *egg_toolbars_model_get_data (EggToolbarsModel * model,
- GdkAtom type, const char *name);
+char * egg_toolbars_model_get_name (EggToolbarsModel *model,
+ GdkAtom type,
+ const char *data,
+ gboolean create);
+char * egg_toolbars_model_get_data (EggToolbarsModel *model,
+ GdkAtom type,
+ const char *name);
/* Functions for retrieving what items are available for adding to the toolbars. */
-GPtrArray *egg_toolbars_model_get_name_avail (EggToolbarsModel * model);
-gint egg_toolbars_model_get_name_flags (EggToolbarsModel * model,
- const char *name);
-void egg_toolbars_model_set_name_flags (EggToolbarsModel * model,
- const char *name, gint flags);
+GPtrArray * egg_toolbars_model_get_name_avail (EggToolbarsModel *model);
+gint egg_toolbars_model_get_name_flags (EggToolbarsModel *model,
+ const char *name);
+void egg_toolbars_model_set_name_flags (EggToolbarsModel *model,
+ const char *name,
+ gint flags);
/* Functions for manipulating flags on individual toolbars. */
-EggTbModelFlags egg_toolbars_model_get_flags (EggToolbarsModel * model,
- int toolbar_position);
-void egg_toolbars_model_set_flags (EggToolbarsModel * model,
- int toolbar_position,
- EggTbModelFlags flags);
+EggTbModelFlags egg_toolbars_model_get_flags (EggToolbarsModel *model,
+ int toolbar_position);
+void egg_toolbars_model_set_flags (EggToolbarsModel *model,
+ int toolbar_position,
+ EggTbModelFlags flags);
/* Functions for adding and removing toolbars. */
-int egg_toolbars_model_add_toolbar (EggToolbarsModel * model,
- int position, const char *name);
-void egg_toolbars_model_remove_toolbar (EggToolbarsModel * model,
- int position);
+int egg_toolbars_model_add_toolbar (EggToolbarsModel *model,
+ int position,
+ const char *name);
+void egg_toolbars_model_remove_toolbar (EggToolbarsModel *model,
+ int position);
/* Functions for adding, removing and moving items. */
-gboolean egg_toolbars_model_add_item (EggToolbarsModel * model,
- int toolbar_position,
- int position, const char *name);
-void egg_toolbars_model_remove_item (EggToolbarsModel * model,
- int toolbar_position, int position);
-void egg_toolbars_model_move_item (EggToolbarsModel * model,
- int toolbar_position,
- int position,
- int new_toolbar_position,
- int new_position);
-void egg_toolbars_model_delete_item (EggToolbarsModel * model,
- const char *name);
+gboolean egg_toolbars_model_add_item (EggToolbarsModel *model,
+ int toolbar_position,
+ int position,
+ const char *name);
+void egg_toolbars_model_remove_item (EggToolbarsModel *model,
+ int toolbar_position,
+ int position);
+void egg_toolbars_model_move_item (EggToolbarsModel *model,
+ int toolbar_position,
+ int position,
+ int new_toolbar_position,
+ int new_position);
+void egg_toolbars_model_delete_item (EggToolbarsModel *model,
+ const char *name);
/* Functions for accessing the names of items. */
-int egg_toolbars_model_n_items (EggToolbarsModel * model,
- int toolbar_position);
-const char *egg_toolbars_model_item_nth (EggToolbarsModel * model,
- int toolbar_position, int position);
+int egg_toolbars_model_n_items (EggToolbarsModel *model,
+ int toolbar_position);
+const char * egg_toolbars_model_item_nth (EggToolbarsModel *model,
+ int toolbar_position,
+ int position);
/* Functions for accessing the names of toolbars. */
-int egg_toolbars_model_n_toolbars (EggToolbarsModel * model);
-const char *egg_toolbars_model_toolbar_nth (EggToolbarsModel * model,
- int position);
+int egg_toolbars_model_n_toolbars (EggToolbarsModel *model);
+const char *egg_toolbars_model_toolbar_nth (EggToolbarsModel *model,
+ int position);
G_END_DECLS
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]