void glade_gtk_size_group_set_property (GladeWidgetAdaptor * adaptor, GObject * object, const gchar * property_name, const GValue * value) { if (!strcmp (property_name, "widgets")) { GSList *sg_widgets, *slist; GList *widgets, *list; /* remove old widgets */ if ((sg_widgets = gtk_size_group_get_widgets (GTK_SIZE_GROUP (object))) != NULL) { /* copy since we are modifying an internal list */ sg_widgets = g_slist_copy (sg_widgets); for (slist = sg_widgets; slist; slist = slist->next) gtk_size_group_remove_widget (GTK_SIZE_GROUP (object), GTK_WIDGET (slist->data)); g_slist_free (sg_widgets); } /* add new widgets */ if ((widgets = g_value_get_boxed (value)) != NULL) { for (list = widgets; list; list = list->next) gtk_size_group_add_widget (GTK_SIZE_GROUP (object), GTK_WIDGET (list->data)); } } else GWA_GET_CLASS (G_TYPE_OBJECT)->set_property (adaptor, object, property_name, value); }
static void add_new_filechooser_button (const gchar *mnemonic, const gchar *chooser_title, GtkFileChooserAction action, GtkWidget *group_box, GtkSizeGroup *label_group) { GtkWidget *hbox, *label, *chooser, *button; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (group_box), hbox); label = gtk_label_new_with_mnemonic (mnemonic); gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_box_pack_start (GTK_BOX (hbox), label); chooser = gtk_file_chooser_button_new (g_strconcat(chooser_title, " - testfilechooserbutton", NULL), action); gtk_widget_set_hexpand (chooser, TRUE); gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL); gtk_file_chooser_remove_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser); g_signal_connect (chooser, "current-folder-changed", G_CALLBACK (chooser_current_folder_changed_cb), NULL); g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL); g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL); g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL); gtk_box_pack_start (GTK_BOX (hbox), chooser); button = gtk_button_new_with_label ("Tests"); g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser); gtk_box_pack_start (GTK_BOX (hbox), button); }
static void gtk_size_group_buildable_custom_finished (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *tagname, gpointer user_data) { GSList *l; GSListSubParserData *data; GObject *object; if (strcmp (tagname, "widgets")) return; data = (GSListSubParserData*)user_data; data->items = g_slist_reverse (data->items); for (l = data->items; l; l = l->next) { object = gtk_builder_get_object (builder, l->data); if (!object) { g_warning ("Unknown object %s specified in sizegroup %s", (const gchar*)l->data, gtk_buildable_get_name (GTK_BUILDABLE (data->object))); continue; } gtk_size_group_add_widget (GTK_SIZE_GROUP (data->object), GTK_WIDGET (object)); g_free (l->data); } g_slist_free (data->items); g_slice_free (GSListSubParserData, data); }
static void photos_edit_palette_row_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { PhotosEditPaletteRow *self = PHOTOS_EDIT_PALETTE_ROW (object); switch (prop_id) { case PROP_SIZE_GROUP: self->size_group = GTK_SIZE_GROUP (g_value_dup_object (value)); break; case PROP_TOOL: self->tool = PHOTOS_TOOL (g_value_dup_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gtk_size_group_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GtkSizeGroup *size_group = GTK_SIZE_GROUP (object); switch (prop_id) { case PROP_MODE: gtk_size_group_set_mode (size_group, g_value_get_enum (value)); break; case PROP_IGNORE_HIDDEN: gtk_size_group_set_ignore_hidden (size_group, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/* This function is used both for creating the "Display" and * "Screen" frames, since they have a similar structure. The * caller hooks up the right context for the value returned * in tree_view, and packs any relevant buttons into button_vbox. */ static void create_frame (ChangeDisplayInfo *info, const char *title, GtkWidget **frame, GtkWidget **tree_view, GtkWidget **button_vbox) { GtkTreeSelection *selection; GtkWidget *scrollwin; GtkWidget *hbox; *frame = gtk_frame_new (title); hbox = gtk_hbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER (hbox), 8); gtk_container_add (GTK_CONTAINER (*frame), hbox); scrollwin = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (hbox), scrollwin, TRUE, TRUE, 0); *tree_view = gtk_tree_view_new (); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (*tree_view), FALSE); gtk_container_add (GTK_CONTAINER (scrollwin), *tree_view); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); *button_vbox = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (hbox), *button_vbox, FALSE, FALSE, 0); if (!info->size_group) info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_size_group_add_widget (GTK_SIZE_GROUP (info->size_group), *button_vbox); }
static void gtk_size_group_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GtkSizeGroup *size_group = GTK_SIZE_GROUP (object); GtkSizeGroupPrivate *priv = size_group->priv; switch (prop_id) { case PROP_MODE: g_value_set_enum (value, priv->mode); break; case PROP_IGNORE_HIDDEN: g_value_set_boolean (value, priv->ignore_hidden); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
void gui_init(struct dt_iop_module_t *self) { self->gui_data = malloc(sizeof(dt_iop_tonecurve_gui_data_t)); dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data; dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)self->params; for (int ch=0; ch<ch_max; ch++) { c->minmax_curve[ch] = dt_draw_curve_new(0.0, 1.0, p->tonecurve_type[ch]); c->minmax_curve_nodes[ch] = p->tonecurve_nodes[ch]; c->minmax_curve_type[ch] = p->tonecurve_type[ch]; for(int k=0; k<p->tonecurve_nodes[ch]; k++) (void)dt_draw_curve_add_point(c->minmax_curve[ch], p->tonecurve[ch][k].x, p->tonecurve[ch][k].y); } c->channel = ch_L; c->mouse_x = c->mouse_y = -1.0; c->selected = -1; self->widget = gtk_vbox_new(FALSE, DT_BAUHAUS_SPACE); // tabs c->channel_tabs = GTK_NOTEBOOK(gtk_notebook_new()); gtk_notebook_append_page(GTK_NOTEBOOK(c->channel_tabs), GTK_WIDGET(gtk_hbox_new(FALSE,0)), gtk_label_new(_(" L "))); g_object_set(G_OBJECT(gtk_notebook_get_tab_label(c->channel_tabs, gtk_notebook_get_nth_page(c->channel_tabs, -1))), "tooltip-text", _("tonecurve for L channel"), NULL); gtk_notebook_append_page(GTK_NOTEBOOK(c->channel_tabs), GTK_WIDGET(gtk_hbox_new(FALSE,0)), gtk_label_new(_(" a "))); g_object_set(G_OBJECT(gtk_notebook_get_tab_label(c->channel_tabs, gtk_notebook_get_nth_page(c->channel_tabs, -1))), "tooltip-text", _("tonecurve for a channel"), NULL); gtk_notebook_append_page(GTK_NOTEBOOK(c->channel_tabs), GTK_WIDGET(gtk_hbox_new(FALSE,0)), gtk_label_new(_(" b "))); g_object_set(G_OBJECT(gtk_notebook_get_tab_label(c->channel_tabs, gtk_notebook_get_nth_page(c->channel_tabs, -1))), "tooltip-text", _("tonecurve for b channel"), NULL); gtk_widget_show_all(GTK_WIDGET(gtk_notebook_get_nth_page(c->channel_tabs, c->channel))); gtk_notebook_set_current_page(GTK_NOTEBOOK(c->channel_tabs), c->channel); g_object_set(G_OBJECT(c->channel_tabs), "homogeneous", TRUE, (char *)NULL); GtkWidget *tb = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT); g_object_set(G_OBJECT(tb), "tooltip-text", _("pick gui color from image"), (char *)NULL); GtkWidget *notebook = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(notebook), GTK_WIDGET(c->channel_tabs), FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(notebook), GTK_WIDGET(tb), FALSE, FALSE, 0); GtkWidget *vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(self->widget), vbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(notebook), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(c->channel_tabs), "switch_page", G_CALLBACK (tab_switch), self); c->area = GTK_DRAWING_AREA(gtk_drawing_area_new()); //GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, FALSE);//TRUE); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(c->area), TRUE, TRUE, 0); // gtk_box_pack_start(GTK_BOX(vbox), asp, TRUE, TRUE, 0); // gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(c->area)); gtk_drawing_area_size(c->area, 0, 258); g_object_set (GTK_OBJECT(c->area), "tooltip-text", _("double click to reset curve"), (char *)NULL); gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK); g_signal_connect (G_OBJECT (c->area), "expose-event", G_CALLBACK (dt_iop_tonecurve_expose), self); g_signal_connect (G_OBJECT (c->area), "button-press-event", G_CALLBACK (dt_iop_tonecurve_button_press), self); g_signal_connect (G_OBJECT (c->area), "motion-notify-event", G_CALLBACK (dt_iop_tonecurve_motion_notify), self); g_signal_connect (G_OBJECT (c->area), "leave-notify-event", G_CALLBACK (dt_iop_tonecurve_leave_notify), self); g_signal_connect (G_OBJECT (c->area), "enter-notify-event", G_CALLBACK (dt_iop_tonecurve_enter_notify), self); g_signal_connect (G_OBJECT (c->area), "configure-event", G_CALLBACK (area_resized), self); g_signal_connect (G_OBJECT(tb), "toggled", G_CALLBACK (pick_toggled), self); g_signal_connect (G_OBJECT (c->area), "scroll-event", G_CALLBACK (scrolled), self); c->autoscale_ab = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(c->autoscale_ab, _("scale chroma")); dt_bauhaus_combobox_add(c->autoscale_ab, _("auto")); dt_bauhaus_combobox_add(c->autoscale_ab, _("manual")); gtk_box_pack_start(GTK_BOX(self->widget), c->autoscale_ab, TRUE, TRUE, 0); g_object_set (GTK_OBJECT(c->autoscale_ab), "tooltip-text", _("if set to auto, a and b curves have no effect and are not displayed. chroma values (a and b) of each pixel are then adjusted based on L curve data."), (char *)NULL); g_signal_connect(G_OBJECT(c->autoscale_ab), "value-changed", G_CALLBACK(autoscale_ab_callback), self); c->sizegroup = GTK_SIZE_GROUP(gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL)); gtk_size_group_add_widget(c->sizegroup, GTK_WIDGET(c->area)); gtk_size_group_add_widget(c->sizegroup, GTK_WIDGET(c->channel_tabs)); }
int main (int argc, char **argv) { guint i; GtkWidget *window; GtkWidget *vbox; GtkSizeGroup *size_group; GtkWidget *hbox; GtkWidget *label; GtkWidget *button; test_entry_mask_t tab_entry[TAB_ENTRY_NB] = { { ENTRYMASK_STRING, "Phone Number:", "+99 (\\999)99-99-99", NULL }, { ENTRYMASK_STRING, "USA Zip Code:", "<<000", NULL }, { ENTRYMASK_STRING,"IP Address:", "000.000.000.000", NULL}, { ENTRYMASK_CURRENCY, "Currency:", NULL, NULL }, { ENTRYMASK_CURRENCY, "Currency (2):", "$###,###.##", NULL }, { ENTRYMASK_CURRENCY, "Currency (3):", "###,##0.00", NULL }, { ENTRYMASK_NUMERIC, "Numeric:", NULL, NULL }, { ENTRYMASK_NUMERIC, "Numeric (2):", "+00000", NULL }, { ENTRYMASK_NUMERIC, "Numeric (3):", "*,###", NULL }, { ENTRYMASK_NUMERIC, "BUG - Numeric (4):", ",*", NULL }, { ENTRYMASK_NUMERIC, "BUG - Numeric (5):", "##.0*", NULL }, { ENTRYMASK_TIME, "Time:", NULL, NULL }, { ENTRYMASK_TIME, "Time (2):", "HH:MM", NULL }, { ENTRYMASK_TIME, "Time (3):", "HH:MM:SS", NULL }, { ENTRYMASK_DATE, "Date:", NULL, NULL }, { ENTRYMASK_DATE, "Date (2):", "mm/dd/yy", NULL }, { ENTRYMASK_DATE, "Date (3):", "dd/mm/yyyy", NULL }, { ENTRYMASK_DATETIME, "Date Time:", NULL, NULL }, { ENTRYMASK_DATETIME, "Date Time (2):", "yyyy-mm-dd HH:MM:SS", NULL }, { ENTRYMASK_DATETIME, "Date Time (3):", "dd/mm/yy HH:MM", NULL } }; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Test GtkEntryMask"); g_signal_connect(window, "destroy", G_CALLBACK (gtk_main_quit), NULL); /* VBOX */ vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); gtk_box_set_spacing(GTK_BOX(vbox), 18); size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_container_add (GTK_CONTAINER (window), vbox); for (i=0; i<TAB_ENTRY_NB; i++) { label = gtk_label_new (tab_entry[i].s_label); gtk_size_group_add_widget (GTK_SIZE_GROUP (size_group), label); tab_entry[i].entry = gtk_entrymask_new_with_type (tab_entry[i].type, NULL, tab_entry[i].mask); vbox_add_label_entry (vbox, label, tab_entry[i].entry); } hbox = gtk_hbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 6); button = gtk_button_new_from_stock (GTK_STOCK_EXECUTE); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0); g_signal_connect(button, "clicked", G_CALLBACK (all_entry_get), tab_entry); button = gtk_button_new_from_stock (GTK_STOCK_QUIT); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0); g_signal_connect(button, "clicked", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show_all (window); gtk_main (); return 0; }
static void device_changed_cb(const gchar *name, PurplePrefType type, gconstpointer value, gpointer data) { GtkSizeGroup *sg = data; GtkWidget *parent, *widget; GSList *widgets; GList *devices; GValue gvalue; gint position; gchar *label, *pref; widgets = gtk_size_group_get_widgets(GTK_SIZE_GROUP(sg)); for (; widgets; widgets = g_slist_next(widgets)) { const gchar *widget_name = gtk_widget_get_name(GTK_WIDGET(widgets->data)); if (!strcmp(widget_name, name)) { gchar *temp_str; gchar delimiters[3] = {0, 0, 0}; const gchar *text; gint keyval, pos; widget = widgets->data; /* Get label with _ from the GtkLabel */ text = gtk_label_get_text(GTK_LABEL(widget)); keyval = gtk_label_get_mnemonic_keyval(GTK_LABEL(widget)); delimiters[0] = g_ascii_tolower(keyval); delimiters[1] = g_ascii_toupper(keyval); pos = strcspn(text, delimiters); if (pos != -1) { temp_str = g_strndup(text, pos); label = g_strconcat(temp_str, "_", text + pos, NULL); g_free(temp_str); } else { label = g_strdup(text); } break; } } if (widgets == NULL) return; parent = gtk_widget_get_parent(widget); widget = parent; parent = gtk_widget_get_parent(GTK_WIDGET(widget)); gvalue.g_type = 0; g_value_init(&gvalue, G_TYPE_INT); gtk_container_child_get_property(GTK_CONTAINER(parent), GTK_WIDGET(widget), "position", &gvalue); position = g_value_get_int(&gvalue); g_value_unset(&gvalue); gtk_widget_destroy(widget); pref = g_strdup(name); strcpy(pref + strlen(pref) - strlen("plugin"), "device"); devices = get_element_devices(value); if (g_list_find_custom(devices, purple_prefs_get_string(pref), (GCompareFunc)strcmp) == NULL) purple_prefs_set_string(pref, g_list_next(devices)->data); widget = pidgin_prefs_dropdown_from_list(parent, label, PURPLE_PREF_STRING, pref, devices); g_list_free(devices); g_signal_connect_swapped(widget, "destroy", G_CALLBACK(g_free), pref); g_free(label); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5); gtk_widget_set_name(widget, name); gtk_size_group_add_widget(sg, widget); gtk_box_reorder_child(GTK_BOX(parent), gtk_widget_get_parent(GTK_WIDGET(widget)), position); }
static GtkContainer * mbox_get_setup_page( XfceMailwatchMailbox *mailbox ) { XfceMailwatchMboxMailbox *mbox = XFCE_MAILWATCH_MBOX_MAILBOX( mailbox ); GtkWidget *vbox, *hbox; GtkWidget *label; GtkWidget *button, *spinner; GtkSizeGroup *sg; vbox = gtk_vbox_new( FALSE, BORDER / 2 ); gtk_widget_show( vbox ); hbox = gtk_hbox_new( FALSE, BORDER ); gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); sg = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL ); label = gtk_label_new_with_mnemonic( _( "Mbox _Filename:" ) ); gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); gtk_size_group_add_widget( GTK_SIZE_GROUP( sg ), label ); button = gtk_file_chooser_button_new( _("Select mbox file"), GTK_FILE_CHOOSER_ACTION_OPEN ); g_mutex_lock( mbox->settings_mutex ); if ( mbox->fn ) { gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( button ), mbox->fn ); } g_mutex_unlock( mbox->settings_mutex ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox ), button, TRUE, TRUE, 0 ); g_signal_connect( G_OBJECT( button ), "file-set", G_CALLBACK( mbox_file_set_cb ), mbox ); gtk_label_set_mnemonic_widget( GTK_LABEL( label ), button ); hbox = gtk_hbox_new( FALSE, BORDER ); gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); label = gtk_label_new_with_mnemonic( _( "_Interval:" ) ); gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); gtk_size_group_add_widget( GTK_SIZE_GROUP( sg ), label ); spinner = gtk_spin_button_new_with_range( 1.0, 1440.0, 1.0 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spinner ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spinner ), FALSE ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinner ), mbox->interval / 60 ); gtk_widget_show( spinner ); gtk_box_pack_start( GTK_BOX( hbox ), spinner, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( spinner ), "value-changed", G_CALLBACK( mbox_interval_changed_cb ), mbox ); gtk_label_set_mnemonic_widget( GTK_LABEL( label ), spinner ); label = gtk_label_new( _( "minute(s)." ) ); gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); return ( GTK_CONTAINER( vbox ) ); }
int main (int argc, char *argv[]) { GtkWidget *win, *vbox, *frame, *alignment, *group_box; GtkWidget *hbox, *label, *chooser, *button; GtkSizeGroup *label_group; GOptionContext *context; gchar *cwd; context = g_option_context_new ("- test GtkFileChooserButton widget"); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); gtk_init (&argc, &argv); /* to test rtl layout, use "--right-to-left" */ if (rtl) gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL); cwd = g_get_current_dir(); gtk_src_dir = g_path_get_dirname (cwd); g_free (cwd); win = gtk_dialog_new_with_buttons ("TestFileChooserButton", NULL, 0, "_Quit", GTK_RESPONSE_CLOSE, NULL); g_signal_connect (win, "response", G_CALLBACK (gtk_main_quit), NULL); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); g_object_set (vbox, "margin", 6, NULL); gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (win))), vbox); frame = gtk_frame_new ("<b>GtkFileChooserButton</b>"); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); gtk_label_set_use_markup (GTK_LABEL (gtk_frame_get_label_widget (GTK_FRAME (frame))), TRUE); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0); gtk_container_add (GTK_CONTAINER (frame), alignment); label_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); group_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_add (GTK_CONTAINER (alignment), group_box); /* OPEN */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (group_box), hbox, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic ("_Open:"); gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); chooser = gtk_file_chooser_button_new ("Select A File - testfilechooserbutton", GTK_FILE_CHOOSER_ACTION_OPEN); gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL); gtk_file_chooser_remove_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser); g_signal_connect (chooser, "current-folder-changed", G_CALLBACK (chooser_current_folder_changed_cb), NULL); g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL); g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL); g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL); gtk_box_pack_start (GTK_BOX (hbox), chooser, TRUE, TRUE, 0); button = gtk_button_new_with_label ("Properties"); g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); button = gtk_button_new_with_label ("Tests"); g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); /* SELECT_FOLDER */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (group_box), hbox, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic ("Select _Folder:"); gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); chooser = gtk_file_chooser_button_new ("Select A Folder - testfilechooserbutton", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL); gtk_file_chooser_remove_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL); gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser); g_signal_connect (chooser, "current-folder-changed", G_CALLBACK (chooser_current_folder_changed_cb), NULL); g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL); g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL); g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL); gtk_box_pack_start (GTK_BOX (hbox), chooser, TRUE, TRUE, 0); button = gtk_button_new_with_label ("Properties"); g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); button = gtk_button_new_with_label ("Tests"); g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); g_object_unref (label_group); gtk_widget_show_all (win); gtk_window_present (GTK_WINDOW (win)); gtk_main (); return 0; }
static void hildon_font_selection_dialog_construct_notebook (HildonFontSelectionDialog *fontsel) { gint i; GtkWidget *vbox_tab[3]; GtkWidget *font_color_box; GtkWidget *caption_control; GtkSizeGroup *group; HildonFontSelectionDialogPrivate *priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE (fontsel); g_assert (priv); for (i = 0; i < 3; i++) vbox_tab[i] = gtk_vbox_new (TRUE, 0); group = GTK_SIZE_GROUP (gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL)); /* Build the first page of the GtkNotebook: font style */ priv->cbx_font_type = gtk_combo_box_new_text (); hildon_font_selection_dialog_show_available_fonts (fontsel); caption_control = hildon_caption_new (group, _("ecdg_fi_font_font"), priv->cbx_font_type, NULL, HILDON_CAPTION_OPTIONAL); gtk_box_pack_start (GTK_BOX (vbox_tab[0]), caption_control, FALSE, FALSE, 0); priv->cbx_font_size = gtk_combo_box_new_text (); hildon_font_selection_dialog_show_available_sizes (priv); caption_control = hildon_caption_new (group, _("ecdg_fi_font_size"), priv->cbx_font_size, NULL, HILDON_CAPTION_OPTIONAL); gtk_box_pack_start (GTK_BOX (vbox_tab[0]), caption_control, FALSE, FALSE, 0); font_color_box = gtk_hbox_new (FALSE, 0); priv->font_color_button = hildon_color_button_new (); priv->color_set = FALSE; priv->font_scaling = 1.0; priv->color_modified_signal_handler = g_signal_connect (G_OBJECT (priv->font_color_button), "notify::color", G_CALLBACK (color_modified_cb), (gpointer) priv); gtk_box_pack_start (GTK_BOX (font_color_box), priv->font_color_button, FALSE, FALSE, 0); caption_control = hildon_caption_new (group, _("ecdg_fi_font_colour_selector"), font_color_box, NULL, HILDON_CAPTION_OPTIONAL); gtk_box_pack_start (GTK_BOX (vbox_tab[0]), caption_control, FALSE, FALSE, 0); /* Build the second page of the GtkNotebook: font formatting */ priv->chk_bold = gtk_check_button_new (); caption_control = hildon_caption_new (group, _("ecdg_fi_font_bold"), priv->chk_bold, NULL, HILDON_CAPTION_OPTIONAL); gtk_box_pack_start (GTK_BOX (vbox_tab[1]), caption_control, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (priv->chk_bold), "clicked", G_CALLBACK(toggle_clicked), NULL); priv->chk_italic = gtk_check_button_new (); caption_control = hildon_caption_new (group, _("ecdg_fi_font_italic"), priv->chk_italic, NULL, HILDON_CAPTION_OPTIONAL); gtk_box_pack_start (GTK_BOX (vbox_tab[1]), caption_control, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(priv->chk_italic), "clicked", G_CALLBACK(toggle_clicked), NULL); priv->chk_underline = gtk_check_button_new(); caption_control = hildon_caption_new (group, _("ecdg_fi_font_underline"), priv->chk_underline, NULL, HILDON_CAPTION_OPTIONAL); gtk_box_pack_start (GTK_BOX (vbox_tab[1]), caption_control, FALSE, FALSE, 0); g_signal_connect (G_OBJECT(priv->chk_underline), "clicked", G_CALLBACK (toggle_clicked), NULL); /* Build the third page of the GtkNotebook: other font properties */ priv->chk_strikethrough = gtk_check_button_new (); caption_control = hildon_caption_new(group, _("ecdg_fi_font_strikethrough"), priv->chk_strikethrough, NULL, HILDON_CAPTION_OPTIONAL); gtk_box_pack_start (GTK_BOX (vbox_tab[2]), caption_control, FALSE, FALSE, 0); g_signal_connect (G_OBJECT(priv->chk_strikethrough), "clicked", G_CALLBACK (toggle_clicked), NULL); priv->cbx_positioning = gtk_combo_box_new_text (); hildon_font_selection_dialog_show_available_positionings (priv); caption_control = hildon_caption_new(group, _("ecdg_fi_font_special"), priv->cbx_positioning, NULL, HILDON_CAPTION_OPTIONAL); g_object_unref (group); gtk_box_pack_start (GTK_BOX (vbox_tab[2]), caption_control, FALSE, FALSE, 0); /* Populate notebook */ gtk_notebook_insert_page (priv->notebook, vbox_tab[0], NULL, 0); gtk_notebook_insert_page (priv->notebook, vbox_tab[1], NULL, 1); gtk_notebook_insert_page (priv->notebook, vbox_tab[2], NULL, 2); gtk_notebook_set_tab_label_text (priv->notebook, vbox_tab[0], _("ecdg_ti_font_dialog_style")); gtk_notebook_set_tab_label_text (priv->notebook, vbox_tab[1], _("ecdg_ti_font_dialog_format")); gtk_notebook_set_tab_label_text (priv->notebook, vbox_tab[2], _("ecdg_ti_font_dialog_other")); gtk_widget_show_all (GTK_WIDGET (priv->notebook)); }
GtkWidget* pp_cms_new (ProfileManager *pm) { pp_CMS *ob=PP_CMS(g_object_new (pp_cms_get_type (), NULL)); gtk_box_set_spacing(GTK_BOX(ob),5); ob->pm=pm; GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); GtkWidget *frame; GtkWidget *label; GtkWidget *hbox; GtkWidget *vbox; // Printer frame frame=gtk_frame_new(_("Printer")); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_box_pack_start(GTK_BOX(ob),frame,FALSE,FALSE,0); gtk_widget_show(frame); vbox=gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),vbox); gtk_widget_show(vbox); // Checkbox and file entry. hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,0); gtk_widget_show(hbox); ob->printeractive=gtk_check_button_new_with_label(_("Printer Profile:")); g_signal_connect(G_OBJECT(ob->printeractive),"toggled",G_CALLBACK(cms_changed),ob); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),ob->printeractive); gtk_box_pack_start(GTK_BOX(hbox),ob->printeractive,FALSE,FALSE,5); gtk_widget_show(ob->printeractive); ob->printerprof=profileselector_new(pm,IS_TYPE_NULL,true); g_signal_connect(G_OBJECT(ob->printerprof),"changed",G_CALLBACK(cms_changed),ob); gtk_box_pack_start(GTK_BOX(hbox),ob->printerprof,TRUE,TRUE,5); gtk_widget_show(ob->printerprof); // Rendering Intent hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,5); gtk_widget_show(hbox); label=gtk_label_new(_("Rendering intent:")); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),label); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,5); gtk_widget_show(label); ob->intent = intentselector_new(pm); gtk_box_pack_start(GTK_BOX(hbox),ob->intent,TRUE,TRUE,5); gtk_widget_show(ob->intent); // Printer Colour Space hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,5); gtk_widget_show(hbox); label=gtk_label_new(_("Colour space:")); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),label); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,5); gtk_widget_show(label); // Colourspace SimpleComboOptions csopts; csopts.Add("RGB",_("RGB"),_("Send Red, Green and Blue data to the printer driver")); csopts.Add("CMYK",_("CMYK"),_("Send Cyan, Magenta, Yellow and Black data to the printer driver")); csopts.Add("DeviceN",_("DeviceN"),_("Send raw printer channels to the printer driver")); ob->colourspace=simplecombo_new(csopts); g_signal_connect(G_OBJECT(ob->colourspace),"changed",G_CALLBACK(cms_changed),ob); gtk_box_pack_start(GTK_BOX(hbox),ob->colourspace,TRUE,TRUE,5); gtk_widget_show(ob->colourspace); // Monitor frame frame=gtk_frame_new(_("Monitor")); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_box_pack_start(GTK_BOX(ob),frame,FALSE,FALSE,0); gtk_widget_show(frame); vbox=gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),vbox); gtk_widget_show(vbox); hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,5); gtk_widget_show(hbox); ob->monitoractive=gtk_check_button_new_with_label(_("Monitor Profile:")); g_signal_connect(G_OBJECT(ob->monitoractive),"toggled",G_CALLBACK(cms_changed),ob); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),ob->monitoractive); gtk_box_pack_start(GTK_BOX(hbox),ob->monitoractive,FALSE,FALSE,5); gtk_widget_show(ob->monitoractive); ob->monitorprof=profileselector_new(pm,IS_TYPE_RGB,false); g_signal_connect(G_OBJECT(ob->monitorprof),"changed",G_CALLBACK(cms_changed),ob); gtk_box_pack_start(GTK_BOX(hbox),ob->monitorprof,TRUE,TRUE,5); gtk_widget_show(ob->monitorprof); hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,5); gtk_widget_show(hbox); label=gtk_label_new(_("Display mode:")); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),label); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,5); gtk_widget_show(label); // Proof mode SimpleComboOptions pmopts; pmopts.Add("Normal",_("Normal"),_("Displays images' original colours, transformed to suit the monitor")); pmopts.Add("SimulatePrint",_("Simulate Print"),_("Simulates how colours will look when printed, imitating the paper's white point.")); pmopts.Add("SimulatePrintAdaptWhite",_("Simulate Print, Adapt White"),_("Simulates how colours will look when printed, adapting colours for the monitor's white point.")); ob->displaymode=simplecombo_new(pmopts); gtk_box_pack_start(GTK_BOX(hbox),ob->displaymode,TRUE,TRUE,5); gtk_widget_show(ob->displaymode); // Default Profiles frame frame=gtk_frame_new(_("Default Image Profiles")); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_box_pack_start(GTK_BOX(ob),frame,FALSE,FALSE,0); gtk_widget_show(frame); vbox=gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),vbox); gtk_widget_show(vbox); // Grey Profile - Checkbox and file entry. hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,0); gtk_widget_show(hbox); ob->greyactive=gtk_check_button_new_with_label(_("Grey Profile:")); g_signal_connect(G_OBJECT(ob->greyactive),"toggled",G_CALLBACK(cms_changed),ob); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),ob->greyactive); gtk_box_pack_start(GTK_BOX(hbox),ob->greyactive,FALSE,FALSE,5); gtk_widget_show(ob->greyactive); ob->greyprof=profileselector_new(pm,IS_TYPE_GREY,false); g_signal_connect(G_OBJECT(ob->greyprof),"changed",G_CALLBACK(cms_changed),ob); gtk_box_pack_start(GTK_BOX(hbox),ob->greyprof,TRUE,TRUE,5); gtk_widget_show(ob->greyprof); // RGB Profile - Checkbox and file entry. hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,0); gtk_widget_show(hbox); ob->rgbactive=gtk_check_button_new_with_label(_("RGB Profile:")); g_signal_connect(G_OBJECT(ob->rgbactive),"toggled",G_CALLBACK(cms_changed),ob); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),ob->rgbactive); gtk_box_pack_start(GTK_BOX(hbox),ob->rgbactive,FALSE,FALSE,5); gtk_widget_show(ob->rgbactive); ob->rgbprof=profileselector_new(pm,IS_TYPE_RGB,false); g_signal_connect(G_OBJECT(ob->rgbprof),"changed",G_CALLBACK(cms_changed),ob); gtk_box_pack_start(GTK_BOX(hbox),ob->rgbprof,TRUE,TRUE,5); gtk_widget_show(ob->rgbprof); // CMYK Profile - Checkbox and file entry. hbox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,5); gtk_widget_show(hbox); ob->cmykactive=gtk_check_button_new_with_label(_("CMYK Profile:")); g_signal_connect(G_OBJECT(ob->cmykactive),"toggled",G_CALLBACK(cms_changed),ob); gtk_size_group_add_widget(GTK_SIZE_GROUP(sizegroup),ob->cmykactive); gtk_box_pack_start(GTK_BOX(hbox),ob->cmykactive,FALSE,FALSE,5); gtk_widget_show(ob->cmykactive); ob->cmykprof=profileselector_new(pm,IS_TYPE_CMYK,false); g_signal_connect(G_OBJECT(ob->cmykprof),"changed",G_CALLBACK(cms_changed),ob); gtk_box_pack_start(GTK_BOX(hbox),ob->cmykprof,TRUE,TRUE,5); gtk_widget_show(ob->cmykprof); GtkWidget *table=gtk_table_new(3,3,FALSE); gtk_table_set_col_spacings(GTK_TABLE(table),12); gtk_table_set_row_spacings(GTK_TABLE(table),3); gtk_box_pack_start(GTK_BOX(ob),table,FALSE,FALSE,3); gtk_widget_show(table); for(int i=0;i<3;++i) { GtkAttachOptions gao = (GtkAttachOptions)(GTK_EXPAND|GTK_FILL); ob->indicator[i]=gtk_image_new(); gtk_table_attach(GTK_TABLE(table),ob->indicator[i],1,2,i,i+1,GTK_SHRINK,gao,0,0); gtk_widget_show(ob->indicator[i]); ob->statusline[i]=gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(ob->statusline[i]),0,0.5); gtk_table_attach(GTK_TABLE(table),ob->statusline[i],2,3,i,i+1,gao,gao,0,0); gtk_widget_show(ob->statusline[i]); } g_object_unref(G_OBJECT(sizegroup)); pp_cms_refresh(ob); return(GTK_WIDGET(ob)); }