gint gtk_paned_get_position(GtkPaned *paned) { g_return_val_if_fail(paned != NULL, -1); g_return_val_if_fail(GTK_IS_PANED (paned), -1); return paned->child1_size; }
bool detach() { GRefPtr<WebKitWebViewBase> inspectorView = webkit_web_inspector_get_web_view(m_inspector); GtkWidget* pane = gtk_bin_get_child(GTK_BIN(m_parentWindow)); g_assert(GTK_IS_PANED(pane)); gtk_container_remove(GTK_CONTAINER(pane), GTK_WIDGET(inspectorView.get())); return InspectorTest::detach(); }
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; }
static void brasero_file_chooser_find_pane (GtkWidget *child, gpointer footer) { if (GTK_IS_PANED (child)) { GList *children_vbox; GList *iter_vbox; GtkWidget *vbox; vbox = gtk_paned_get_child2 (GTK_PANED (child)); children_vbox = gtk_container_get_children (GTK_CONTAINER (vbox)); for (iter_vbox = children_vbox; iter_vbox; iter_vbox = iter_vbox->next) { if (GTK_IS_BOX (iter_vbox->data) && gtk_orientable_get_orientation (GTK_ORIENTABLE (iter_vbox->data)) == GTK_ORIENTATION_HORIZONTAL) { GtkPackType packing; gtk_box_query_child_packing (GTK_BOX (vbox), GTK_WIDGET (iter_vbox->data), NULL, NULL, NULL, &packing); if (packing == GTK_PACK_START) { GtkRequisition total_request, footer_request; gtk_widget_get_preferred_size (GTK_WIDGET (vbox), &total_request, NULL); gtk_widget_get_preferred_size (GTK_WIDGET (iter_vbox->data), &footer_request, NULL); *((gint *) footer) = total_request.height - footer_request.height; break; } } } g_list_free (children_vbox); } else if (GTK_IS_CONTAINER (child)) { gtk_container_foreach (GTK_CONTAINER (child), brasero_file_chooser_find_pane, footer); } }
GimpSessionInfoBook * gimp_session_info_book_from_widget (GimpDockbook *dockbook) { GimpSessionInfoBook *info; GtkWidget *parent; GList *children; GList *list; g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), NULL); info = gimp_session_info_book_new (); parent = gtk_widget_get_parent (GTK_WIDGET (dockbook)); if (GTK_IS_PANED (parent)) { GtkPaned *paned = GTK_PANED (parent); if (GTK_WIDGET (dockbook) == gtk_paned_get_child2 (paned)) info->position = gtk_paned_get_position (paned); } info->current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); children = gtk_container_get_children (GTK_CONTAINER (dockbook)); for (list = children; list; list = g_list_next (list)) { GimpSessionInfoDockable *dockable; dockable = gimp_session_info_dockable_from_widget (list->data); info->dockables = g_list_prepend (info->dockables, dockable); } info->dockables = g_list_reverse (info->dockables); g_list_free (children); return info; }
void gitg_utils_restore_pane_position (GtkPaned *paned, gint position, gboolean reversed) { g_return_if_fail (GTK_IS_PANED (paned)); if (GTK_WIDGET_MAPPED (paned)) { paned_set_position (paned, position, reversed); return; } PanedRestoreInfo *info = g_slice_new (PanedRestoreInfo); info->position = position; info->reversed = reversed; g_signal_connect_data (paned, "map", G_CALLBACK (on_paned_mapped), info, (GClosureNotify)free_paned_restore_info, G_CONNECT_AFTER); }
GimpSessionInfoDock * gimp_session_info_dock_from_widget (GimpDock *dock) { GimpSessionInfoDock *dock_info; GList *list; GtkWidget *parent; g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL); dock_info = gimp_session_info_dock_new (GIMP_IS_TOOLBOX (dock) ? "gimp-toolbox" : "gimp-dock"); for (list = gimp_dock_get_dockbooks (dock); list; list = g_list_next (list)) { GimpSessionInfoBook *book; book = gimp_session_info_book_from_widget (list->data); dock_info->books = g_list_prepend (dock_info->books, book); } dock_info->books = g_list_reverse (dock_info->books); dock_info->side = gimp_session_info_dock_get_side (dock); parent = gtk_widget_get_parent (GTK_WIDGET (dock)); if (GTK_IS_PANED (parent)) { GtkPaned *paned = GTK_PANED (parent); if (GTK_WIDGET (dock) == gtk_paned_get_child2 (paned)) dock_info->position = gtk_paned_get_position (paned); } return dock_info; }
void brasero_file_chooser_customize (GtkWidget *widget, gpointer null_data) { /* we explore everything until we reach a treeview (there are two) */ if (GTK_IS_TREE_VIEW (widget)) { GtkTargetList *list; GdkAtom target; gboolean found; guint num; list = gtk_drag_source_get_target_list (widget); target = gdk_atom_intern ("text/uri-list", TRUE); found = gtk_target_list_find (list, target, &num); /* FIXME: should we unref them ? apparently not according to * the warning messages we get if we do */ if (found && gtk_tree_selection_get_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget))) == GTK_SELECTION_MULTIPLE) { GtkTreeModel *model; /* This is done because GtkFileChooser does not use a * GtkListStore or GtkTreeStore any more. */ egg_tree_multi_drag_add_drag_support (GTK_TREE_VIEW (widget)); model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); if (model) { GType type; type = G_OBJECT_TYPE (model); brasero_enable_multi_DND_for_model_type (type); } else g_signal_connect (widget, "notify::model", G_CALLBACK (brasero_file_chooser_notify_model), NULL); } } else if (GTK_IS_BUTTON (widget)) { GtkWidget *image; gchar *stock_id = NULL; image = gtk_button_get_image (GTK_BUTTON (widget)); if (!GTK_IS_IMAGE (image)) return; gtk_image_get_stock (GTK_IMAGE (image), &stock_id, NULL); if (stock_id && (!strcmp (stock_id,GTK_STOCK_ADD) || !strcmp (stock_id, GTK_STOCK_REMOVE))) { GtkRequisition request; gint width; GtkWidget *parent; /* This is to avoid having the left part too small */ parent = gtk_widget_get_parent (widget); gtk_widget_get_requisition (parent, &request); width = request.width; gtk_widget_get_preferred_size (parent, &request, NULL); if (request.width >= width) gtk_widget_set_size_request (parent, request.width, request.height); gtk_widget_hide (widget); } } else if (GTK_IS_CONTAINER (widget)) { if (GTK_IS_PANED (widget)) { GtkWidget *left; /* This is to allow the left part to be shrunk as much * as the user want. */ left = gtk_paned_get_child1 (GTK_PANED (widget)); g_object_ref (left); gtk_container_remove (GTK_CONTAINER (widget), left); gtk_paned_pack1 (GTK_PANED (widget), left, TRUE, TRUE); g_object_unref (left); g_signal_connect (widget, "size-allocate", G_CALLBACK (brasero_file_chooser_allocation_changed), NULL); } gtk_container_foreach (GTK_CONTAINER (widget), brasero_file_chooser_customize, NULL); } }
GimpDock * gimp_session_info_dock_restore (GimpSessionInfoDock *dock_info, GimpDialogFactory *factory, GdkScreen *screen, gint monitor, GimpDockContainer *dock_container) { gint n_books = 0; GtkWidget *dock; GList *iter; GimpUIManager *ui_manager; g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL); g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); ui_manager = gimp_dock_container_get_ui_manager (dock_container); dock = gimp_dialog_factory_dialog_new (factory, screen, monitor, ui_manager, dock_info->dock_type, -1 /*view_size*/, FALSE /*present*/); g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL); /* Add the dock to the dock window immediately so the stuff in the * dock has access to e.g. a dialog factory */ gimp_dock_container_add_dock (dock_container, GIMP_DOCK (dock), dock_info); /* Note that if it is a toolbox, we will get here even though we * don't have any books */ for (iter = dock_info->books; iter; iter = g_list_next (iter)) { GimpSessionInfoBook *book_info = iter->data; GtkWidget *dockbook; dockbook = GTK_WIDGET (gimp_session_info_book_restore (book_info, GIMP_DOCK (dock))); if (dockbook) { GtkWidget *parent = gtk_widget_get_parent (dockbook); n_books++; if (GTK_IS_PANED (parent)) { GtkPaned *paned = GTK_PANED (parent); if (dockbook == gtk_paned_get_child2 (paned)) gtk_paned_set_position (paned, book_info->position); } } } /* Now remove empty dockbooks from the list, check the comment in * gimp_session_info_book_restore() which explains why the dock * can contain empty dockbooks at all */ if (dock_info->books) { GList *books; books = g_list_copy (gimp_dock_get_dockbooks (GIMP_DOCK (dock))); while (books) { GtkContainer *dockbook = books->data; GList *children = gtk_container_get_children (dockbook); if (children) { g_list_free (children); } else { g_object_ref (dockbook); gimp_dock_remove_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook)); gtk_widget_destroy (GTK_WIDGET (dockbook)); g_object_unref (dockbook); n_books--; } books = g_list_remove (books, dockbook); } } /* if we removed all books again, the dock was destroyed, so bail out */ if (dock_info->books && n_books == 0) { return NULL; } gtk_widget_show (dock); return GIMP_DOCK (dock); }