libegg r929 - in trunk: . libegg/toolbareditor
- From: friemann svn gnome org
- To: svn-commits-list gnome org
- Subject: libegg r929 - in trunk: . libegg/toolbareditor
- Date: Thu, 19 Feb 2009 14:49:56 +0000 (UTC)
Author: friemann
Date: Thu Feb 19 14:49:56 2009
New Revision: 929
URL: http://svn.gnome.org/viewvc/libegg?rev=929&view=rev
Log:
2009-02-19 Felix Riemann <friemann svn gnome org>
* libegg/toolbareditor/*.c:
* libegg/toolbareditor/*.h:
Strip trailing whitespaces and readd accidentially removed
function prototype. Fixes bug #572418.
Modified:
trunk/ChangeLog
trunk/libegg/toolbareditor/egg-editable-toolbar.c
trunk/libegg/toolbareditor/egg-toolbar-editor.c
trunk/libegg/toolbareditor/egg-toolbars-model.c
trunk/libegg/toolbareditor/egg-toolbars-model.h
trunk/libegg/toolbareditor/update-toolbareditor-from-libegg.sh
Modified: trunk/libegg/toolbareditor/egg-editable-toolbar.c
==============================================================================
--- trunk/libegg/toolbareditor/egg-editable-toolbar.c (original)
+++ trunk/libegg/toolbareditor/egg-editable-toolbar.c Thu Feb 19 14:49:56 2009
@@ -66,10 +66,10 @@
guint edit_mode;
gboolean save_hidden;
GtkWidget *fixed_toolbar;
-
+
GtkWidget *selected;
GtkActionGroup *actions;
-
+
guint visibility_id;
GList *visibility_paths;
GPtrArray *visibility_actions;
@@ -197,12 +197,12 @@
{
GtkAction *action;
gint flags;
-
+
gtk_widget_hide (widget);
action = gtk_widget_get_action (widget);
if (action == NULL) return;
-
+
flags = egg_toolbars_model_get_name_flags (etoolbar->priv->model,
gtk_action_get_name (action));
if (!(flags & EGG_TB_MODEL_NAME_INFINITE))
@@ -221,14 +221,14 @@
{
GtkAction *action;
gint flags;
-
+
if (gtk_widget_get_parent (widget) != NULL)
{
gtk_widget_show (widget);
action = gtk_widget_get_action (widget);
if (action == NULL) return;
-
+
flags = egg_toolbars_model_get_name_flags (etoolbar->priv->model,
gtk_action_get_name (action));
if (!(flags & EGG_TB_MODEL_NAME_INFINITE))
@@ -255,14 +255,14 @@
g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (etoolbar));
model = egg_editable_toolbar_get_model (etoolbar);
-
+
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);
g_return_if_fail (name != NULL);
}
-
+
data = egg_toolbars_model_get_data (model, selection_data->target, name);
if (data != NULL)
{
@@ -288,7 +288,7 @@
gdk_event_get_state (realevent, &event.state);
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_target_list_unref (list);
}
@@ -299,9 +299,9 @@
{
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),
+ pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolitem->parent),
GTK_TOOL_ITEM (toolitem));
egg_toolbars_model_remove_item (etoolbar->priv->model,
@@ -343,11 +343,11 @@
if (etoolbar->priv->popup_path != NULL)
{
GtkMenu *menu;
-
+
egg_editable_toolbar_set_selected (etoolbar, toolbar);
g_object_notify (G_OBJECT (etoolbar), "selected");
-
- menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
+
+ menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
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 ());
@@ -365,21 +365,21 @@
if (event->button == 3 && etoolbar->priv->popup_path != NULL)
{
GtkMenu *menu;
-
+
egg_editable_toolbar_set_selected (etoolbar, widget);
g_object_notify (G_OBJECT (etoolbar), "selected");
-
- menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
+
+ menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
etoolbar->priv->popup_path));
g_return_val_if_fail (menu != NULL, FALSE);
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);
-
+
return TRUE;
}
-
+
return FALSE;
}
@@ -388,19 +388,19 @@
{
GtkAction *action;
char *name;
-
+
name = g_object_get_data (G_OBJECT (item), EGG_ITEM_NAME);
action = name ? find_action (etoolbar, name) : NULL;
-
+
if (action)
{
g_object_notify (G_OBJECT (action), "sensitive");
}
gtk_tool_item_set_use_drag_window (item,
- (etoolbar->priv->edit_mode > 0) ||
+ (etoolbar->priv->edit_mode > 0) ||
GTK_IS_SEPARATOR_TOOL_ITEM (item));
-
+
}
static void
@@ -419,7 +419,7 @@
GdkPixbuf *pixbuf = NULL;
screen = gtk_widget_get_screen (GTK_WIDGET (etoolbar));
-
+
cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
GDK_HAND2);
gdk_window_set_cursor (widget->window, cursor);
@@ -470,7 +470,7 @@
MIN (width, height), 0, NULL);
}
else if (stock_id)
- {
+ {
pixbuf = gtk_widget_render_icon (widget, stock_id,
GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
}
@@ -498,7 +498,7 @@
configure_item_tooltip (GtkToolItem *item)
{
GtkAction *action = gtk_widget_get_action (GTK_WIDGET (item));
-
+
if (action != NULL)
{
g_object_notify (G_OBJECT (action), "tooltip");
@@ -519,19 +519,19 @@
if (GTK_IS_TOOL_ITEM (proxy))
{
g_signal_connect_object (proxy, "drag_begin",
- G_CALLBACK (drag_begin_cb),
+ G_CALLBACK (drag_begin_cb),
etoolbar, 0);
g_signal_connect_object (proxy, "drag_end",
G_CALLBACK (drag_end_cb),
etoolbar, 0);
g_signal_connect_object (proxy, "drag_data_get",
- G_CALLBACK (drag_data_get_cb),
+ G_CALLBACK (drag_data_get_cb),
etoolbar, 0);
g_signal_connect_object (proxy, "drag_data_delete",
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",
@@ -541,7 +541,7 @@
}
static void
-action_sensitive_cb (GtkAction *action,
+action_sensitive_cb (GtkAction *action,
GParamSpec *pspec,
GtkToolItem *item)
{
@@ -561,7 +561,7 @@
GtkToolItem *item;
g_return_val_if_fail (name != NULL, NULL);
-
+
if (strcmp (name, "_separator") == 0)
{
item = gtk_separator_tool_item_new ();
@@ -570,7 +570,7 @@
{
GtkAction *action = find_action (etoolbar, name);
if (action == NULL) return NULL;
-
+
item = GTK_TOOL_ITEM (gtk_action_create_tool_item (action));
/* Normally done on-demand by the GtkUIManager, but no
@@ -578,7 +578,7 @@
*/
gtk_action_set_accel_group
(action, gtk_ui_manager_get_accel_group(etoolbar->priv->manager));
-
+
g_signal_connect_object (action, "notify::sensitive",
G_CALLBACK (action_sensitive_cb), item, 0);
}
@@ -586,8 +586,8 @@
gtk_widget_show (GTK_WIDGET (item));
g_object_set_data_full (G_OBJECT (item), EGG_ITEM_NAME,
- g_strdup (name), g_free);
-
+ g_strdup (name), g_free);
+
return item;
}
@@ -628,11 +628,11 @@
GdkAtom type = selection_data->type;
const char *data = (char *)selection_data->data;
-
+
int ipos = -1;
char *name = NULL;
gboolean used = FALSE;
-
+
/* Find out where the drop is occuring, and the name of what is being dropped. */
if (selection_data->length >= 0)
{
@@ -648,7 +648,7 @@
if (etoolbar->priv->dnd_pending > 0)
{
etoolbar->priv->dnd_pending--;
-
+
if (name != NULL && etoolbar->priv->dnd_toolbar == toolbar && !used)
{
etoolbar->priv->dnd_toolitem = create_item_from_action (etoolbar, name);
@@ -661,13 +661,13 @@
gtk_toolbar_set_drop_highlight_item (toolbar, NULL, 0);
etoolbar->priv->dnd_toolbar = NULL;
etoolbar->priv->dnd_toolitem = NULL;
-
+
/* 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);
}
-
+
if (name != NULL && !used)
{
gint tpos = get_toolbar_position (etoolbar, GTK_WIDGET (toolbar));
@@ -675,11 +675,11 @@
gtk_drag_finish (context, TRUE, context->action == GDK_ACTION_MOVE, time);
}
else
- {
+ {
gtk_drag_finish (context, FALSE, context->action == GDK_ACTION_MOVE, time);
}
}
-
+
g_free (name);
}
@@ -699,7 +699,7 @@
gtk_drag_get_data (GTK_WIDGET (toolbar), context, target, time);
return TRUE;
}
-
+
return FALSE;
}
@@ -726,7 +726,7 @@
etoolbar->priv->dnd_pending++;
gtk_drag_get_data (GTK_WIDGET (toolbar), context, target, time);
}
-
+
/* If a highlight item is available, use it. */
else if (etoolbar->priv->dnd_toolitem)
{
@@ -768,7 +768,7 @@
gtk_drag_dest_set (GTK_WIDGET (toolbar), 0,
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);
@@ -790,15 +790,15 @@
EggTbModelFlags flags;
gboolean visible;
gint i;
-
+
visible = gtk_toggle_action_get_active (action);
for (i = 0; i < priv->visibility_actions->len; i++)
if (g_ptr_array_index (priv->visibility_actions, i) == action)
break;
-
+
g_return_if_fail (i < priv->visibility_actions->len);
-
- dock = get_dock_nth (etoolbar, i);
+
+ dock = get_dock_nth (etoolbar, i);
if (visible)
{
gtk_widget_show (dock);
@@ -807,11 +807,11 @@
{
gtk_widget_hide (dock);
}
-
+
if (priv->save_hidden)
- {
+ {
flags = egg_toolbars_model_get_flags (priv->model, i);
-
+
if (visible)
{
flags &= ~(EGG_TB_MODEL_HIDDEN);
@@ -820,7 +820,7 @@
{
flags |= (EGG_TB_MODEL_HIDDEN);
}
-
+
egg_toolbars_model_set_flags (priv->model, i, flags);
}
}
@@ -836,8 +836,8 @@
gboolean showing;
char action_name[40];
char *action_label;
- char *tmp;
-
+ char *tmp;
+
if (priv == NULL || priv->model == NULL || priv->manager == NULL ||
priv->visibility_paths == NULL || priv->actions == NULL)
{
@@ -848,16 +848,16 @@
{
priv->visibility_actions = g_ptr_array_new ();
}
-
+
if (priv->visibility_id != 0)
{
gtk_ui_manager_remove_ui (priv->manager, priv->visibility_id);
- }
-
+ }
+
priv->visibility_id = gtk_ui_manager_new_merge_id (priv->manager);
-
+
showing = GTK_WIDGET_VISIBLE (etoolbar);
-
+
n_toolbars = egg_toolbars_model_n_toolbars (priv->model);
for (i = 0; i < n_toolbars; i++)
{
@@ -899,7 +899,7 @@
{
g_string_append (string, " ...");
}
-
+
tmp = g_string_free (string, FALSE);
for (j = 0, k = 0; tmp[j]; j++)
{
@@ -917,9 +917,9 @@
* please remove. */
action_label = g_strdup_printf (_("Show â_%sâ"), tmp);
g_free (tmp);
-
+
sprintf(action_name, "ToolbarToggle%d", i);
-
+
if (i >= priv->visibility_actions->len)
{
action = gtk_toggle_action_new (action_name, action_label, NULL, NULL);
@@ -935,24 +935,24 @@
g_object_set (action, "label", action_label, NULL);
}
- gtk_action_set_visible (GTK_ACTION (action), (egg_toolbars_model_get_flags (priv->model, i)
+ 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)));
-
+
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);
}
-
+
g_free (action_label);
}
-
+
gtk_ui_manager_ensure_update (priv->manager);
-
+
while (i < priv->visibility_actions->len)
{
action = g_ptr_array_index (priv->visibility_actions, i);
@@ -975,7 +975,7 @@
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_signal_connect (toolbar, "drag_leave",
@@ -987,7 +987,7 @@
G_CALLBACK (popup_context_menu_cb), etoolbar);
configure_drag_dest (etoolbar, GTK_TOOLBAR (toolbar));
-
+
return hbox;
}
@@ -1082,7 +1082,7 @@
gtk_box_pack_end (GTK_BOX (dock), toolbar, FALSE, TRUE, 0);
gtk_widget_show (toolbar);
-
+
gtk_widget_set_size_request (dock, -1, -1);
gtk_widget_queue_resize_no_redraw (dock);
}
@@ -1106,7 +1106,7 @@
gtk_box_reorder_child (GTK_BOX (etoolbar), dock, position);
gtk_widget_show_all (dock);
-
+
update_fixed (etoolbar);
toolbar_visibility_refresh (etoolbar);
@@ -1128,7 +1128,7 @@
gtk_widget_destroy (dock);
update_fixed (etoolbar);
-
+
toolbar_visibility_refresh (etoolbar);
}
@@ -1145,14 +1145,14 @@
toolbar = get_toolbar_nth (etoolbar, tpos);
item = create_item_from_position (etoolbar, tpos, ipos);
if (item == NULL) return;
-
+
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, ipos);
-
+
connect_widget_signals (GTK_WIDGET (item), etoolbar);
configure_item_tooltip (item);
configure_item_cursor (item, etoolbar);
configure_item_sensitivity (item, etoolbar);
-
+
dock = get_dock_nth (etoolbar, tpos);
gtk_widget_set_size_request (dock, -1, -1);
gtk_widget_queue_resize_no_redraw (dock);
@@ -1167,7 +1167,7 @@
EggEditableToolbar *etoolbar)
{
EggEditableToolbarPrivate *priv = etoolbar->priv;
-
+
GtkWidget *toolbar;
GtkWidget *item;
@@ -1216,7 +1216,7 @@
if (item)
{
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, l);
-
+
connect_widget_signals (GTK_WIDGET (item), etoolbar);
configure_item_tooltip (item);
configure_item_sensitivity (item, etoolbar);
@@ -1322,7 +1322,7 @@
priv = etoolbar->priv = EGG_EDITABLE_TOOLBAR_GET_PRIVATE (etoolbar);
priv->save_hidden = TRUE;
-
+
g_signal_connect (etoolbar, "notify::visible",
G_CALLBACK (toolbar_visibility_refresh), NULL);
}
@@ -1385,7 +1385,7 @@
{ "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");
@@ -1411,10 +1411,10 @@
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;
-
+
if(toolbar != NULL)
{
gint tpos = get_toolbar_position (etoolbar, toolbar);
@@ -1424,7 +1424,7 @@
{
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);
@@ -1448,13 +1448,13 @@
priv->edit_mode--;
}
i *= priv->edit_mode;
-
+
if (i == 0)
{
for (i = get_n_toolbars (etoolbar)-1; i >= 0; i--)
{
GtkWidget *toolbar;
-
+
toolbar = get_toolbar_nth (etoolbar, i);
n_items = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar));
@@ -1463,13 +1463,13 @@
egg_toolbars_model_remove_toolbar (priv->model, i);
}
else
- {
+ {
for (l = 0; l < n_items; l++)
{
GtkToolItem *item;
-
+
item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l);
-
+
configure_item_cursor (item, etoolbar);
configure_item_sensitivity (item, etoolbar);
}
@@ -1755,14 +1755,14 @@
if (!gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen),
GTK_ICON_SIZE_LARGE_TOOLBAR,
- NULL,
+ NULL,
&icon_height))
{
icon_height = DEFAULT_ICON_HEIGHT;
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
+
gtk_container_add (GTK_CONTAINER (window), widget);
gtk_widget_realize (window);
gtk_widget_show (widget);
@@ -1784,7 +1784,7 @@
allocation.height = icon_height;
gtk_widget_size_allocate (window, &allocation);
gtk_widget_size_request (window, &requisition);
-
+
/* Create a pixmap */
visual = gtk_widget_get_visual (window);
pixmap = gdk_pixmap_new (NULL, icon_width, icon_height, visual->depth);
@@ -1794,10 +1794,10 @@
gtk_widget_ensure_style (window);
g_assert (window->style);
g_assert (window->style->font_desc);
-
+
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);
Modified: trunk/libegg/toolbareditor/egg-toolbar-editor.c
==============================================================================
--- trunk/libegg/toolbareditor/egg-toolbar-editor.c (original)
+++ trunk/libegg/toolbareditor/egg-toolbar-editor.c Thu Feb 19 14:49:56 2009
@@ -84,7 +84,7 @@
"egg-collate-key");
char *key2 = g_object_get_data (G_OBJECT (item2),
"egg-collate-key");
-
+
return strcmp (key1, key2);
}
@@ -178,14 +178,14 @@
if (G_UNLIKELY (priv->model == model)) return;
egg_toolbar_editor_disconnect_model (t);
- g_object_unref (priv->model);
+ g_object_unref (priv->model);
}
priv->model = g_object_ref (model);
update_editor_sheet (t);
-
- priv->sig_handlers[SIGNAL_HANDLER_ITEM_ADDED] =
+
+ priv->sig_handlers[SIGNAL_HANDLER_ITEM_ADDED] =
g_signal_connect_object (model, "item_added",
G_CALLBACK (item_added_or_removed_cb), t, 0);
priv->sig_handlers[SIGNAL_HANDLER_ITEM_REMOVED] =
@@ -321,7 +321,7 @@
target = g_object_get_data (G_OBJECT (widget), "egg-item-name");
g_return_if_fail (target != NULL);
-
+
gtk_selection_data_set (selection_data, selection_data->target, 8,
(const guchar *) target, strlen (target));
}
@@ -357,9 +357,9 @@
{
GdkCursor *cursor;
GdkScreen *screen;
-
+
screen = gtk_widget_get_screen (widget);
-
+
cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
GDK_HAND2);
gdk_window_set_cursor (widget->window, cursor);
@@ -476,16 +476,16 @@
const char *item_name;
char *short_label;
const char *collate_key;
-
+
if (strcmp (name, "_separator") == 0)
{
GtkWidget *icon;
-
+
icon = _egg_editable_toolbar_new_separator_image ();
short_label = _("Separator");
item_name = g_strdup (name);
collate_key = g_utf8_collate_key (short_label, -1);
- item = editor_create_item (editor, GTK_IMAGE (icon),
+ item = editor_create_item (editor, GTK_IMAGE (icon),
short_label, drag_action);
}
else
@@ -493,7 +493,7 @@
GtkAction *action;
GtkWidget *icon;
char *stock_id, *icon_name = NULL;
-
+
action = find_action (editor, name);
g_return_val_if_fail (action != NULL, NULL);
@@ -520,12 +520,12 @@
g_free (stock_id);
g_free (icon_name);
}
-
+
g_object_set_data_full (G_OBJECT (item), "egg-collate-key",
(gpointer) collate_key, g_free);
g_object_set_data_full (G_OBJECT (item), "egg-item-name",
(gpointer) item_name, g_free);
-
+
return item;
}
@@ -537,10 +537,10 @@
gint x = 0, height;
GtkWidget *alignment;
GtkWidget *item;
-
+
height = g_list_length (items) / width + 1;
gtk_table_resize (table, height, width);
-
+
if (y > 0)
{
item = gtk_hseparator_new ();
@@ -548,10 +548,10 @@
gtk_container_add (GTK_CONTAINER (alignment), item);
gtk_widget_show (alignment);
gtk_widget_show (item);
-
+
gtk_table_attach_defaults (table, alignment, 0, width, y-1, y+1);
}
-
+
for (; items != NULL; items = items->next)
{
item = items->data;
@@ -559,7 +559,7 @@
gtk_container_add (GTK_CONTAINER (alignment), item);
gtk_widget_show (alignment);
gtk_widget_show (item);
-
+
if (x >= width)
{
x = 0;
@@ -568,7 +568,7 @@
gtk_table_attach_defaults (table, alignment, x, x+1, y, y+1);
x++;
}
-
+
y++;
}
return y;
@@ -584,7 +584,7 @@
GtkWidget *viewport;
g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor));
-
+
/* Create new table. */
table = gtk_table_new (0, 0, TRUE);
editor->priv->table = table;
@@ -594,7 +594,7 @@
gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL,
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). */
items = egg_toolbars_model_get_name_avail (editor->priv->model);
while (items->len > 0)
@@ -602,10 +602,10 @@
GtkWidget *item;
const char *name;
gint flags;
-
+
name = g_ptr_array_index (items, 0);
g_ptr_array_remove_index_fast (items, 0);
-
+
flags = egg_toolbars_model_get_name_flags (editor->priv->model, name);
if ((flags & EGG_TB_MODEL_NAME_INFINITE) == 0)
{
@@ -625,11 +625,11 @@
y = 0;
y = append_table (GTK_TABLE (table), to_move, y, 4);
y = append_table (GTK_TABLE (table), to_copy, y, 4);
-
+
g_list_free (to_move);
g_list_free (to_copy);
g_ptr_array_free (items, TRUE);
-
+
/* Delete old table. */
viewport = GTK_BIN (editor->priv->scrolled_window)->child;
if (viewport)
@@ -637,7 +637,7 @@
gtk_container_remove (GTK_CONTAINER (viewport),
GTK_BIN (viewport)->child);
}
-
+
/* Add table to window. */
gtk_scrolled_window_add_with_viewport
(GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table);
Modified: trunk/libegg/toolbareditor/egg-toolbars-model.c
==============================================================================
--- trunk/libegg/toolbareditor/egg-toolbars-model.c (original)
+++ trunk/libegg/toolbareditor/egg-toolbars-model.c Thu Feb 19 14:49:56 2009
@@ -103,7 +103,7 @@
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);
@@ -116,13 +116,13 @@
{
xmlNodePtr dnode;
char *tmp;
-
+
tmp = type->get_data (type, item->name);
if (tmp != NULL)
{
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);
g_free (tmp);
@@ -214,8 +214,8 @@
{
EggToolbarsItem *idata2;
GNode *toolbar, *item;
-
-
+
+
for(toolbar = g_node_first_child (model->priv->toolbars);
toolbar != NULL; toolbar = g_node_next_sibling (toolbar))
{
@@ -223,14 +223,14 @@
item != NULL; item = g_node_next_sibling (item))
{
idata2 = item->data;
-
+
if (idata != idata2 && strcmp (idata->name, idata2->name) == 0)
{
return FALSE;
}
}
}
-
+
return TRUE;
}
@@ -291,7 +291,7 @@
g_node_children_foreach (toolbar_node, G_TRAVERSE_ALL,
(GNodeForeachFunc) item_node_free, model);
-
+
g_free (toolbar->name);
g_free (toolbar);
@@ -341,14 +341,14 @@
EggToolbarsItemType *t;
char *data = NULL;
GList *l;
-
+
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);
return strdup (name);
}
-
+
for (l = model->priv->types; l != NULL; l = l->next)
{
t = l->data;
@@ -358,7 +358,7 @@
if (data != NULL) break;
}
}
-
+
return data;
}
@@ -371,14 +371,14 @@
EggToolbarsItemType *t;
char *name = NULL;
GList *l;
-
+
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);
return strdup (data);
}
-
+
if (create)
{
for (l = model->priv->types; name == NULL && l != NULL; l = l->next)
@@ -387,7 +387,7 @@
if (t->type == type && t->new_name != NULL)
name = t->new_name (t, data);
}
-
+
return name;
}
else
@@ -398,9 +398,9 @@
if (t->type == type && t->get_name != NULL)
name = t->get_name (t, data);
}
-
+
return name;
- }
+ }
}
static gboolean
@@ -471,20 +471,20 @@
{
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);
}
-
+
xmlFree (type);
xmlFree (data);
}
-
+
child = child->next;
}
-
+
return name;
}
@@ -506,25 +506,25 @@
{
name = parse_data_list (model, child->children, TRUE);
}
-
+
/* 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;
-
+
/* If an old format, try to use it. */
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);
}
-
+
xmlFree (type);
xmlFree (data);
}
-
+
if (name != NULL)
{
egg_toolbars_model_add_item (model, position, -1, name);
@@ -573,7 +573,7 @@
xmlFree (string);
egg_toolbars_model_set_flags (model, position, flags);
-
+
parse_item_list (model, child->children, position);
}
@@ -612,7 +612,7 @@
xmlNodePtr child)
{
gint flags;
-
+
while (child)
{
if (xmlStrEqual (child->name, (const xmlChar*) "toolitem"))
@@ -730,7 +730,7 @@
model->priv->toolbars = g_node_new (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_toolbars_model_set_name_flags (model, "_separator",
EGG_TB_MODEL_NAME_KNOWN |
EGG_TB_MODEL_NAME_INFINITE);
}
@@ -839,22 +839,22 @@
int tpos, ipos;
g_return_if_fail (EGG_IS_TOOLBARS_MODEL (model));
-
+
toolbar = g_node_first_child (model->priv->toolbars);
tpos = 0;
-
+
while (toolbar != NULL)
{
item = g_node_first_child (toolbar);
ipos = 0;
-
+
/* Don't delete toolbars that were already empty */
if (item == NULL)
{
toolbar = g_node_next_sibling (toolbar);
continue;
}
-
+
while (item != NULL)
{
next = g_node_next_sibling (item);
@@ -870,10 +870,10 @@
{
ipos++;
}
-
+
item = next;
}
-
+
next = g_node_next_sibling (toolbar);
tdata = toolbar->data;
if (!(tdata->flags & EGG_TB_MODEL_NOT_REMOVABLE) &&
@@ -889,7 +889,7 @@
{
tpos++;
}
-
+
toolbar = next;
}
}
Modified: trunk/libegg/toolbareditor/egg-toolbars-model.h
==============================================================================
--- trunk/libegg/toolbareditor/egg-toolbars-model.h (original)
+++ trunk/libegg/toolbareditor/egg-toolbars-model.h Thu Feb 19 14:49:56 2009
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
+ *
* $Id$
*/
@@ -98,19 +98,20 @@
struct EggToolbarsItemType
{
GdkAtom type;
-
+
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);
};
-GType egg_tb_model_get_type (void);
+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);
Modified: trunk/libegg/toolbareditor/update-toolbareditor-from-libegg.sh
==============================================================================
--- trunk/libegg/toolbareditor/update-toolbareditor-from-libegg.sh (original)
+++ trunk/libegg/toolbareditor/update-toolbareditor-from-libegg.sh Thu Feb 19 14:49:56 2009
@@ -16,7 +16,7 @@
egg-toolbars-model.h \
egg-toolbar-editor.h \
eggtreemultidnd.h \
- eggmarshalers.list"
+ eggmarshalers.list"
if [ -z $1 ]; then
@@ -27,7 +27,7 @@
if [ "$1" = "--update-sources" ]; then
echo "Obtaining latest version of the sources"
- for FILE in $FILES
+ for FILE in $FILES
do
svn export $SVN_URI/$FILE
done
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]