app: Make GimpEditor instance members private

This commit is contained in:
Martin Nordholts 2011-04-09 19:51:51 +02:00
parent 1a3315feac
commit 27ac2a3c38
21 changed files with 236 additions and 171 deletions

View File

@ -99,8 +99,8 @@ gradient_editor_left_color_cmd_callback (GtkAction *action,
editor);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
gtk_window_present (GTK_WINDOW (editor->color_dialog));
}
@ -250,8 +250,8 @@ gradient_editor_right_color_cmd_callback (GtkAction *action,
editor);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
gtk_window_present (GTK_WINDOW (editor->color_dialog));
}
@ -512,8 +512,8 @@ gradient_editor_replicate_cmd_callback (GtkAction *action,
&editor->replicate_times);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
gtk_widget_show (dialog);
}
@ -615,8 +615,8 @@ gradient_editor_split_uniformly_cmd_callback (GtkAction *action,
&editor->split_parts);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
gtk_widget_show (dialog);
}
@ -742,8 +742,8 @@ gradient_editor_left_color_update (GimpColorDialog *dialog,
gtk_widget_destroy (editor->color_dialog);
editor->color_dialog = NULL;
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
break;
case GIMP_COLOR_DIALOG_CANCEL:
@ -754,8 +754,8 @@ gradient_editor_left_color_update (GimpColorDialog *dialog,
gtk_widget_destroy (editor->color_dialog);
editor->color_dialog = NULL;
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
break;
}
}
@ -790,8 +790,8 @@ gradient_editor_right_color_update (GimpColorDialog *dialog,
gtk_widget_destroy (editor->color_dialog);
editor->color_dialog = NULL;
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
break;
case GIMP_COLOR_DIALOG_CANCEL:
@ -802,8 +802,8 @@ gradient_editor_right_color_update (GimpColorDialog *dialog,
gtk_widget_destroy (editor->color_dialog);
editor->color_dialog = NULL;
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
break;
}
}
@ -889,8 +889,8 @@ gradient_editor_split_uniform_response (GtkWidget *widget,
{
gtk_widget_destroy (widget);
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
if (response_id == GTK_RESPONSE_OK)
{
@ -914,8 +914,8 @@ gradient_editor_replicate_response (GtkWidget *widget,
{
gtk_widget_destroy (widget);
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
if (response_id == GTK_RESPONSE_OK)
{

View File

@ -62,7 +62,7 @@ tool_options_save_new_preset_cmd_callback (GtkAction *action,
gpointer user_data)
{
GimpEditor *editor = GIMP_EDITOR (user_data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp);
GimpData *data;
data = gimp_data_factory_data_new (context->gimp->tool_preset_factory,
@ -77,7 +77,7 @@ tool_options_save_preset_cmd_callback (GtkAction *action,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
@ -99,7 +99,7 @@ tool_options_restore_preset_cmd_callback (GtkAction *action,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
@ -121,7 +121,7 @@ tool_options_edit_preset_cmd_callback (GtkAction *action,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
@ -140,7 +140,7 @@ tool_options_delete_preset_cmd_callback (GtkAction *action,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
@ -164,7 +164,7 @@ tool_options_reset_cmd_callback (GtkAction *action,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
gimp_tool_options_reset (tool_info->tool_options);
@ -205,7 +205,7 @@ tool_options_reset_all_cmd_callback (GtkAction *action,
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
Gimp *gimp = editor->ui_manager->gimp;
Gimp *gimp = gimp_editor_get_ui_manager (editor)->gimp;
GList *list;
for (list = gimp_get_tool_info_iter (gimp);

View File

@ -490,9 +490,9 @@ gimp_navigation_editor_set_shell (GimpNavigationEditor *editor,
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
static gboolean
@ -636,9 +636,9 @@ gimp_navigation_editor_shell_scaled (GimpDisplayShell *shell,
gimp_navigation_editor_update_marker (editor);
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
static void
@ -647,9 +647,9 @@ gimp_navigation_editor_shell_scrolled (GimpDisplayShell *shell,
{
gimp_navigation_editor_update_marker (editor);
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
static void
@ -661,9 +661,9 @@ gimp_navigation_editor_shell_reconnect (GimpDisplayShell *shell,
gimp_view_set_viewable (GIMP_VIEW (editor->view),
GIMP_VIEWABLE (image));
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
static void

View File

@ -210,7 +210,8 @@ gimp_buffer_view_new (GimpViewType view_type,
GTK_BUTTON (buffer_view->delete_button),
GIMP_TYPE_BUFFER);
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager, editor);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
editor);
return GTK_WIDGET (buffer_view);
}

View File

@ -177,7 +177,7 @@ gimp_channel_tree_view_constructed (GObject *object)
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (view),
GTK_BUTTON (view->priv->toselection_button),
GIMP_TYPE_CHANNEL);
gtk_box_reorder_child (GTK_BOX (GIMP_EDITOR (view)->button_box),
gtk_box_reorder_child (gimp_editor_get_button_box (GIMP_EDITOR (view)),
view->priv->toselection_button, 5);
}
@ -286,7 +286,7 @@ gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
channel_view->priv->component_editor =
gimp_component_editor_new (view_size,
GIMP_EDITOR (item_view)->menu_factory);
gimp_editor_get_menu_factory (GIMP_EDITOR (item_view)));
gimp_docked_set_context (GIMP_DOCKED (channel_view->priv->component_editor),
gimp_container_view_get_context (view));
gtk_box_pack_start (GTK_BOX (item_view), channel_view->priv->component_editor,

View File

@ -592,7 +592,7 @@ gimp_colormap_editor_entry_activated (GimpPaletteView *view,
{
gimp_colormap_editor_set_index (editor, entry->position, NULL);
gimp_ui_manager_activate_action (GIMP_EDITOR (editor)->ui_manager,
gimp_ui_manager_activate_action (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
"colormap",
"colormap-edit-color");
}

View File

@ -224,9 +224,9 @@ gimp_container_editor_select_item (GtkWidget *widget,
if (klass->select_item)
klass->select_item (editor, viewable);
if (GIMP_EDITOR (editor->view)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager,
GIMP_EDITOR (editor->view)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor->view)));
return TRUE;
}

View File

@ -495,9 +495,9 @@ gimp_data_editor_set_data (GimpDataEditor *editor,
g_object_notify (G_OBJECT (editor), "data");
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
}

View File

@ -337,7 +337,8 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
GTK_BUTTON (factory_view->priv->delete_button),
gimp_container_get_children_type (gimp_data_factory_get_container (factory)));
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager, editor);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
editor);
return TRUE;
}

View File

@ -137,7 +137,8 @@ gimp_document_view_new (GimpViewType view_type,
editor);
}
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager, editor);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
editor);
return GTK_WIDGET (document_view);
}

View File

@ -54,6 +54,20 @@ enum
};
struct _GimpEditorPrivate
{
GimpMenuFactory *menu_factory;
gchar *menu_identifier;
GimpUIManager *ui_manager;
gchar *ui_path;
gpointer popup_data;
gboolean show_button_bar;
GtkWidget *name_label;
GtkWidget *button_box;
};
static void gimp_editor_docked_iface_init (GimpDockedInterface *iface);
static void gimp_editor_constructed (GObject *object);
@ -171,6 +185,8 @@ gimp_editor_class_init (GimpEditorClass *klass)
GTK_TYPE_RELIEF_STYLE,
DEFAULT_BUTTON_RELIEF,
GIMP_PARAM_READABLE));
g_type_class_add_private (klass, sizeof (GimpEditorPrivate));
}
static void
@ -188,23 +204,22 @@ gimp_editor_init (GimpEditor *editor)
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
GTK_ORIENTATION_VERTICAL);
editor->menu_factory = NULL;
editor->menu_identifier = NULL;
editor->ui_manager = NULL;
editor->ui_path = NULL;
editor->popup_data = editor;
editor->button_box = NULL;
editor->show_button_bar = TRUE;
editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (editor,
GIMP_TYPE_EDITOR,
GimpEditorPrivate);
editor->priv->popup_data = editor;
editor->priv->show_button_bar = TRUE;
editor->name_label = g_object_new (GTK_TYPE_LABEL,
editor->priv->name_label = g_object_new (GTK_TYPE_LABEL,
"xalign", 0.0,
"yalign", 0.5,
"ellipsize", PANGO_ELLIPSIZE_END,
NULL);
gimp_label_set_attributes (GTK_LABEL (editor->name_label),
gimp_label_set_attributes (GTK_LABEL (editor->priv->name_label),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (editor), editor->name_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (editor), editor->priv->name_label,
FALSE, FALSE, 0);
}
static void
@ -215,15 +230,15 @@ gimp_editor_constructed (GObject *object)
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
if (! editor->popup_data)
editor->popup_data = editor;
if (! editor->priv->popup_data)
editor->priv->popup_data = editor;
if (editor->menu_factory && editor->menu_identifier)
if (editor->priv->menu_factory && editor->priv->menu_identifier)
{
editor->ui_manager =
gimp_menu_factory_manager_new (editor->menu_factory,
editor->menu_identifier,
editor->popup_data,
editor->priv->ui_manager =
gimp_menu_factory_manager_new (editor->priv->menu_factory,
editor->priv->menu_identifier,
editor->priv->popup_data,
FALSE);
}
}
@ -233,28 +248,28 @@ gimp_editor_dispose (GObject *object)
{
GimpEditor *editor = GIMP_EDITOR (object);
if (editor->menu_factory)
if (editor->priv->menu_factory)
{
g_object_unref (editor->menu_factory);
editor->menu_factory = NULL;
g_object_unref (editor->priv->menu_factory);
editor->priv->menu_factory = NULL;
}
if (editor->menu_identifier)
if (editor->priv->menu_identifier)
{
g_free (editor->menu_identifier);
editor->menu_identifier = NULL;
g_free (editor->priv->menu_identifier);
editor->priv->menu_identifier = NULL;
}
if (editor->ui_manager)
if (editor->priv->ui_manager)
{
g_object_unref (editor->ui_manager);
editor->ui_manager = NULL;
g_object_unref (editor->priv->ui_manager);
editor->priv->ui_manager = NULL;
}
if (editor->ui_path)
if (editor->priv->ui_path)
{
g_free (editor->ui_path);
editor->ui_path = NULL;
g_free (editor->priv->ui_path);
editor->priv->ui_path = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -271,23 +286,24 @@ gimp_editor_set_property (GObject *object,
switch (property_id)
{
case PROP_MENU_FACTORY:
editor->menu_factory = g_value_dup_object (value);
editor->priv->menu_factory = g_value_dup_object (value);
break;
case PROP_MENU_IDENTIFIER:
editor->menu_identifier = g_value_dup_string (value);
editor->priv->menu_identifier = g_value_dup_string (value);
break;
case PROP_UI_PATH:
editor->ui_path = g_value_dup_string (value);
editor->priv->ui_path = g_value_dup_string (value);
break;
case PROP_POPUP_DATA:
editor->popup_data = g_value_get_pointer (value);
editor->priv->popup_data = g_value_get_pointer (value);
break;
case PROP_SHOW_NAME:
g_object_set_property (G_OBJECT (editor->name_label), "visible", value);
g_object_set_property (G_OBJECT (editor->priv->name_label),
"visible", value);
break;
case PROP_NAME:
@ -311,23 +327,24 @@ gimp_editor_get_property (GObject *object,
switch (property_id)
{
case PROP_MENU_FACTORY:
g_value_set_object (value, editor->menu_factory);
g_value_set_object (value, editor->priv->menu_factory);
break;
case PROP_MENU_IDENTIFIER:
g_value_set_string (value, editor->menu_identifier);
g_value_set_string (value, editor->priv->menu_identifier);
break;
case PROP_UI_PATH:
g_value_set_string (value, editor->ui_path);
g_value_set_string (value, editor->priv->ui_path);
break;
case PROP_POPUP_DATA:
g_value_set_pointer (value, editor->popup_data);
g_value_set_pointer (value, editor->priv->popup_data);
break;
case PROP_SHOW_NAME:
g_object_get_property (G_OBJECT (editor->name_label), "visible", value);
g_object_get_property (G_OBJECT (editor->priv->name_label),
"visible", value);
break;
default:
@ -349,8 +366,8 @@ gimp_editor_style_set (GtkWidget *widget,
gtk_box_set_spacing (GTK_BOX (widget), content_spacing);
if (editor->button_box)
gimp_editor_set_box_style (editor, GTK_BOX (editor->button_box));
if (editor->priv->button_box)
gimp_editor_set_box_style (editor, GTK_BOX (editor->priv->button_box));
}
static GimpUIManager *
@ -360,10 +377,10 @@ gimp_editor_get_menu (GimpDocked *docked,
{
GimpEditor *editor = GIMP_EDITOR (docked);
*ui_path = editor->ui_path;
*popup_data = editor->popup_data;
*ui_path = editor->priv->ui_path;
*popup_data = editor->priv->popup_data;
return editor->ui_manager;
return editor->priv->ui_manager;
}
@ -372,7 +389,7 @@ gimp_editor_has_button_bar (GimpDocked *docked)
{
GimpEditor *editor = GIMP_EDITOR (docked);
return editor->button_box != NULL;
return editor->priv->button_box != NULL;
}
static void
@ -381,12 +398,12 @@ gimp_editor_set_show_button_bar (GimpDocked *docked,
{
GimpEditor *editor = GIMP_EDITOR (docked);
if (show != editor->show_button_bar)
if (show != editor->priv->show_button_bar)
{
editor->show_button_bar = show;
editor->priv->show_button_bar = show;
if (editor->button_box)
gtk_widget_set_visible (editor->button_box, show);
if (editor->priv->button_box)
gtk_widget_set_visible (editor->priv->button_box, show);
}
}
@ -395,7 +412,7 @@ gimp_editor_get_show_button_bar (GimpDocked *docked)
{
GimpEditor *editor = GIMP_EDITOR (docked);
return editor->show_button_bar;
return editor->priv->show_button_bar;
}
GtkWidget *
@ -416,25 +433,25 @@ gimp_editor_create_menu (GimpEditor *editor,
g_return_if_fail (menu_identifier != NULL);
g_return_if_fail (ui_path != NULL);
if (editor->menu_factory)
g_object_unref (editor->menu_factory);
if (editor->priv->menu_factory)
g_object_unref (editor->priv->menu_factory);
editor->menu_factory = g_object_ref (menu_factory);
editor->priv->menu_factory = g_object_ref (menu_factory);
if (editor->ui_manager)
g_object_unref (editor->ui_manager);
if (editor->priv->ui_manager)
g_object_unref (editor->priv->ui_manager);
editor->ui_manager = gimp_menu_factory_manager_new (menu_factory,
menu_identifier,
popup_data,
FALSE);
editor->priv->ui_manager = gimp_menu_factory_manager_new (menu_factory,
menu_identifier,
popup_data,
FALSE);
if (editor->ui_path)
g_free (editor->ui_path);
if (editor->priv->ui_path)
g_free (editor->priv->ui_path);
editor->ui_path = g_strdup (ui_path);
editor->priv->ui_path = g_strdup (ui_path);
editor->popup_data = popup_data;
editor->priv->popup_data = popup_data;
}
gboolean
@ -444,10 +461,10 @@ gimp_editor_popup_menu (GimpEditor *editor,
{
g_return_val_if_fail (GIMP_IS_EDITOR (editor), FALSE);
if (editor->ui_manager && editor->ui_path)
if (editor->priv->ui_manager && editor->priv->ui_path)
{
gimp_ui_manager_update (editor->ui_manager, editor->popup_data);
gimp_ui_manager_ui_popup (editor->ui_manager, editor->ui_path,
gimp_ui_manager_update (editor->priv->ui_manager, editor->priv->popup_data);
gimp_ui_manager_ui_popup (editor->priv->ui_manager, editor->priv->ui_path,
GTK_WIDGET (editor),
position_func, position_data,
NULL, NULL);
@ -480,7 +497,7 @@ gimp_editor_add_button (GimpEditor *editor,
"use-stock", TRUE,
NULL);
gtk_button_set_relief (GTK_BUTTON (button), button_relief);
gtk_box_pack_start (GTK_BOX (editor->button_box), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (editor->priv->button_box), button, TRUE, TRUE, 0);
gtk_widget_show (button);
if (tooltip || help_id)
@ -538,7 +555,7 @@ gimp_editor_add_stock_box (GimpEditor *editor,
gtk_button_set_relief (GTK_BUTTON (button), button_relief);
gtk_container_remove (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (editor->button_box), button,
gtk_box_pack_start (GTK_BOX (editor->priv->button_box), button,
TRUE, TRUE, 0);
g_object_unref (button);
@ -612,9 +629,10 @@ gimp_editor_add_action_button (GimpEditor *editor,
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
g_return_val_if_fail (action_name != NULL, NULL);
g_return_val_if_fail (editor->ui_manager != NULL, NULL);
g_return_val_if_fail (editor->priv->ui_manager != NULL, NULL);
group = gimp_ui_manager_get_action_group (editor->ui_manager, group_name);
group = gimp_ui_manager_get_action_group (editor->priv->ui_manager,
group_name);
g_return_val_if_fail (group != NULL, NULL);
@ -645,7 +663,8 @@ gimp_editor_add_action_button (GimpEditor *editor,
gtk_widget_show (image);
gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action);
gtk_box_pack_start (GTK_BOX (editor->button_box), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (editor->priv->button_box), button,
TRUE, TRUE, 0);
gtk_widget_show (button);
va_start (args, action_name);
@ -725,7 +744,7 @@ gimp_editor_set_name (GimpEditor *editor,
{
g_return_if_fail (GIMP_IS_EDITOR (editor));
gtk_label_set_text (GTK_LABEL (editor->name_label),
gtk_label_set_text (GTK_LABEL (editor->priv->name_label),
name ? name : _("(None)"));
}
@ -779,6 +798,47 @@ gimp_editor_set_box_style (GimpEditor *editor,
g_list_free (children);
}
GimpUIManager *
gimp_editor_get_ui_manager (GimpEditor *editor)
{
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
return editor->priv->ui_manager;
}
GtkBox *
gimp_editor_get_button_box (GimpEditor *editor)
{
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
return GTK_BOX (editor->priv->button_box);
}
GimpMenuFactory *
gimp_editor_get_menu_factory (GimpEditor *editor)
{
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
return editor->priv->menu_factory;
}
gpointer *
gimp_editor_get_popup_data (GimpEditor *editor)
{
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
return editor->priv->popup_data;
}
gchar *
gimp_editor_get_ui_path (GimpEditor *editor)
{
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
return editor->priv->ui_path;
}
/* private functions */
@ -795,14 +855,14 @@ gimp_editor_ensure_button_box (GimpEditor *editor,
"button-relief", button_relief,
NULL);
if (! editor->button_box)
if (! editor->priv->button_box)
{
editor->button_box = gtk_hbox_new (TRUE, button_spacing);
gtk_box_pack_end (GTK_BOX (editor), editor->button_box, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (editor), editor->button_box, 0);
editor->priv->button_box = gtk_hbox_new (TRUE, button_spacing);
gtk_box_pack_end (GTK_BOX (editor), editor->priv->button_box, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (editor), editor->priv->button_box, 0);
if (editor->show_button_bar)
gtk_widget_show (editor->button_box);
if (editor->priv->show_button_bar)
gtk_widget_show (editor->priv->button_box);
}
return button_icon_size;

View File

@ -30,21 +30,14 @@
#define GIMP_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_EDITOR, GimpEditorClass))
typedef struct _GimpEditorClass GimpEditorClass;
typedef struct _GimpEditorClass GimpEditorClass;
typedef struct _GimpEditorPrivate GimpEditorPrivate;
struct _GimpEditor
{
GtkBox parent_instance;
GtkBox parent_instance;
GimpMenuFactory *menu_factory;
gchar *menu_identifier;
GimpUIManager *ui_manager;
gchar *ui_path;
gpointer popup_data;
gboolean show_button_bar;
GtkWidget *name_label;
GtkWidget *button_box;
GimpEditorPrivate *priv;
};
struct _GimpEditorClass
@ -91,6 +84,12 @@ void gimp_editor_set_name (GimpEditor *editor,
void gimp_editor_set_box_style (GimpEditor *editor,
GtkBox *box);
GimpUIManager *
gimp_editor_get_ui_manager (GimpEditor *editor);
GtkBox * gimp_editor_get_button_box (GimpEditor *editor);
GimpMenuFactory *
gimp_editor_get_menu_factory (GimpEditor *editor);
gpointer * gimp_editor_get_popup_data (GimpEditor *editor);
gchar * gimp_editor_get_ui_path (GimpEditor *editor);
#endif /* __GIMP_EDITOR_H__ */

View File

@ -94,7 +94,8 @@ gimp_font_view_new (GimpViewType view_type,
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "fonts",
"fonts-refresh", NULL);
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager, editor);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
editor);
return GTK_WIDGET (font_view);
}

View File

@ -151,9 +151,9 @@ gimp_image_editor_set_image (GimpImageEditor *editor,
{
GIMP_IMAGE_EDITOR_GET_CLASS (editor)->set_image (editor, image);
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
}
@ -173,7 +173,7 @@ gimp_image_editor_image_flush (GimpImage *image,
gboolean invalidate_preview,
GimpImageEditor *editor)
{
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}

View File

@ -124,7 +124,7 @@ gimp_image_view_new (GimpViewType view_type,
GTK_BUTTON (image_view->delete_button),
GIMP_TYPE_IMAGE);
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager,
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
editor);
return GTK_WIDGET (image_view);

View File

@ -605,7 +605,7 @@ gimp_item_tree_view_set_image (GimpItemTreeView *view,
g_signal_emit (view, view_signals[SET_IMAGE], 0, image);
gimp_ui_manager_update (GIMP_EDITOR (view)->ui_manager, view);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (view)), view);
}
GimpImage *
@ -815,7 +815,7 @@ gimp_item_tree_view_image_flush (GimpImage *image,
gboolean invalidate_preview,
GimpItemTreeView *view)
{
gimp_ui_manager_update (GIMP_EDITOR (view)->ui_manager, view);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (view)), view);
}
@ -976,7 +976,7 @@ gimp_item_tree_view_select_item (GimpContainerView *view,
gimp_item_tree_view_update_options (tree_view, GIMP_ITEM (item));
}
gimp_ui_manager_update (GIMP_EDITOR (tree_view)->ui_manager, tree_view);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (tree_view)), tree_view);
if (tree_view->priv->options_box)
gtk_widget_set_sensitive (tree_view->priv->options_box, options_sensitive);
@ -996,7 +996,7 @@ gimp_item_tree_view_activate_item (GimpContainerView *view,
if (item_view_class->activate_action)
{
gimp_ui_manager_activate_action (GIMP_EDITOR (view)->ui_manager,
gimp_ui_manager_activate_action (gimp_editor_get_ui_manager (GIMP_EDITOR (view)),
item_view_class->action_group,
item_view_class->activate_action);
}
@ -1130,7 +1130,7 @@ gimp_item_tree_view_new_dropped (GtkWidget *widget,
{
GtkAction *action;
action = gimp_ui_manager_find_action (GIMP_EDITOR (view)->ui_manager,
action = gimp_ui_manager_find_action (gimp_editor_get_ui_manager (GIMP_EDITOR (view)),
item_view_class->action_group,
item_view_class->new_default_action);

View File

@ -378,7 +378,7 @@ gimp_layer_tree_view_constructed (GObject *object)
button = gimp_editor_add_action_button (GIMP_EDITOR (layer_view), "layers",
"layers-new-group", NULL);
gtk_box_reorder_child (GTK_BOX (GIMP_EDITOR (layer_view)->button_box),
gtk_box_reorder_child (gimp_editor_get_button_box (GIMP_EDITOR (layer_view)),
button, 2);
button = gimp_editor_add_action_button (GIMP_EDITOR (layer_view), "layers",
@ -386,7 +386,7 @@ gimp_layer_tree_view_constructed (GObject *object)
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (layer_view),
GTK_BUTTON (button),
GIMP_TYPE_LAYER);
gtk_box_reorder_child (GTK_BOX (GIMP_EDITOR (layer_view)->button_box),
gtk_box_reorder_child (gimp_editor_get_button_box (GIMP_EDITOR (layer_view)),
button, 6);
}
@ -1111,7 +1111,7 @@ static void
gimp_layer_tree_view_update_menu (GimpLayerTreeView *layer_view,
GimpLayer *layer)
{
GimpUIManager *ui_manager = GIMP_EDITOR (layer_view)->ui_manager;
GimpUIManager *ui_manager = gimp_editor_get_ui_manager (GIMP_EDITOR (layer_view));
GimpActionGroup *group;
GimpLayerMask *mask;
@ -1304,7 +1304,7 @@ gimp_layer_tree_view_layer_clicked (GimpCellRendererViewable *cell,
if (gtk_tree_model_get_iter (tree_view->model, &iter, path))
{
GimpUIManager *ui_manager = GIMP_EDITOR (tree_view)->ui_manager;
GimpUIManager *ui_manager = gimp_editor_get_ui_manager (GIMP_EDITOR (tree_view));
GimpActionGroup *group;
GimpViewRenderer *renderer;
@ -1347,7 +1347,7 @@ gimp_layer_tree_view_mask_clicked (GimpCellRendererViewable *cell,
GimpUIManager *ui_manager;
GimpActionGroup *group;
ui_manager = GIMP_EDITOR (tree_view)->ui_manager;
ui_manager = gimp_editor_get_ui_manager (GIMP_EDITOR (tree_view));
group = gimp_ui_manager_get_action_group (ui_manager, "layers");
gtk_tree_model_get (tree_view->model, &iter,

View File

@ -691,8 +691,8 @@ palette_editor_entry_selected (GimpPaletteView *view,
gtk_editable_set_editable (GTK_EDITABLE (editor->color_name),
entry && data_editor->data_editable);
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
}
@ -703,7 +703,7 @@ palette_editor_entry_activated (GimpPaletteView *view,
{
if (GIMP_DATA_EDITOR (editor)->data_editable && entry == editor->color)
{
gimp_ui_manager_activate_action (GIMP_EDITOR (editor)->ui_manager,
gimp_ui_manager_activate_action (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
"palette-editor",
"palette-editor-edit-color");
}

View File

@ -150,7 +150,8 @@ gimp_template_view_new (GimpViewType view_type,
GTK_BUTTON (template_view->delete_button),
GIMP_TYPE_TEMPLATE);
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager, editor);
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
editor);
return GTK_WIDGET (template_view);
}

View File

@ -394,11 +394,12 @@ gimp_tool_options_editor_menu_popup (GimpToolOptionsEditor *editor,
{
GimpEditor *gimp_editor = GIMP_EDITOR (editor);
gtk_ui_manager_get_widget (GTK_UI_MANAGER (gimp_editor->ui_manager),
gimp_editor->ui_path);
gimp_ui_manager_update (gimp_editor->ui_manager, gimp_editor->popup_data);
gtk_ui_manager_get_widget (GTK_UI_MANAGER (gimp_editor_get_ui_manager (gimp_editor)),
gimp_editor_get_ui_path (gimp_editor));
gimp_ui_manager_update (gimp_editor_get_ui_manager (gimp_editor),
gimp_editor_get_popup_data (gimp_editor));
gimp_ui_manager_ui_popup (gimp_editor->ui_manager, path,
gimp_ui_manager_ui_popup (gimp_editor_get_ui_manager (gimp_editor), path,
button,
gimp_tool_options_editor_menu_pos, button,
NULL, NULL);
@ -415,7 +416,7 @@ gimp_tool_options_editor_save_clicked (GtkWidget *widget,
}
else
{
gimp_ui_manager_activate_action (GIMP_EDITOR (editor)->ui_manager,
gimp_ui_manager_activate_action (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
"tool-options",
"tool-options-save-new-preset");
}

View File

@ -150,7 +150,7 @@ gimp_vectors_tree_view_constructed (GObject *object)
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (editor),
GTK_BUTTON (view->toselection_button),
GIMP_TYPE_VECTORS);
gtk_box_reorder_child (GTK_BOX (editor->button_box),
gtk_box_reorder_child (gimp_editor_get_button_box (editor),
view->toselection_button, 5);
view->tovectors_button =
@ -159,7 +159,7 @@ gimp_vectors_tree_view_constructed (GObject *object)
"vectors-selection-to-vectors-advanced",
GDK_SHIFT_MASK,
NULL);
gtk_box_reorder_child (GTK_BOX (editor->button_box),
gtk_box_reorder_child (gimp_editor_get_button_box (editor),
view->tovectors_button, 6);
view->stroke_button =
@ -171,7 +171,7 @@ gimp_vectors_tree_view_constructed (GObject *object)
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (editor),
GTK_BUTTON (view->stroke_button),
GIMP_TYPE_VECTORS);
gtk_box_reorder_child (GTK_BOX (editor->button_box),
gtk_box_reorder_child (gimp_editor_get_button_box (editor),
view->stroke_button, 7);
gimp_dnd_svg_dest_add (GTK_WIDGET (tree_view->view), NULL, view);