void gimp_session_info_get_info (GimpSessionInfo *info) { g_return_if_fail (GIMP_IS_SESSION_INFO (info)); g_return_if_fail (GTK_IS_WIDGET (info->p->widget)); gimp_session_info_read_geometry (info, NULL /*cevent*/); if (GIMP_IS_SESSION_MANAGED (info->p->widget)) info->p->aux_info = gimp_session_managed_get_aux_info (GIMP_SESSION_MANAGED (info->p->widget)); if (GIMP_IS_DOCK_CONTAINER (info->p->widget)) { GimpDockContainer *dock_container = GIMP_DOCK_CONTAINER (info->p->widget); GList *iter = NULL; GList *docks; docks = gimp_dock_container_get_docks (dock_container); for (iter = docks; iter; iter = g_list_next (iter)) { GimpDock *dock = GIMP_DOCK (iter->data); info->p->docks = g_list_append (info->p->docks, gimp_session_info_dock_from_widget (dock)); } g_list_free (docks); } }
static gboolean gimp_session_info_restore_docks (GimpRestoreDocksData *data) { GimpSessionInfo *info = data->info; GimpDialogFactory *factory = data->factory; GdkScreen *screen = data->screen; gint monitor = data->monitor; GtkWidget *dialog = data->dialog; GList *iter; if (GIMP_IS_DOCK_CONTAINER (dialog)) { /* We expect expect there to always be docks. In sessionrc files * from <= 2.6 not all dock window entries had dock entries, but we * take care of that during sessionrc parsing */ for (iter = info->p->docks; iter; iter = g_list_next (iter)) { GimpSessionInfoDock *dock_info = (GimpSessionInfoDock *) iter->data; GtkWidget *dock; dock = GTK_WIDGET (gimp_session_info_dock_restore (dock_info, factory, screen, monitor, GIMP_DOCK_CONTAINER (dialog))); if (dock && dock_info->position != 0) { GtkWidget *parent = gtk_widget_get_parent (dock); if (GTK_IS_PANED (parent)) { GtkPaned *paned = GTK_PANED (parent); if (dock == gtk_paned_get_child2 (paned)) gtk_paned_set_position (paned, dock_info->position); } } } } gimp_session_info_clear_info (info); g_object_unref (dialog); g_object_unref (screen); g_object_unref (factory); g_object_unref (info); g_slice_free (GimpRestoreDocksData, data); return FALSE; }
/** * gimp_dock_container_get_ui_manager: * @container: A #GimpDockContainer * * Returns: The #GimpUIManager of the #GimpDockContainer **/ GimpUIManager * gimp_dock_container_get_ui_manager (GimpDockContainer *container) { GimpDockContainerInterface *iface; g_return_val_if_fail (GIMP_IS_DOCK_CONTAINER (container), NULL); iface = GIMP_DOCK_CONTAINER_GET_INTERFACE (container); if (iface->get_ui_manager) return iface->get_ui_manager (container); return NULL; }
static GimpAlignmentType gimp_session_info_dock_get_side (GimpDock *dock) { GimpAlignmentType result = -1; GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (dock)); if (GIMP_IS_DOCK_CONTAINER (toplevel)) { GimpDockContainer *container = GIMP_DOCK_CONTAINER (toplevel); result = gimp_dock_container_get_dock_side (container, dock); } return result; }
/** * gimp_dock_container_get_dock_side: * @container: A #GimpDockContainer * @dock: A #GimpDock * * Returns: What side @dock is in in @container, either * GIMP_ALIGN_LEFT or GIMP_ALIGN_RIGHT, or -1 if the side * concept is not applicable. **/ GimpAlignmentType gimp_dock_container_get_dock_side (GimpDockContainer *container, GimpDock *dock) { GimpDockContainerInterface *iface; g_return_val_if_fail (GIMP_IS_DOCK_CONTAINER (container), -1); iface = GIMP_DOCK_CONTAINER_GET_INTERFACE (container); if (iface->get_dock_side) return iface->get_dock_side (container, dock); return -1; }
/** * gimp_dock_container_add_dock: * @container: A #GimpDockContainer * @dock: The newly created #GimpDock to add to the container. * @dock_info: The #GimpSessionInfoDock the @dock was created from. * * Add @dock that was created from @dock_info to @container. **/ void gimp_dock_container_add_dock (GimpDockContainer *container, GimpDock *dock, GimpSessionInfoDock *dock_info) { GimpDockContainerInterface *iface; g_return_if_fail (GIMP_IS_DOCK_CONTAINER (container)); iface = GIMP_DOCK_CONTAINER_GET_INTERFACE (container); if (iface->add_dock) iface->add_dock (container, dock, dock_info); }