static void gimp_data_editor_constructed (GObject *object) { GimpDataEditor *editor = GIMP_DATA_EDITOR (object); G_OBJECT_CLASS (parent_class)->constructed (object); g_assert (GIMP_IS_DATA_FACTORY (editor->data_factory)); g_assert (GIMP_IS_CONTEXT (editor->context)); gimp_data_editor_set_edit_active (editor, TRUE); editor->save_button = gimp_editor_add_button (GIMP_EDITOR (editor), "document-save", _("Save"), NULL, G_CALLBACK (gimp_data_editor_save_clicked), NULL, editor); editor->revert_button = gimp_editor_add_button (GIMP_EDITOR (editor), "document-revert", _("Revert"), NULL, G_CALLBACK (gimp_data_editor_revert_clicked), NULL, editor); /* Hide because revert buttons are not yet implemented */ gtk_widget_hide (editor->revert_button); }
static void gimp_container_popup_create_view (GimpContainerPopup *popup) { GimpEditor *editor; GtkWidget *button; popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR, NULL); gimp_container_editor_construct (popup->editor, popup->view_type, popup->container, popup->context, popup->view_size, popup->view_border_width, NULL, NULL, NULL); gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view), FALSE); gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (popup->editor->view), 6 * (popup->default_view_size + 2 * popup->view_border_width), 10 * (popup->default_view_size + 2 * popup->view_border_width)); if (GIMP_IS_EDITOR (popup->editor->view)) gimp_editor_set_show_name (GIMP_EDITOR (popup->editor->view), FALSE); gtk_container_add (GTK_CONTAINER (popup->frame), GTK_WIDGET (popup->editor)); gtk_widget_show (GTK_WIDGET (popup->editor)); editor = GIMP_EDITOR (popup->editor->view); gimp_editor_add_button (editor, GTK_STOCK_ZOOM_OUT, _("Smaller Previews"), NULL, G_CALLBACK (gimp_container_popup_smaller_clicked), NULL, popup); gimp_editor_add_button (editor, GTK_STOCK_ZOOM_IN, _("Larger Previews"), NULL, G_CALLBACK (gimp_container_popup_larger_clicked), NULL, popup); button = gimp_editor_add_stock_box (editor, GIMP_TYPE_VIEW_TYPE, "gimp", G_CALLBACK (gimp_container_popup_view_type_toggled), popup); gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), popup->view_type); if (popup->dialog_factory) gimp_editor_add_button (editor, popup->dialog_stock_id, popup->dialog_tooltip, NULL, G_CALLBACK (gimp_container_popup_dialog_clicked), NULL, popup); gtk_widget_grab_focus (GTK_WIDGET (popup->editor)); }
static void gimp_controller_list_init (GimpControllerList *list) { GtkWidget *hbox; GtkWidget *sw; GtkWidget *tv; GtkTreeViewColumn *column; GtkCellRenderer *cell; GtkWidget *vbox; GtkWidget *image; GtkIconSize icon_size; gint icon_width; gint icon_height; GType *controller_types; guint n_controller_types; gint i; gtk_orientable_set_orientation (GTK_ORIENTABLE (list), GTK_ORIENTATION_VERTICAL); list->gimp = NULL; list->hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (list), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0); gtk_widget_show (sw); list->src = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_GTYPE); tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list->src)); g_object_unref (list->src); gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (tv), FALSE); column = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column, _("Available Controllers")); gtk_tree_view_append_column (GTK_TREE_VIEW (tv), column); cell = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, cell, FALSE); gtk_tree_view_column_set_attributes (column, cell, "icon-name", COLUMN_ICON, NULL); g_object_get (cell, "stock-size", &icon_size, NULL); cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell, TRUE); gtk_tree_view_column_set_attributes (column, cell, "text", COLUMN_NAME, NULL); gtk_container_add (GTK_CONTAINER (sw), tv); gtk_widget_show (tv); g_signal_connect_object (tv, "row-activated", G_CALLBACK (gimp_controller_list_row_activated), G_OBJECT (list), 0); list->src_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv)); gtk_tree_selection_set_mode (list->src_sel, GTK_SELECTION_BROWSE); g_signal_connect_object (list->src_sel, "changed", G_CALLBACK (gimp_controller_list_src_sel_changed), G_OBJECT (list), 0); controller_types = g_type_children (GIMP_TYPE_CONTROLLER, &n_controller_types); for (i = 0; i < n_controller_types; i++) { GimpControllerClass *controller_class; GtkTreeIter iter; controller_class = g_type_class_ref (controller_types[i]); gtk_list_store_append (list->src, &iter); gtk_list_store_set (list->src, &iter, COLUMN_ICON, controller_class->icon_name, COLUMN_NAME, controller_class->name, COLUMN_TYPE, controller_types[i], -1); g_type_class_unref (controller_class); } g_free (controller_types); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); list->add_button = gtk_button_new (); gtk_box_pack_start (GTK_BOX (vbox), list->add_button, TRUE, FALSE, 0); gtk_widget_set_sensitive (list->add_button, FALSE); gtk_widget_show (list->add_button); image = gtk_image_new_from_icon_name ("go-next", GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (list->add_button), image); gtk_widget_show (image); g_signal_connect (list->add_button, "clicked", G_CALLBACK (gimp_controller_list_add_clicked), list); g_object_add_weak_pointer (G_OBJECT (list->add_button), (gpointer) &list->add_button); list->remove_button = gtk_button_new (); gtk_box_pack_start (GTK_BOX (vbox), list->remove_button, TRUE, FALSE, 0); gtk_widget_set_sensitive (list->remove_button, FALSE); gtk_widget_show (list->remove_button); image = gtk_image_new_from_icon_name ("go-previous", GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (list->remove_button), image); gtk_widget_show (image); g_signal_connect (list->remove_button, "clicked", G_CALLBACK (gimp_controller_list_remove_clicked), list); g_object_add_weak_pointer (G_OBJECT (list->remove_button), (gpointer) &list->remove_button); gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (list)), icon_size, &icon_width, &icon_height); list->dest = gimp_container_tree_view_new (NULL, NULL, icon_height, 0); gimp_container_tree_view_set_main_column_title (GIMP_CONTAINER_TREE_VIEW (list->dest), _("Active Controllers")); gtk_tree_view_set_headers_visible (GIMP_CONTAINER_TREE_VIEW (list->dest)->view, TRUE); gtk_box_pack_start (GTK_BOX (list->hbox), list->dest, TRUE, TRUE, 0); gtk_widget_show (list->dest); g_signal_connect_object (list->dest, "select-item", G_CALLBACK (gimp_controller_list_select_item), G_OBJECT (list), 0); g_signal_connect_object (list->dest, "activate-item", G_CALLBACK (gimp_controller_list_activate_item), G_OBJECT (list), 0); list->edit_button = gimp_editor_add_button (GIMP_EDITOR (list->dest), "document-properties", _("Configure the selected controller"), NULL, G_CALLBACK (gimp_controller_list_edit_clicked), NULL, list); list->up_button = gimp_editor_add_button (GIMP_EDITOR (list->dest), "go-up", _("Move the selected controller up"), NULL, G_CALLBACK (gimp_controller_list_up_clicked), NULL, list); list->down_button = gimp_editor_add_button (GIMP_EDITOR (list->dest), "go-down", _("Move the selected controller down"), NULL, G_CALLBACK (gimp_controller_list_down_clicked), NULL, list); gtk_widget_set_sensitive (list->edit_button, FALSE); gtk_widget_set_sensitive (list->up_button, FALSE); gtk_widget_set_sensitive (list->down_button, FALSE); }
static void gimp_container_popup_create_view (GimpContainerPopup *popup) { GimpEditor *editor; GtkWidget *button; popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR, "view-type", popup->view_type, "container", popup->container, "context", popup->context, "view-size", popup->view_size, "view-border-width", popup->view_border_width, NULL); gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view), FALSE); if (popup->view_type == GIMP_VIEW_TYPE_LIST) { GtkWidget *search_entry; search_entry = gtk_entry_new (); gtk_box_pack_end (GTK_BOX (popup->editor->view), search_entry, FALSE, FALSE, 0); gtk_tree_view_set_search_entry (GTK_TREE_VIEW (GIMP_CONTAINER_TREE_VIEW (GIMP_CONTAINER_VIEW (popup->editor->view))->view), GTK_ENTRY (search_entry)); gtk_widget_show (search_entry); } gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (popup->editor->view), 6 * (popup->default_view_size + 2 * popup->view_border_width), 10 * (popup->default_view_size + 2 * popup->view_border_width)); if (GIMP_IS_EDITOR (popup->editor->view)) gimp_editor_set_show_name (GIMP_EDITOR (popup->editor->view), FALSE); gtk_container_add (GTK_CONTAINER (popup->frame), GTK_WIDGET (popup->editor)); gtk_widget_show (GTK_WIDGET (popup->editor)); editor = GIMP_EDITOR (popup->editor->view); gimp_editor_add_button (editor, "zoom-out", _("Smaller Previews"), NULL, G_CALLBACK (gimp_container_popup_smaller_clicked), NULL, popup); gimp_editor_add_button (editor, "zoom-in", _("Larger Previews"), NULL, G_CALLBACK (gimp_container_popup_larger_clicked), NULL, popup); button = gimp_editor_add_icon_box (editor, GIMP_TYPE_VIEW_TYPE, "gimp", G_CALLBACK (gimp_container_popup_view_type_toggled), popup); gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), popup->view_type); if (popup->dialog_factory) gimp_editor_add_button (editor, popup->dialog_icon_name, popup->dialog_tooltip, NULL, G_CALLBACK (gimp_container_popup_dialog_clicked), NULL, popup); gtk_widget_grab_focus (GTK_WIDGET (popup->editor)); }