static void cheese_thumb_view_constructed (GObject *object) { CheeseThumbView *thumb_view = CHEESE_THUMB_VIEW (object); CheeseThumbViewPrivate *priv = cheese_thumb_view_get_instance_private (thumb_view); G_OBJECT_CLASS (cheese_thumb_view_parent_class)->constructed (object); gtk_icon_view_set_model (GTK_ICON_VIEW (thumb_view), GTK_TREE_MODEL (priv->store)); gtk_widget_set_size_request (GTK_WIDGET (thumb_view), THUMB_VIEW_MINIMUM_WIDTH, THUMB_VIEW_MINIMUM_HEIGHT); gtk_icon_view_set_margin (GTK_ICON_VIEW (thumb_view), 0); gtk_icon_view_set_row_spacing (GTK_ICON_VIEW (thumb_view), 0); gtk_icon_view_set_column_spacing (GTK_ICON_VIEW (thumb_view), 0); gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (thumb_view), 0); gtk_icon_view_set_columns (GTK_ICON_VIEW (thumb_view), -1); gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (thumb_view), GDK_BUTTON1_MASK, target_table, G_N_ELEMENTS (target_table), GDK_ACTION_COPY); gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (thumb_view), GTK_SELECTION_MULTIPLE); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store), THUMBNAIL_BASENAME_URL_COLUMN, GTK_SORT_ASCENDING); cheese_thumb_view_fill (thumb_view); cheese_thumb_view_set_vertical (thumb_view, FALSE); }
JNIEXPORT void JNICALL Java_org_gnome_gtk_GtkIconView_gtk_1icon_1view_1set_1row_1spacing ( JNIEnv* env, jclass cls, jlong _self, jint _rowSpacing ) { GtkIconView* self; gint rowSpacing; // convert parameter self self = (GtkIconView*) _self; // convert parameter rowSpacing rowSpacing = (gint) _rowSpacing; // call function gtk_icon_view_set_row_spacing(self, rowSpacing); // cleanup parameter self // cleanup parameter rowSpacing }
static void row_spacing_changed (GtkSpinButton *spin_button, GtkIconView *iconview) { gint value; value = (gint)gtk_spin_button_get_value (spin_button); gtk_icon_view_set_row_spacing (iconview, value); }
static void fcitx_main_window_init(FcitxMainWindow* self) { GtkWidget* vbox = gtk_vbox_new(FALSE, 0); GtkWidget* hbox = gtk_hbox_new(FALSE, 0); self->pagestore = _fcitx_main_window_create_model(); self->pageview = gtk_icon_view_new_with_model(GTK_TREE_MODEL(self->pagestore)); gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(self->pageview), PAGE_LIST_ICON); gtk_icon_view_set_text_column(GTK_ICON_VIEW(self->pageview), PAGE_LIST_NAME); #if GTK_CHECK_VERSION(2, 22, 0) gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(self->pageview), GTK_ORIENTATION_VERTICAL); #endif _fcitx_main_window_add_im_page(self); _fcitx_main_window_add_config_file_page(self); _fcitx_main_window_add_addon_page(self); gtk_widget_set_size_request(GTK_WIDGET(self), -1, 500); self->vbox = gtk_vbox_new(FALSE, 0); self->pagelabel = gtk_label_new(""); gtk_label_set_use_markup(GTK_LABEL(self->pagelabel), true); gtk_misc_set_alignment(GTK_MISC(self->pagelabel), 0, 0.5); gtk_box_pack_start(GTK_BOX(self->vbox), self->pagelabel, FALSE, FALSE, 14); GtkWidget* scrolledwindow = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER); gtk_container_add(GTK_CONTAINER(scrolledwindow), self->pageview); gtk_box_pack_start(GTK_BOX(hbox), scrolledwindow, FALSE, TRUE, 4); gtk_box_pack_start(GTK_BOX(hbox), self->vbox, TRUE, TRUE, 8); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 8); gtk_container_add(GTK_CONTAINER(self), vbox); gtk_icon_view_set_selection_mode(GTK_ICON_VIEW(self->pageview), GTK_SELECTION_SINGLE); gtk_icon_view_set_item_padding(GTK_ICON_VIEW(self->pageview), 0); gtk_icon_view_set_margin(GTK_ICON_VIEW(self->pageview), 0); gtk_icon_view_set_column_spacing(GTK_ICON_VIEW(self->pageview), 0); gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(self->pageview), 0); gtk_icon_view_set_item_width(GTK_ICON_VIEW(self->pageview), 96); g_signal_connect_swapped(G_OBJECT(self), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(self->pageview), "selection-changed", G_CALLBACK(_fcitx_main_window_selection_changed_cb), self); GtkTreePath* path = gtk_tree_model_get_path(GTK_TREE_MODEL(self->pagestore), &self->impage->iter); gtk_icon_view_select_path(GTK_ICON_VIEW(self->pageview), path); gtk_tree_path_free(path); gtk_window_set_icon_name(GTK_WINDOW(self), "fcitx-configtool"); gtk_window_set_title(GTK_WINDOW(self), _("Fcitx Config")); }
static void eog_thumb_view_constructed (GObject *object) { EogThumbView *thumbview; if (G_OBJECT_CLASS (eog_thumb_view_parent_class)->constructed) G_OBJECT_CLASS (eog_thumb_view_parent_class)->constructed (object); thumbview = EOG_THUMB_VIEW (object); thumbview->priv->pixbuf_cell = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (thumbview), thumbview->priv->pixbuf_cell, FALSE); g_object_set (thumbview->priv->pixbuf_cell, "follow-state", FALSE, "height", 100, "width", 115, "yalign", 0.5, "xalign", 0.5, NULL); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (thumbview), thumbview->priv->pixbuf_cell, "pixbuf", EOG_LIST_STORE_THUMBNAIL, NULL); gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (thumbview), GTK_SELECTION_MULTIPLE); gtk_icon_view_set_column_spacing (GTK_ICON_VIEW (thumbview), EOG_THUMB_VIEW_SPACING); gtk_icon_view_set_row_spacing (GTK_ICON_VIEW (thumbview), EOG_THUMB_VIEW_SPACING); g_object_set (thumbview, "has-tooltip", TRUE, NULL); g_signal_connect (thumbview, "query-tooltip", G_CALLBACK (thumbview_on_query_tooltip_cb), NULL); thumbview->priv->start_thumb = 0; thumbview->priv->end_thumb = 0; thumbview->priv->menu = NULL; g_signal_connect (G_OBJECT (thumbview), "parent-set", G_CALLBACK (thumbview_on_parent_set_cb), NULL); gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (thumbview), 0, NULL, 0, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK); gtk_drag_source_add_uri_targets (GTK_WIDGET (thumbview)); g_signal_connect (G_OBJECT (thumbview), "drag-data-get", G_CALLBACK (thumbview_on_drag_data_get_cb), NULL); }
static gboolean remap_dialog (gint32 image_ID, guchar *map) { GtkWidget *dialog; GtkWidget *vbox; GtkWidget *box; GtkWidget *iconview; GtkListStore *store; GtkCellRenderer *renderer; GtkTreeIter iter; guchar *cmap; gint ncols, i; gboolean valid; gimp_ui_init (PLUG_IN_BINARY, FALSE); dialog = gimp_dialog_new (_("Rearrange Colormap"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC_REMAP, GIMP_STOCK_RESET, RESPONSE_RESET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), RESPONSE_RESET, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, TRUE, TRUE, 0); cmap = gimp_image_get_colormap (image_ID, &ncols); g_return_val_if_fail ((ncols > 0) && (ncols <= 256), FALSE); store = gtk_list_store_new (NUM_COLS, G_TYPE_INT, G_TYPE_STRING, GIMP_TYPE_RGB, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE); for (i = 0; i < ncols; i++) { GimpRGB rgb; GimpHSV hsv; gint index = map[i]; gchar *text = g_strdup_printf ("%d", index); gimp_rgb_set_uchar (&rgb, cmap[index * 3], cmap[index * 3 + 1], cmap[index * 3 + 2]); gimp_rgb_to_hsv (&rgb, &hsv); reverse_order[i] = ncols - i - 1; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COLOR_INDEX, index, COLOR_INDEX_TEXT, text, COLOR_RGB, &rgb, COLOR_H, hsv.h, COLOR_S, hsv.s, COLOR_V, hsv.v, -1); g_free (text); } g_free (cmap); remap_ui = remap_ui_manager_new (dialog, store); iconview = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store)); g_object_unref (store); gtk_box_pack_start (GTK_BOX (vbox), iconview, TRUE, TRUE, 0); gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (iconview), GTK_SELECTION_SINGLE); gtk_icon_view_set_orientation (GTK_ICON_VIEW (iconview), GTK_ORIENTATION_VERTICAL); gtk_icon_view_set_columns (GTK_ICON_VIEW (iconview), 16); gtk_icon_view_set_row_spacing (GTK_ICON_VIEW (iconview), 0); gtk_icon_view_set_column_spacing (GTK_ICON_VIEW (iconview), 0); gtk_icon_view_set_reorderable (GTK_ICON_VIEW (iconview), TRUE); renderer = gimp_cell_renderer_color_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (iconview), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (iconview), renderer, "color", COLOR_RGB, NULL); g_object_set (renderer, "width", 24, NULL); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (iconview), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (iconview), renderer, "text", COLOR_INDEX_TEXT, NULL); g_object_set (renderer, "size-points", 6.0, "xalign", 0.5, "ypad", 0, NULL); g_signal_connect (iconview, "popup-menu", G_CALLBACK (remap_popup_menu), NULL); g_signal_connect (iconview, "button-press-event", G_CALLBACK (remap_button_press), NULL); box = gimp_hint_box_new (_("Drag and drop colors to rearrange the colormap. " "The numbers shown are the original indices. " "Right-click for a menu with sort options.")); gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); gtk_widget_show (box); g_signal_connect (dialog, "response", G_CALLBACK (remap_response), store); gtk_widget_show_all (dialog); gtk_main (); i = 0; for (valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter); valid; valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter)) { gint index; gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COLOR_INDEX, &index, -1); map[i++] = index; } gtk_widget_destroy (dialog); return remap_run; }