void gimp_docked_set_aux_info (GimpDocked *docked, GList *aux_info) { GimpDockedInterface *docked_iface; g_return_if_fail (GIMP_IS_DOCKED (docked)); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->set_aux_info) docked_iface->set_aux_info (docked, aux_info); }
void gimp_docked_set_show_button_bar (GimpDocked *docked, gboolean show) { GimpDockedInterface *docked_iface; g_return_if_fail (GIMP_IS_DOCKED (docked)); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->set_show_button_bar) docked_iface->set_show_button_bar (docked, show ? TRUE : FALSE); }
gboolean gimp_docked_get_show_button_bar (GimpDocked *docked) { GimpDockedInterface *docked_iface; g_return_val_if_fail (GIMP_IS_DOCKED (docked), FALSE); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->get_show_button_bar) return docked_iface->get_show_button_bar (docked); return FALSE; }
void gimp_docked_set_context (GimpDocked *docked, GimpContext *context) { GimpDockedInterface *docked_iface; g_return_if_fail (GIMP_IS_DOCKED (docked)); g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->set_context) docked_iface->set_context (docked, context); }
gchar * gimp_docked_get_title (GimpDocked *docked) { GimpDockedInterface *docked_iface; g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->get_title) return docked_iface->get_title (docked); return NULL; }
gboolean gimp_docked_get_prefer_icon (GimpDocked *docked) { GimpDockedInterface *docked_iface; g_return_val_if_fail (GIMP_IS_DOCKED (docked), FALSE); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->get_prefer_icon) return docked_iface->get_prefer_icon (docked); return FALSE; }
GList * gimp_docked_get_aux_info (GimpDocked *docked) { GimpDockedInterface *docked_iface; g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->get_aux_info) return docked_iface->get_aux_info (docked); return NULL; }
GtkWidget * gimp_docked_get_preview (GimpDocked *docked, GimpContext *context, GtkIconSize size) { GimpDockedInterface *docked_iface; g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->get_preview) return docked_iface->get_preview (docked, context, size); return NULL; }
GimpUIManager * gimp_docked_get_menu (GimpDocked *docked, const gchar **ui_path, gpointer *popup_data) { GimpDockedInterface *docked_iface; g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); g_return_val_if_fail (ui_path != NULL, NULL); g_return_val_if_fail (popup_data != NULL, NULL); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->get_menu) return docked_iface->get_menu (docked, ui_path, popup_data); return NULL; }
void dockable_actions_update (GimpActionGroup *group, gpointer data) { GimpDockable *dockable; GimpDockbook *dockbook; GimpDocked *docked; GimpDialogFactoryEntry *entry; GimpContainerView *view; GimpViewType view_type = -1; gboolean list_view_available = FALSE; gboolean grid_view_available = FALSE; GimpViewSize view_size = -1; GimpTabStyle tab_style = -1; gint n_pages = 0; gint n_books = 0; if (GIMP_IS_DOCKBOOK (data)) { gint page_num; dockbook = GIMP_DOCKBOOK (data); page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); dockable = (GimpDockable *) gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); } else if (GIMP_IS_DOCKABLE (data)) { dockable = GIMP_DOCKABLE (data); dockbook = dockable->dockbook; } else { return; } docked = GIMP_DOCKED (gtk_bin_get_child (GTK_BIN (dockable))); gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); if (entry) { gchar *identifier; gchar *substring = NULL; identifier = g_strdup (entry->identifier); if ((substring = strstr (identifier, "grid"))) view_type = GIMP_VIEW_TYPE_GRID; else if ((substring = strstr (identifier, "list"))) view_type = GIMP_VIEW_TYPE_LIST; if (substring) { memcpy (substring, "list", 4); if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, identifier)) list_view_available = TRUE; memcpy (substring, "grid", 4); if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, identifier)) grid_view_available = TRUE; } g_free (identifier); } view = gimp_container_view_get_by_dockable (dockable); if (view) view_size = gimp_container_view_get_view_size (view, NULL); tab_style = dockable->tab_style; n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (dockbook)); n_books = g_list_length (dockbook->dock->dockbooks); #define SET_ACTIVE(action,active) \ gimp_action_group_set_action_active (group, action, (active) != 0) #define SET_VISIBLE(action,active) \ gimp_action_group_set_action_visible (group, action, (active) != 0) #define SET_SENSITIVE(action,sensitive) \ gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0) SET_SENSITIVE ("dockable-detach-tab", n_pages > 1 || n_books > 1); SET_VISIBLE ("dockable-preview-size-menu", view_size != -1); if (view_size != -1) { if (view_size >= GIMP_VIEW_SIZE_GIGANTIC) { SET_ACTIVE ("dockable-preview-size-gigantic", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_ENORMOUS) { SET_ACTIVE ("dockable-preview-size-enormous", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_HUGE) { SET_ACTIVE ("dockable-preview-size-huge", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_EXTRA_LARGE) { SET_ACTIVE ("dockable-preview-size-extra-large", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_LARGE) { SET_ACTIVE ("dockable-preview-size-large", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_MEDIUM) { SET_ACTIVE ("dockable-preview-size-medium", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_SMALL) { SET_ACTIVE ("dockable-preview-size-small", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_EXTRA_SMALL) { SET_ACTIVE ("dockable-preview-size-extra-small", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_TINY) { SET_ACTIVE ("dockable-preview-size-tiny", TRUE); } } SET_VISIBLE ("dockable-tab-style-menu", n_pages > 1); if (n_pages > 1) { GimpDockedInterface *docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (tab_style == GIMP_TAB_STYLE_ICON) SET_ACTIVE ("dockable-tab-style-icon", TRUE); else if (tab_style == GIMP_TAB_STYLE_PREVIEW) SET_ACTIVE ("dockable-tab-style-preview", TRUE); else if (tab_style == GIMP_TAB_STYLE_NAME) SET_ACTIVE ("dockable-tab-style-name", TRUE); else if (tab_style == GIMP_TAB_STYLE_ICON_NAME) SET_ACTIVE ("dockable-tab-style-icon-name", TRUE); else if (tab_style == GIMP_TAB_STYLE_PREVIEW_NAME) SET_ACTIVE ("dockable-tab-style-preview-name", TRUE); SET_SENSITIVE ("dockable-tab-style-preview", docked_iface->get_preview); SET_SENSITIVE ("dockable-tab-style-preview-name", docked_iface->get_preview); } SET_VISIBLE ("dockable-view-type-grid", view_type != -1); SET_VISIBLE ("dockable-view-type-list", view_type != -1); if (view_type != -1) { if (view_type == GIMP_VIEW_TYPE_LIST) SET_ACTIVE ("dockable-view-type-list", TRUE); else SET_ACTIVE ("dockable-view-type-grid", TRUE); SET_SENSITIVE ("dockable-view-type-grid", grid_view_available); SET_SENSITIVE ("dockable-view-type-list", list_view_available); } SET_VISIBLE ("dockable-show-button-bar", gimp_docked_has_button_bar (docked)); SET_ACTIVE ("dockable-show-button-bar", gimp_docked_get_show_button_bar (docked)); #undef SET_ACTIVE #undef SET_VISIBLE #undef SET_SENSITIVE }