// object hierarchy: // parent // |-- background (event-box) // |-- alignment // |-- vbox // |-- name item // |-- desc item // |-- finish item // GtkWidget* create_content_metadata_wnd(GtkWidget * parent) { CL_LOGPRINTF("entry"); // main window g_wnd.window = parent; // g_signal_connect(G_OBJECT(g_wnd.window), "focus-in-event", G_CALLBACK(on_main_wnd_focus_in), wnd); // g_signal_connect(G_OBJECT(g_wnd.window), "key_press_event", G_CALLBACK(on_keypress), wnd); g_signal_connect(G_OBJECT(g_wnd.window), "expose-event", G_CALLBACK(on_expose), NULL); // background GtkWidget* background = gtk_event_box_new(); gtk_widget_set_name(GTK_WIDGET(background), "content_wnd_background"); gtk_widget_set_size_request(GTK_WIDGET(background), METADATA_BK_IMG_WIDTH, METADATA_BK_IMG_HEIGHT); gtk_container_add(GTK_CONTAINER(parent), background); gtk_widget_show(background); // alignment GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 0.0, 0.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), METADATA_VBORDER, METADATA_VBORDER, METADATA_HBORDER, METADATA_HBORDER); gtk_container_add(GTK_CONTAINER(background), alignment); gtk_widget_show(alignment); // vbox GtkWidget* vbox = gtk_vbox_new(FALSE, METADATA_WND_ITEM_SPACING); gtk_container_add(GTK_CONTAINER(alignment), vbox); gtk_widget_show(vbox); // name item createNameItem(vbox); // desc item createDescItem(vbox); // finish item createFinishItem(vbox); // set screen texts content_metadata_set_text(); // instance-private data g_wnd.on_change_occurred = FALSE; g_wnd.on_movecursor_occurred = FALSE; g_wnd.display_update_pending = FALSE; return background; }
// widget hierarchy // |--settingitem (GtkSettingItem) // |--background (GtkEventBox) // |--alignment // |--vbox // |--label_show_time_prompt // |--label_current_time GtkWidget *create_current_time_display(void) { GtkWidget* settingitem; GtkWidget* background; GtkWidget* alignment; GtkWidget* vbox; GtkWidget* label; // settingitem settingitem = gtk_settingitem_new(""); gtk_widget_set_size_request(settingitem, -1, -1); // background background = gtk_event_box_new(); gtk_widget_set_name(background, "datetime_display_background"); gtk_widget_set_size_request(background, TITLE_MIN_WIDTH, DATETIME_DISPLAY_HEIGHT); gtk_settingitem_add_details(GTK_SETTINGITEM(settingitem), background); // alignment alignment = gtk_alignment_new(0, 0, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), DATETIME_SCREEN_ITEM_PADDING_TOP, DATETIME_SCREEN_ITEM_PADDING_BOTTOM, DATETIME_SCREEN_ITEM_PADDING_LEFT, DATETIME_SCREEN_ITEM_PADDING_RIGHT); gtk_container_add(GTK_CONTAINER(background), alignment); // vbox vbox = gtk_vbox_new(FALSE, DATETIME_DISPLAY_SPACING); gtk_container_add(GTK_CONTAINER(alignment), vbox); label = gtk_label_new(""); gtk_widget_set_name(label, "datetime_screen_info_text"); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); g_datetime_screen->label_show_time_prompt = label; label = gtk_label_new(""); gtk_widget_set_name(label, "datetime_screen_date_text"); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); g_datetime_screen->label_current_time = label; gtk_widget_show_all(background); gtk_widget_show(settingitem); return settingitem; }
static void end_clicked_cb (GtkButton *button, JanaGtkRecurrence *self) { GtkWidget *window, *datetime, *check, *toplevel, *vbox, *close, *align; JanaGtkRecurrencePrivate *priv = RECURRENCE_PRIVATE (self); JanaTime *time; /* Time-editing dialog */ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); if (GTK_WIDGET_TOPLEVEL (toplevel)) gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (toplevel)); gtk_window_set_modal (GTK_WINDOW (window), TRUE); gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DIALOG); vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); check = gtk_check_button_new_with_mnemonic ("Repeats _forever"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), priv->recur->end ? FALSE : TRUE); time = priv->recur->end ? jana_time_duplicate (priv->recur->end) : jana_time_duplicate (priv->time); jana_time_set_isdate (time, TRUE); datetime = jana_gtk_date_time_new (time); jana_gtk_date_time_set_editable (JANA_GTK_DATE_TIME (datetime), TRUE); gtk_widget_set_sensitive (datetime, priv->recur->end ? TRUE : FALSE); align = gtk_alignment_new (1.0, 0.5, 0.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 0, 0); close = gtk_button_new_from_stock (GTK_STOCK_CLOSE); gtk_container_add (GTK_CONTAINER (align), close); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), datetime, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, TRUE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); g_object_set_data (G_OBJECT (window), "self", self); g_signal_connect (check, "toggled", G_CALLBACK (forever_toggled_cb), datetime); g_signal_connect (close, "clicked", G_CALLBACK (close_clicked_cb), datetime); gtk_widget_show_all (window); }
static void ol_osd_toolbar_init (OlOsdToolbar *toolbar) { OlOsdToolbarPriv *priv = OL_OSD_TOOLBAR_GET_PRIVATE (toolbar); gtk_alignment_set (GTK_ALIGNMENT (toolbar), 0.5, 0.5, 0.0, 0.0); toolbar->center_box = GTK_HBOX (gtk_hbox_new (FALSE, 0)); gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->center_box)); toolbar->prev_button = _add_button (toolbar, &btn_spec[BTN_PREV]); toolbar->play_button = _add_button (toolbar, &btn_spec[BTN_PLAY]); toolbar->pause_button = _add_button (toolbar, &btn_spec[BTN_PAUSE]); toolbar->stop_button = _add_button (toolbar, &btn_spec[BTN_STOP]); toolbar->next_button = _add_button (toolbar, &btn_spec[BTN_NEXT]); priv->player = NULL; _update_status (toolbar); _update_caps (toolbar); }
static GtkWidget* create_expander (const char *caption, GtkWidget *child, gdouble xscale, gdouble yscale) { GtkWidget *expander = gtk_expander_new (""); GtkWidget *label = gtk_expander_get_label_widget (GTK_EXPANDER (expander)); GtkWidget *align = gtk_alignment_new (0, 0, xscale, yscale); gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 18, 0); gtk_label_set_markup (GTK_LABEL (label), caption); gtk_container_add (GTK_CONTAINER (expander), align); gtk_container_add (GTK_CONTAINER (align), child); return expander; }
GtkWindow* create_simple_modal_dialog_window(const char* title, ModalDialog& dialog, GtkWidget* contents) { GtkWindow* window = create_fixedsize_modal_dialog_window(0, title, dialog); GtkVBox* vbox1 = create_dialog_vbox(8, 4); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(vbox1)); gtk_container_add(GTK_CONTAINER(vbox1), contents); GtkAlignment* alignment = GTK_ALIGNMENT(gtk_alignment_new(0.5, 0.0, 0.0, 0.0)); gtk_widget_show(GTK_WIDGET(alignment)); gtk_box_pack_start(GTK_BOX(vbox1), GTK_WIDGET(alignment), FALSE, FALSE, 0); GtkButton* button = create_dialog_button("OK", G_CALLBACK(dialog_button_ok), &dialog); gtk_container_add(GTK_CONTAINER(alignment), GTK_WIDGET(button)); return window; }
static GtkWidget *create_small_app_window(void) { GtkWidget *window, *parent, *widget; GtkTooltips *tt; window = app_window_common(); /* event box to catch clicks on the tokencode frame */ widget = gtk_event_box_new(); g_signal_connect(widget, "button-press-event", G_CALLBACK(clipboard_callback), NULL); gtk_container_add(GTK_CONTAINER(window), widget); parent = widget; /* tooltip */ tt = gtk_tooltips_new(); gtk_tooltips_set_tip(tt, parent, "Click to copy to clipboard", NULL); /* tokencode frame */ widget = gtk_frame_new("Tokencode"); gtk_container_add(GTK_CONTAINER(parent), widget); parent = widget; /* spacing inside the frame */ widget = gtk_alignment_new(0.5, 0.5, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(widget), 10, 10, 10, 10); gtk_container_add(GTK_CONTAINER(parent), widget); parent = widget; /* vbox */ widget = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(parent), widget); parent = widget; /* tokencode */ gtk_box_pack_start(GTK_BOX(parent), tokencode_text, FALSE, FALSE, 0); /* progress bar */ progress_bar = gtk_progress_bar_new(); gtk_widget_set_size_request(progress_bar, 0, 10); gtk_box_pack_start(GTK_BOX(parent), progress_bar, FALSE, FALSE, 0); return window; }
static GtkWidget* create_frame (const char *caption, GtkWidget *child, gdouble xscale, gdouble yscale) { GtkWidget *frame = gtk_frame_new (""); GtkWidget *label = gtk_frame_get_label_widget (GTK_FRAME (frame)); GtkWidget *align = gtk_alignment_new (0, 0, xscale, yscale); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 18, 0); gtk_label_set_markup (GTK_LABEL (label), caption); gtk_container_add (GTK_CONTAINER (frame), align); gtk_container_add (GTK_CONTAINER (align), child); return frame; }
// widget layout // parent // |-alignment // |--vbox // |--sortTypeWidget // |--sortOrderWidget // |--sortFinishWidget // GtkWidget *create_sort_wnd(GtkWidget * parent) { GtkWidget *background; GtkWidget *alignment; GtkWidget *vbox; GtkWidget *sortTypeWidget; GtkWidget *sortOrderWidget; GtkWidget *sortFinishWidget; // background background = gtk_event_box_new(); gtk_widget_set_name(GTK_WIDGET(background), "sort_wnd_background"); gtk_widget_set_size_request(GTK_WIDGET(background), (-1), (-1)); gtk_container_add(GTK_CONTAINER(parent), background); // alignment alignment = gtk_alignment_new(0.0, 0.0, 0.0, 0.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 0, 0); gtk_container_add(GTK_CONTAINER(background), alignment); // vbox vbox = gtk_vbox_new(FALSE, SORT_WND_SPACING_V); gtk_container_add(GTK_CONTAINER(alignment), vbox); // sortTypeWidget sortTypeWidget = create_sort_type_widget(); gtk_box_pack_start(GTK_BOX(vbox), sortTypeWidget, FALSE, FALSE, 0); // sortOrderWidget sortOrderWidget = create_sort_order_widget(); gtk_box_pack_start(GTK_BOX(vbox), sortOrderWidget, FALSE, FALSE, 0); // sortFinishWidget sortFinishWidget = create_sort_finish_widget(); gtk_box_pack_start(GTK_BOX(vbox), sortFinishWidget, FALSE, FALSE, 0); // global variables g_sort_wnd.window = parent; // show widgets gtk_widget_show_all(background); // signal g_signal_connect(G_OBJECT(g_sort_wnd.window), "expose-event", G_CALLBACK(on_sort_wnd_expose), NULL); // return return background; }
void diaElemFrame::setMe(void *dialog, void *opaque,uint32_t line) { GtkWidget *label; GtkWidget *table; GtkWidget *alignment; GtkWidget *vbox; char str[200]; sprintf(str,"<b>%s</b>",paramTitle); label = gtk_label_new (str); gtk_misc_set_alignment (GTK_MISC (label), 0, 1); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_widget_show(label); vbox = gtk_vbox_new (0, 0); alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 18, 0); table = gtk_table_new (frameSize, 2, FALSE); gtk_container_add (GTK_CONTAINER (alignment), table); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), alignment, FALSE, FALSE, 0); gtk_widget_show(table); gtk_widget_show(vbox); gtk_box_pack_start (GTK_BOX(opaque), vbox, FALSE, FALSE, 0); uint32_t v=0; for(int i=0;i<nbElems;i++) { elems[i]->setMe(dialog,table,v); v+=elems[i]->getSize(); } myWidget=(void *)table; }
/***************Plugins pages****************/ static void setup_plugin_pages (GtrPreferencesDialog * dlg) { GtkWidget *alignment; GtkWidget *page_content; alignment = gtk_alignment_new (0., 0., 1., 1.); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12); page_content = peas_gtk_plugin_manager_new (NULL); g_return_if_fail (page_content != NULL); gtk_container_add (GTK_CONTAINER (alignment), page_content); gtk_box_pack_start (GTK_BOX (dlg->priv->plugins_box), alignment, TRUE, TRUE, 0); gtk_widget_show_all (page_content); }
static GtkWidget * contacts_edit_add_focus_events (GtkWidget *widget, GtkWidget *ebox, GList *widgets) { if (!ebox) { GtkWidget *align = gtk_alignment_new (0.5, 0.5, 1, 1); ebox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (align), widget); gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 6, 6); gtk_container_add (GTK_CONTAINER (ebox), align); gtk_widget_show (align); gtk_widget_show (ebox); gtk_widget_set_name (ebox, gtk_widget_get_name (widget)); } if (!widget) return ebox; if (GTK_IS_CONTAINER (widget) && !GTK_IS_TEXT_VIEW (widget)) { GList *c, *children = gtk_container_get_children (GTK_CONTAINER (widget)); for (c = children; c; c = c->next) { contacts_edit_add_focus_events (GTK_WIDGET (c->data), ebox, widgets); } g_list_free (children); } else if (GTK_IS_WIDGET (widget)) { GList *w; g_signal_connect (G_OBJECT (widget), "focus-in-event", G_CALLBACK (contacts_edit_focus_in), ebox); g_signal_connect (G_OBJECT (widget), "focus-out-event", G_CALLBACK (contacts_edit_focus_out), ebox); for (w = widgets; w; w = w->next) { g_signal_connect (G_OBJECT (widget), "focus-in-event", G_CALLBACK (contacts_edit_focus_in), w->data); g_signal_connect (G_OBJECT (widget), "focus-out-event", G_CALLBACK (contacts_edit_focus_out), w->data); } } return ebox; }
GtkWidget* popup_new(GtkWidget* parent, const gchar* text, gboolean mouse) { GtkWidget* w = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_type_hint(GTK_WINDOW(w), GDK_WINDOW_TYPE_HINT_UTILITY); gtk_window_set_position(GTK_WINDOW(w), mouse ? GTK_WIN_POS_MOUSE : GTK_WIN_POS_CENTER_ALWAYS); if (parent) gtk_window_set_transient_for(GTK_WINDOW(w), GTK_WINDOW(gtk_widget_get_toplevel(parent))); gtk_window_set_modal(GTK_WINDOW(w), TRUE); gtk_window_set_decorated(GTK_WINDOW(w), TRUE); gtk_window_set_skip_taskbar_hint(GTK_WINDOW(w), TRUE); if (text) { GtkWidget* label = gtk_label_new(text); GtkWidget* align = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(align), 20, 20, 20, 20); gtk_container_add(GTK_CONTAINER(align), label); gtk_container_add(GTK_CONTAINER(w), align); } return w; }
static void empathy_new_account_dialog_init (EmpathyNewAccountDialog *self) { GtkWidget *w, *hbox, *content; self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_NEW_ACCOUNT_DIALOG, EmpathyNewAccountDialogPrivate); self->priv->main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (self->priv->main_vbox), 12); gtk_widget_show (self->priv->main_vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (self->priv->main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); w = gtk_label_new (_("What kind of chat account do you have?")); gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0); gtk_widget_show (w); w = gtk_alignment_new (0, 0, 0, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0); gtk_box_pack_start (GTK_BOX (self->priv->main_vbox), w, FALSE, FALSE, 0); gtk_widget_show (w); self->priv->chooser = empathy_protocol_chooser_new (); gtk_box_pack_start (GTK_BOX (hbox), self->priv->chooser, FALSE, FALSE, 0); gtk_widget_show (self->priv->chooser); content = gtk_dialog_get_content_area (GTK_DIALOG (self)); gtk_container_add (GTK_CONTAINER (content), self->priv->main_vbox); g_signal_connect (self->priv->chooser, "changed", G_CALLBACK (protocol_changed_cb), self); /* trigger show the first account widget */ protocol_changed_cb (GTK_COMBO_BOX (self->priv->chooser), self); gtk_window_set_title (GTK_WINDOW (self), _("Adding new account")); }
void pgd_movie_view_set_movie (GtkWidget *movie_view, PopplerMovie *movie) { GtkWidget *alignment; GtkWidget *table; GtkWidget *button; gint row = 0; alignment = gtk_bin_get_child (GTK_BIN (movie_view)); if (alignment) { gtk_container_remove (GTK_CONTAINER (movie_view), alignment); } alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5); gtk_container_add (GTK_CONTAINER (movie_view), alignment); gtk_widget_show (alignment); if (!movie) return; table = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (table), 6); gtk_grid_set_row_spacing (GTK_GRID (table), 6); pgd_table_add_property (GTK_GRID (table), "<b>Filename:</b>", poppler_movie_get_filename (movie), &row); pgd_table_add_property (GTK_GRID (table), "<b>Need Poster:</b>", poppler_movie_need_poster (movie) ? "Yes" : "No", &row); pgd_table_add_property (GTK_GRID (table), "<b>Show Controls:</b>", poppler_movie_show_controls (movie) ? "Yes" : "No", &row); button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PLAY); g_signal_connect (button, "clicked", G_CALLBACK (pgd_movie_view_play_movie), movie); pgd_table_add_property_with_custom_widget (GTK_GRID (table), NULL, button, &row); gtk_widget_show (button); gtk_container_add (GTK_CONTAINER (alignment), table); gtk_widget_show (table); }
static void add_grid_rows (VpnPasswordDialog *dialog) { VpnPasswordDialogPrivate *priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog); int row; int offset = 0; gtk_alignment_set_padding (GTK_ALIGNMENT (priv->grid_alignment), 0, 0, offset, 0); /* This will not kill the entries, since they are ref:ed */ gtk_container_foreach (GTK_CONTAINER (priv->grid), (GtkCallback) remove_child, priv->grid); row = 0; if (priv->show_password) add_row (priv->grid, row++, priv->primary_password_label, priv->password_entry); if (priv->show_password_secondary) add_row (priv->grid, row++, priv->secondary_password_label, priv->password_entry_secondary); gtk_grid_attach (GTK_GRID (priv->grid), priv->show_passwords_checkbox, 1, row, 1, 1); gtk_widget_show_all (priv->grid); }
GtkWidget * utl_gui_create_frame (GtkWidget *container, const gchar *name) { GtkWidget *frame, *label, *alignment; frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); /* gtk_container_add (GTK_CONTAINER (container), frame);*/ gtk_box_pack_start (GTK_BOX (container), frame, FALSE, FALSE, 0); label = utl_gui_create_label ("<b>%s</b>", name); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_frame_set_label_widget (GTK_FRAME (frame), label); alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_container_add (GTK_CONTAINER (frame), alignment); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), ALIGNMENT_PADDING_TOP, ALIGNMENT_PADDING_BOTTOM, ALIGNMENT_PADDING_LEFT, ALIGNMENT_PADDING_RIGHT); return alignment; }
static GtkWidget *create_pref_page(Plugin *p, GtkWidget *dialog) { GtkWidget *page = NULL; /* some plugins don't have prefs */ if (p->cbs.configure) { page = p->cbs.configure(&p->public, GTK_DIALOG(dialog), p->cb_data); if (! GTK_IS_WIDGET(page)) { geany_debug("Invalid widget returned from plugin_configure() in plugin \"%s\"!", p->info.name); return NULL; } else { GtkWidget *align = gtk_alignment_new(0.5, 0.5, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(align), 6, 6, 6, 6); gtk_container_add(GTK_CONTAINER(align), page); page = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(page), align, TRUE, TRUE, 0); } }
struct s_interface *f_interface_initialize(struct s_interface *supplied, const char *builder_path) { struct s_interface *result = supplied; int index; if (!result) if (!(result = (struct s_interface *)d_malloc(sizeof(struct s_interface)))) d_die(d_error_malloc); result->destroy = d_false; if ((result->interface = gtk_builder_new())) if ((gtk_builder_add_from_file(result->interface, builder_path, NULL))) { d_assert(result->window = GTK_WINDOW(gtk_builder_get_object(result->interface, "v_window"))); for (index = 0; index < e_interface_chart_NULL; ++index) { d_assert(f_chart_new(&(result->logic_charts[index]))); d_assert(f_chart_hook_interface(&(result->logic_charts[index]), "../components/UI/UI_scale_config.glade")); f_chart_style(&(result->logic_charts[index]), "styles/base_graph.keys"); f_chart_style(&(result->logic_charts[index]), v_interface_chart_styles[index]); d_assert(result->charts[index] = GTK_ALIGNMENT(gtk_builder_get_object(result->interface, v_interface_charts[index]))); gtk_container_add(GTK_CONTAINER(result->charts[index]), g_object_ref(result->logic_charts[index].plane)); } for (index = 0; index < e_interface_label_NULL; ++index) d_assert(result->labels[index] = GTK_LABEL(gtk_builder_get_object(result->interface, v_interface_labels[index]))); } return result; }
/** * mate_password_dialog_set_show_userpass_buttons: * @password_dialog: A #MatePasswordDialog * @show_userpass_buttons: Boolean value that controls whether the radio buttons for connecting * anonymously and connecting as user should be shown or not. * * Description: Shows the radio buttons for connecting anonymously and connecting as user if * @show_userpass_buttons is #TRUE. Also makes the 'Username' and 'Password' fields greyed out if the * radio button for connecting anonymously is active. If @show_userpass_buttons is #FALSE, then these * radio buttons are hidden and the 'Username' and 'Password' fields will be made active. * * Since: 2.8 */ void mate_password_dialog_set_show_userpass_buttons (MatePasswordDialog *password_dialog, gboolean show) { MatePasswordDialogDetails *priv; const gchar *username; gboolean sensitive = TRUE; g_return_if_fail (MATE_IS_PASSWORD_DIALOG (password_dialog)); priv = password_dialog->details; show = show != FALSE; priv->show_userpass_buttons_set = TRUE; if (priv->show_userpass_buttons != show) { priv->show_userpass_buttons = show; g_object_set (priv->radio_vbox, "visible", priv->show_userpass_buttons, NULL); if (show) { sensitive = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->connect_with_no_userpass_button)); } gtk_widget_set_sensitive (priv->table_alignment, sensitive); gtk_alignment_set_padding (GTK_ALIGNMENT (priv->table_alignment), 0, 0, show ? 12 : 0, 0); /* Compute default */ if (!priv->anonymous_set) { username = gtk_entry_get_text (GTK_ENTRY (priv->username_entry)); mate_password_dialog_set_anon (password_dialog, username == NULL || username[0] == '\0', FALSE); } g_object_notify (G_OBJECT (password_dialog), "readonly-domain"); } }
static void cb_player_properties(GtkWidget *widget, gpointer data) { int active = purple_prefs_get_int(PREF_PLAYER); if (active != -1 && g_players[active].pref_func) { GtkWidget *vbox, *align; GtkWidget *dialog = gtk_dialog_new_with_buttons(g_players[active].name, NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_NONE, NULL); vbox = gtk_vbox_new(FALSE, 5); align = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(align), 10, 10, 10, 10); gtk_container_add(GTK_CONTAINER(align), vbox); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), align); // Ask player pref_func to add controls to dialog (*g_players[active].pref_func)(GTK_BOX(vbox)); gtk_widget_show_all(dialog); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } }
/** * he_check_button_set_alignment: * @button: a #HeCheckButton * @xalign: the horizontal alignment of the contents, from 0 (left) to 1 (right). * @yalign: the vertical alignment of the contents, from 0 (top) to 1 (bottom). * @xscale: the amount that the child widget expands horizontally to fill up unused space, from 0 to 1 * @yscale: the amount that the child widget expands vertically to fill up unused space, from 0 to 1 * * Sets the alignment of the contents of the widget. If you don't need * to change @xscale or @yscale you can just use * gtk_button_set_alignment() instead. * * Note that for this method to work properly, the child widget of * @button must be a #GtkAlignment. That's what #HeCheckButton uses by * default, so this function will work unless you add a custom widget * to @button. * * Since: 2.2 **/ void he_check_button_set_alignment (HeCheckButton *button, gfloat xalign, gfloat yalign, gfloat xscale, gfloat yscale) { HeCheckButtonPrivate *priv; GtkWidget *child; g_return_if_fail (HE_IS_CHECK_BUTTON (button)); priv = HE_CHECK_BUTTON_GET_PRIVATE (button); child = gtk_bin_get_child (GTK_BIN (button)); /* If the button has no child, use priv->alignment, which is the default one */ if (child == NULL) child = priv->alignment; if (GTK_IS_ALIGNMENT (child)) { gtk_alignment_set (GTK_ALIGNMENT (priv->alignment), xalign, yalign, xscale, yscale); } }
// create the connect-to-server screens // // object hierarchy: // |--alignment // |--g_connect_notebook (gtkNotebook) // |--> page (connect-screen-options) // |--> page (connect-screen profiles) // GtkWidget *connect_screen_create (void) { CN_LOGPRINTF ("entry"); GtkWidget *alignment; GtkWidget *page; // alignment alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, SCREEN_BORDER, 0); gtk_widget_show(alignment); // connect_notebook g_connect_notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (g_connect_notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (g_connect_notebook), FALSE); gtk_container_add (GTK_CONTAINER (alignment), g_connect_notebook); // page: connect-screen-options page = connect_options_create (); gtk_notebook_append_page(GTK_NOTEBOOK (g_connect_notebook), page, NULL); // page: connect-screen profiles page = connect_profiles_create (); gtk_notebook_append_page(GTK_NOTEBOOK(g_connect_notebook), page, NULL); // notebook pages start counting from zero gtk_notebook_set_current_page (GTK_NOTEBOOK(g_connect_notebook), 0); gtk_widget_show (g_connect_notebook); g_signal_connect_after(g_connect_notebook, "switch-page", G_CALLBACK (on_connect_switch_page), NULL); return alignment; }
GtkWidget *discard_build_page(void) { GtkWidget *vbox; GtkWidget *label; GtkWidget *alignment; GtkWidget *scroll_win; GtkCellRenderer *renderer; GtkTreeViewColumn *column; vbox = gtk_vbox_new(FALSE, 6); gtk_widget_show(vbox); alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 3, 3); gtk_widget_show(alignment); gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0); label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), /* Caption for list of player that must discard cards */ _("<b>Waiting for players to discard</b>")); gtk_widget_show(label); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_container_add(GTK_CONTAINER(alignment), label); scroll_win = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scroll_win), GTK_SHADOW_IN); gtk_widget_show(scroll_win); gtk_box_pack_start(GTK_BOX(vbox), scroll_win, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); discard_store = gtk_list_store_new(DISCARD_COLUMN_LAST, GDK_TYPE_PIXBUF, /* player icon */ G_TYPE_INT, /* player number */ G_TYPE_STRING, /* text */ G_TYPE_INT); /* amount to discard */ discard_widget = gtk_tree_view_new_with_model(GTK_TREE_MODEL(discard_store)); column = gtk_tree_view_column_new_with_attributes("", gtk_cell_renderer_pixbuf_new (), "pixbuf", DISCARD_COLUMN_PLAYER_ICON, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_append_column(GTK_TREE_VIEW(discard_widget), column); column = gtk_tree_view_column_new_with_attributes("", gtk_cell_renderer_text_new (), "text", DISCARD_COLUMN_PLAYER_NAME, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_column_set_expand(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(discard_widget), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("", renderer, "text", DISCARD_COLUMN_AMOUNT, NULL); g_object_set(renderer, "xalign", 1.0f, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_append_column(GTK_TREE_VIEW(discard_widget), column); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(discard_widget), FALSE); gtk_widget_show(discard_widget); gtk_container_add(GTK_CONTAINER(scroll_win), discard_widget); return vbox; }
static GtkWidget * account_assistant_build_enter_or_create_page (EmpathyAccountAssistant *self) { EmpathyAccountAssistantPriv *priv = GET_PRIV (self); GtkWidget *main_vbox, *w, *chooser, *vbox, *hbox, *radio; main_vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_widget_show (main_vbox); w = gtk_label_new (NULL); gtk_misc_set_alignment (GTK_MISC (w), 0, 0); gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0); gtk_widget_show (w); priv->first_label = w; w = gtk_alignment_new (0, 0, 0, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0); gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0); gtk_widget_show (w); chooser = empathy_protocol_chooser_new (); gtk_container_add (GTK_CONTAINER (w), chooser); gtk_widget_show (chooser); priv->chooser = chooser; vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_end (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); w = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); gtk_label_set_line_wrap (GTK_LABEL (w), TRUE); gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); gtk_widget_show (w); priv->second_label = w; w = gtk_alignment_new (0, 0, 0, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); gtk_widget_show (w); hbox = gtk_hbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (w), hbox); gtk_widget_show (hbox); radio = gtk_radio_button_new_with_label (NULL, _("Yes")); gtk_box_pack_start (GTK_BOX (hbox), radio, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (radio), "response", GINT_TO_POINTER (RESPONSE_CREATE_AGAIN)); gtk_widget_show (radio); w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, that's all for now")); gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (w), "response", GINT_TO_POINTER (RESPONSE_CREATE_STOP)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), TRUE); priv->create_enter_resp = RESPONSE_CREATE_STOP; priv->create_again_radio = w; gtk_widget_show (w); g_signal_connect (w, "clicked", G_CALLBACK (account_assistant_radio_create_again_clicked_cb), self); g_signal_connect (radio, "clicked", G_CALLBACK (account_assistant_radio_create_again_clicked_cb), self); return main_vbox; }
static GtkWidget * account_assistant_build_introduction_page (EmpathyAccountAssistant *self) { EmpathyAccountAssistantPriv *priv = GET_PRIV (self); GtkWidget *main_vbox, *hbox_1, *w, *vbox_1; GtkWidget *radio = NULL; GdkPixbuf *pix; const gchar *str; main_vbox = gtk_vbox_new (FALSE, 12); gtk_widget_show (main_vbox); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); hbox_1 = gtk_hbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (main_vbox), hbox_1, TRUE, TRUE, 0); gtk_widget_show (hbox_1); w = gtk_label_new ( _("With Empathy you can chat with people " "online nearby and with friends and colleagues " "who use Google Talk, AIM, Windows Live " "and many other chat programs. With a microphone " "or a webcam you can also have audio or video calls.")); gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5); gtk_label_set_line_wrap (GTK_LABEL (w), TRUE); gtk_box_pack_start (GTK_BOX (hbox_1), w, FALSE, FALSE, 0); gtk_widget_show (w); pix = empathy_pixbuf_from_icon_name_sized ("empathy", 80); w = gtk_image_new_from_pixbuf (pix); gtk_box_pack_start (GTK_BOX (hbox_1), w, FALSE, FALSE, 6); gtk_widget_show (w); g_object_unref (pix); w = gtk_label_new (_("Do you have an account you've been using " "with another chat program?")); gtk_misc_set_alignment (GTK_MISC (w), 0, 0); gtk_label_set_line_wrap (GTK_LABEL (w), TRUE); gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0); gtk_widget_show (w); w = gtk_alignment_new (0, 0, 0, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0); gtk_box_pack_start (GTK_BOX (main_vbox), w, TRUE, TRUE, 0); gtk_widget_show (w); vbox_1 = gtk_vbox_new (TRUE, 0); gtk_container_add (GTK_CONTAINER (w), vbox_1); gtk_widget_show (vbox_1); if (empathy_import_accounts_to_import ()) { hbox_1 = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox_1), hbox_1, TRUE, TRUE, 0); gtk_widget_show (hbox_1); radio = gtk_radio_button_new_with_label (NULL, _("Yes, import my account details from ")); gtk_box_pack_start (GTK_BOX (hbox_1), radio, TRUE, TRUE, 0); g_object_set_data (G_OBJECT (radio), "response", GINT_TO_POINTER (RESPONSE_IMPORT)); gtk_widget_show (radio); w = gtk_combo_box_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (w), "Pidgin"); gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 0); gtk_combo_box_set_active (GTK_COMBO_BOX (w), 0); gtk_widget_show (w); g_signal_connect (radio, "clicked", G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); priv->first_resp = RESPONSE_IMPORT; } else { priv->first_resp = RESPONSE_ENTER_ACCOUNT; } str = _("Yes, I'll enter my account details now"); if (radio == NULL) { radio = gtk_radio_button_new_with_label (NULL, str); w = radio; } else { w = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON (radio), str); } gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); g_object_set_data (G_OBJECT (w), "response", GINT_TO_POINTER (RESPONSE_ENTER_ACCOUNT)); gtk_widget_show (w); g_signal_connect (w, "clicked", G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I want a new account")); gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); g_object_set_data (G_OBJECT (w), "response", GINT_TO_POINTER (RESPONSE_CREATE_ACCOUNT)); gtk_widget_show (w); g_signal_connect (w, "clicked", G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I just want to see people online nearby for now")); gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); g_object_set_data (G_OBJECT (w), "response", GINT_TO_POINTER (RESPONSE_SALUT_ONLY)); gtk_widget_show (w); g_signal_connect (w, "clicked", G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); return main_vbox; }
static void xpad_preferences_init (XpadPreferences *pref) { GtkWidget *hbox, *font_hbox, *vbox; const GdkColor *color; const gchar *fontname; GtkStyle *style; GtkWidget *label, *appearance_frame, *alignment, *appearance_vbox; GtkWidget *options_frame, *options_vbox, *global_vbox; gchar *text; GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); GtkRequisition req; pref->priv = XPAD_PREFERENCES_GET_PRIVATE (pref); text = g_strconcat ("<b>", _("Appearance"), "</b>", NULL); label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, "label", text, "use-markup", TRUE, "xalign", 0.0, NULL)); g_free (text); appearance_vbox = GTK_WIDGET (g_object_new (GTK_TYPE_VBOX, "homogeneous", FALSE, "spacing", 18, NULL)); alignment = gtk_alignment_new (1, 1, 1, 1); g_object_set (G_OBJECT (alignment), "left-padding", 12, "top-padding", 12, "child", appearance_vbox, NULL); appearance_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME, "label-widget", label, "shadow-type", GTK_SHADOW_NONE, "child", alignment, NULL)); pref->priv->textbutton = gtk_color_button_new (); pref->priv->backbutton = gtk_color_button_new (); pref->priv->fontbutton = gtk_font_button_new (); pref->priv->antifontcheck = gtk_radio_button_new_with_mnemonic (NULL, _("Use font from theme")); pref->priv->fontcheck = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (pref->priv->antifontcheck), _("Use this font:")); pref->priv->anticolorcheck = gtk_radio_button_new_with_mnemonic (NULL, _("Use colors from theme")); pref->priv->colorcheck = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (pref->priv->anticolorcheck), _("Use these colors:")); font_hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (font_hbox), pref->priv->fontcheck, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (font_hbox), pref->priv->fontbutton, TRUE, TRUE, 0); pref->priv->colorbox = gtk_vbox_new (FALSE, 6); hbox = gtk_hbox_new (FALSE, 12); label = gtk_label_new_with_mnemonic (_("Background:")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_size_group_add_widget (size_group_labels, label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), pref->priv->backbutton, TRUE, TRUE, 0); g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL); hbox = gtk_hbox_new (FALSE, 12); label = gtk_label_new_with_mnemonic (_("Foreground:")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_size_group_add_widget (size_group_labels, label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), pref->priv->textbutton, TRUE, TRUE, 0); g_object_set (G_OBJECT (pref->priv->colorbox), "child", hbox, NULL); alignment = gtk_alignment_new (1, 1, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0); gtk_container_add (GTK_CONTAINER (alignment), pref->priv->colorbox); pref->priv->editcheck = gtk_check_button_new_with_mnemonic (_("_Edit lock")); pref->priv->stickycheck = gtk_check_button_new_with_mnemonic (_("_Pads start on all workspaces")); pref->priv->confirmcheck = gtk_check_button_new_with_mnemonic (_("_Confirm pad deletion")); gtk_dialog_add_button (GTK_DIALOG (pref), "gtk-close", GTK_RESPONSE_CLOSE); gtk_dialog_set_default_response (GTK_DIALOG (pref), GTK_RESPONSE_CLOSE); gtk_dialog_set_has_separator (GTK_DIALOG (pref), FALSE); g_signal_connect (pref, "response", G_CALLBACK (xpad_preferences_response), NULL); gtk_window_set_title (GTK_WINDOW (pref), _("Xpad Preferences")); gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (pref->priv->textbutton), FALSE); gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (pref->priv->backbutton), xpad_app_get_translucent ()); gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->textbutton), _("Set Foreground Color")); gtk_color_button_set_title (GTK_COLOR_BUTTON (pref->priv->backbutton), _("Set Background Color")); gtk_font_button_set_title (GTK_FONT_BUTTON (pref->priv->fontbutton), _("Set Font")); /* Set current state */ style = gtk_widget_get_default_style (); color = xpad_settings_get_back_color (xpad_settings ()); if (color) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE); gtk_color_button_set_color (GTK_COLOR_BUTTON (pref->priv->backbutton), color); } else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE); gtk_widget_set_sensitive (pref->priv->colorbox, FALSE); gtk_color_button_set_color (GTK_COLOR_BUTTON (pref->priv->backbutton), &style->base[GTK_STATE_NORMAL]); } color = xpad_settings_get_text_color (xpad_settings ()); if (color) gtk_color_button_set_color (GTK_COLOR_BUTTON (pref->priv->textbutton), color); else gtk_color_button_set_color (GTK_COLOR_BUTTON (pref->priv->textbutton), &style->text[GTK_STATE_NORMAL]); fontname = xpad_settings_get_fontname (xpad_settings ()); if (fontname) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->fontcheck), TRUE); gtk_font_button_set_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton), fontname); } else { gchar *str; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->antifontcheck), TRUE); gtk_widget_set_sensitive (pref->priv->fontbutton, FALSE); str = pango_font_description_to_string (style->font_desc); gtk_font_button_set_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton), str); g_free (str); } gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->editcheck), xpad_settings_get_edit_lock (xpad_settings ())); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->stickycheck), xpad_settings_get_sticky (xpad_settings ())); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_settings ())); vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), pref->priv->antifontcheck, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), font_hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (appearance_vbox), vbox, FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), pref->priv->anticolorcheck, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), pref->priv->colorcheck, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (appearance_vbox), vbox, FALSE, FALSE, 0); text = g_strconcat ("<b>", _("Options"), "</b>", NULL); label = GTK_WIDGET (g_object_new (GTK_TYPE_LABEL, "label", text, "use-markup", TRUE, "xalign", 0.0, NULL)); g_free (text); options_vbox = GTK_WIDGET (g_object_new (GTK_TYPE_VBOX, "homogeneous", FALSE, "spacing", 6, NULL)); alignment = gtk_alignment_new (1, 1, 1, 1); g_object_set (G_OBJECT (alignment), "left-padding", 12, "top-padding", 12, "child", options_vbox, NULL); options_frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME, "label-widget", label, "shadow-type", GTK_SHADOW_NONE, "child", alignment, NULL)); gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->editcheck, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->stickycheck, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); global_vbox = g_object_new (GTK_TYPE_VBOX, "border-width", 6, "homogeneous", FALSE, "spacing", 18, "child", appearance_frame, "child", options_frame, NULL); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pref)->vbox), global_vbox, FALSE, FALSE, 0); pref->priv->editcheck_handler = g_signal_connect (pref->priv->editcheck, "toggled", G_CALLBACK (change_edit_check), pref); pref->priv->stickycheck_handler = g_signal_connect (pref->priv->stickycheck, "toggled", G_CALLBACK (change_sticky_check), pref); pref->priv->confirmcheck_handler = g_signal_connect (pref->priv->confirmcheck, "toggled", G_CALLBACK (change_confirm_check), pref); pref->priv->colorcheck_handler = g_signal_connect (pref->priv->colorcheck, "toggled", G_CALLBACK (change_color_check), pref); pref->priv->fontcheck_handler = g_signal_connect (pref->priv->fontcheck, "toggled", G_CALLBACK (change_font_check), pref); pref->priv->text_handler = g_signal_connect (pref->priv->textbutton, "color-set", G_CALLBACK (change_text_color), pref); pref->priv->back_handler = g_signal_connect (pref->priv->backbutton, "color-set", G_CALLBACK (change_back_color), pref); pref->priv->font_handler = g_signal_connect (pref->priv->fontbutton, "font-set", G_CALLBACK (change_font_face), pref); pref->priv->notify_font_handler = g_signal_connect_swapped (xpad_settings (), "notify::fontname", G_CALLBACK (notify_fontname), pref); pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_settings (), "notify::text-color", G_CALLBACK (notify_text_color), pref); pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_settings (), "notify::back-color", G_CALLBACK (notify_back_color), pref); pref->priv->notify_sticky_handler = g_signal_connect_swapped (xpad_settings (), "notify::sticky", G_CALLBACK (notify_sticky), pref); pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_settings (), "notify::edit-lock", G_CALLBACK (notify_edit), pref); pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_settings (), "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref); g_object_unref (size_group_labels); gtk_widget_show_all (GTK_DIALOG (pref)->vbox); /* Make window not so squished */ gtk_widget_size_request (GTK_WIDGET (pref), &req); g_object_set (G_OBJECT (pref), "default-width", (gint) (req.height * 0.8), NULL); }
static void charset_combo_box_run_dialog (ECharsetComboBox *combo_box) { GtkDialog *dialog; GtkEntry *entry; GtkWidget *container; GtkWidget *widget; GObject *object; gpointer parent; const gchar *charset; /* FIXME Using a dialog for this is lame. Selecting "Other..." * should unlock an entry directly in the Preferences tab. * Unfortunately space in Preferences is at a premium right * now, but we should revisit this when the space issue is * finally resolved. */ parent = gtk_widget_get_toplevel (GTK_WIDGET (combo_box)); parent = gtk_widget_is_toplevel (parent) ? parent : NULL; object = G_OBJECT (combo_box->priv->other_action); charset = g_object_get_data (object, "charset"); widget = gtk_dialog_new_with_buttons ( _("Character Encoding"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); /* Load the broken border width defaults so we can override them. */ gtk_widget_ensure_style (widget); dialog = GTK_DIALOG (widget); //gtk_dialog_set_has_separator (dialog, FALSE); gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK); gtk_container_set_border_width (GTK_CONTAINER (dialog), 12); widget = gtk_dialog_get_action_area (dialog); gtk_container_set_border_width (GTK_CONTAINER (widget), 0); widget = gtk_dialog_get_content_area (dialog); gtk_box_set_spacing (GTK_BOX (widget), 12); gtk_container_set_border_width (GTK_CONTAINER (widget), 0); container = widget; widget = gtk_label_new (_("Enter the character set to use")); gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); widget = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (widget), 0, 0, 12, 0); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); container = widget; widget = gtk_entry_new (); entry = GTK_ENTRY (widget); gtk_entry_set_activates_default (entry, TRUE); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); g_signal_connect ( entry, "changed", G_CALLBACK (charset_combo_box_entry_changed_cb), dialog); /* Set the default text -after- connecting the signal handler. * This will initialize the "OK" button to the proper state. */ gtk_entry_set_text (entry, charset); if (gtk_dialog_run (dialog) != GTK_RESPONSE_OK) { gint active; /* Revert to the previously selected character set. */ combo_box->priv->block_dialog = TRUE; active = combo_box->priv->previous_index; gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), active); combo_box->priv->block_dialog = FALSE; goto exit; } charset = gtk_entry_get_text (entry); g_return_if_fail (charset != NULL && charset != '\0'); g_object_set_data_full ( object, "charset", g_strdup (charset), (GDestroyNotify) g_free); exit: gtk_widget_destroy (GTK_WIDGET (dialog)); }
GtkWidget* create_threshold_dialog (void) { GtkWidget *threshold_dialog; GtkWidget *dialogVbox; GtkWidget *allButButtonsVbox; GtkWidget *settingsOuterHbox; GtkWidget *settingsOuterVbox; GtkWidget *minValueVbox; GtkWidget *minValueLabel; GtkWidget *minValueHbox; GtkWidget *minValueSlider; GtkObject *minValueSpinner_adj; GtkWidget *minValueSpinner; GtkWidget *maxValueVbox; GtkWidget *maxValueLabel; GtkWidget *maxValueHbox; GtkWidget *maxValueSlider; GtkObject *maxValueSpinner_adj; GtkWidget *maxValueSpinner; GtkWidget *outputValuesHbox; GtkWidget *outputValuesLabel; GtkWidget *outputValuesMenu; GtkWidget *debugHbox; GtkWidget *debugLabel; GtkObject *debugSpinButton_adj; GtkWidget *debugSpinButton; GtkWidget *previewFrame; GtkWidget *previewAlignment; GtkWidget *previewVbox; GtkWidget *previewControlHbox; GtkWidget *previewOutputMenu; GtkWidget *previewSlider; GtkWidget *previewVideo; GtkWidget *previewLabel; GtkWidget *dialogButtonBox; GtkWidget *cancelButton; GtkWidget *okButton; threshold_dialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (threshold_dialog), QT_TR_NOOP("Threshold")); gtk_window_set_type_hint (GTK_WINDOW (threshold_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); dialogVbox = GTK_DIALOG (threshold_dialog)->vbox; gtk_widget_show (dialogVbox); allButButtonsVbox = gtk_vbox_new (FALSE, 12); gtk_widget_show (allButButtonsVbox); gtk_box_pack_start (GTK_BOX (dialogVbox), allButButtonsVbox, TRUE, TRUE, 0); settingsOuterHbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (settingsOuterHbox); gtk_box_pack_start (GTK_BOX (allButButtonsVbox), settingsOuterHbox, FALSE, TRUE, 0); settingsOuterVbox = gtk_vbox_new (FALSE, 12); gtk_widget_show (settingsOuterVbox); gtk_box_pack_start (GTK_BOX (settingsOuterHbox), settingsOuterVbox, TRUE, TRUE, 0); minValueVbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (minValueVbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), minValueVbox, FALSE, FALSE, 0); minValueLabel = gtk_label_new (QT_TR_NOOP("Minimum value to be in-range:")); gtk_widget_show (minValueLabel); gtk_box_pack_start (GTK_BOX (minValueVbox), minValueLabel, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (minValueLabel), 0.5, 1); gtk_misc_set_padding (GTK_MISC (minValueLabel), 0, 8); minValueHbox = gtk_hbox_new (FALSE, 5); gtk_widget_show (minValueHbox); gtk_box_pack_start (GTK_BOX (minValueVbox), minValueHbox, TRUE, TRUE, 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 255, 1, 1, 0))); #else minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 1, 0); minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (minValueSpinner_adj)); #endif gtk_widget_show (minValueSlider); gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSlider, TRUE, TRUE, 0); gtk_scale_set_draw_value (GTK_SCALE (minValueSlider), FALSE); gtk_scale_set_value_pos (GTK_SCALE (minValueSlider), GTK_POS_LEFT); gtk_scale_set_digits (GTK_SCALE (minValueSlider), 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 10, 10); #endif minValueSpinner = gtk_spin_button_new (GTK_ADJUSTMENT (minValueSpinner_adj), 1, 0); gtk_widget_show (minValueSpinner); gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSpinner, FALSE, TRUE, 0); maxValueVbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (maxValueVbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), maxValueVbox, FALSE, FALSE, 0); maxValueLabel = gtk_label_new (QT_TR_NOOP("Maximum value to be in-range:")); gtk_widget_show (maxValueLabel); gtk_box_pack_start (GTK_BOX (maxValueVbox), maxValueLabel, FALSE, FALSE, 0); maxValueHbox = gtk_hbox_new (FALSE, 5); gtk_widget_show (maxValueHbox); gtk_box_pack_start (GTK_BOX (maxValueVbox), maxValueHbox, TRUE, TRUE, 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE maxValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (255, 0, 255, 1, 1, 0))); #else maxValueSpinner_adj = gtk_adjustment_new (255, 0, 255, 1, 1, 0); maxValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (maxValueSpinner_adj)); #endif gtk_widget_show (maxValueSlider); gtk_box_pack_start (GTK_BOX (maxValueHbox), maxValueSlider, TRUE, TRUE, 0); gtk_scale_set_draw_value (GTK_SCALE (maxValueSlider), FALSE); gtk_scale_set_value_pos (GTK_SCALE (maxValueSlider), GTK_POS_LEFT); gtk_scale_set_digits (GTK_SCALE (maxValueSlider), 0); #ifdef ORIGINAL_CODE_GENERATED_BY_GLADE maxValueSpinner_adj = gtk_adjustment_new (255, 0, 255, 1, 10, 10); #endif maxValueSpinner = gtk_spin_button_new (GTK_ADJUSTMENT (maxValueSpinner_adj), 1, 0); gtk_widget_show (maxValueSpinner); gtk_box_pack_start (GTK_BOX (maxValueHbox), maxValueSpinner, FALSE, TRUE, 0); outputValuesHbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (outputValuesHbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), outputValuesHbox, TRUE, TRUE, 0); outputValuesLabel = gtk_label_new (QT_TR_NOOP("Output values: ")); gtk_widget_show (outputValuesLabel); gtk_box_pack_start (GTK_BOX (outputValuesHbox), outputValuesLabel, FALSE, FALSE, 0); outputValuesMenu = gtk_combo_box_new_text (); gtk_widget_show (outputValuesMenu); gtk_box_pack_start (GTK_BOX (outputValuesHbox), outputValuesMenu, TRUE, TRUE, 0); gtk_combo_box_append_text (GTK_COMBO_BOX (outputValuesMenu), QT_TR_NOOP("In-range values go black, out-of-range values go white")); gtk_combo_box_append_text (GTK_COMBO_BOX (outputValuesMenu), QT_TR_NOOP("In-range values go white, out-of-range values go black")); debugHbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (debugHbox); gtk_box_pack_start (GTK_BOX (settingsOuterVbox), debugHbox, TRUE, TRUE, 0); debugLabel = gtk_label_new (QT_TR_NOOP("Debugging settings (bits): ")); gtk_widget_show (debugLabel); gtk_box_pack_start (GTK_BOX (debugHbox), debugLabel, FALSE, FALSE, 0); debugSpinButton_adj = gtk_adjustment_new (0, 0, 16777215, 1, 10, 10); debugSpinButton = gtk_spin_button_new (GTK_ADJUSTMENT (debugSpinButton_adj), 1, 0); gtk_widget_show (debugSpinButton); gtk_box_pack_start (GTK_BOX (debugHbox), debugSpinButton, TRUE, TRUE, 0); previewFrame = gtk_frame_new (NULL); gtk_widget_show (previewFrame); gtk_box_pack_start (GTK_BOX (allButButtonsVbox), previewFrame, TRUE, TRUE, 0); previewAlignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (previewAlignment); gtk_container_add (GTK_CONTAINER (previewFrame), previewAlignment); gtk_alignment_set_padding (GTK_ALIGNMENT (previewAlignment), 0, 8, 6, 8); previewVbox = gtk_vbox_new (FALSE, 5); gtk_widget_show (previewVbox); gtk_container_add (GTK_CONTAINER (previewAlignment), previewVbox); previewControlHbox = gtk_hbox_new (FALSE, 5); gtk_widget_show (previewControlHbox); gtk_box_pack_start (GTK_BOX (previewVbox), previewControlHbox, TRUE, TRUE, 0); previewOutputMenu = gtk_combo_box_new_text (); gtk_widget_show (previewOutputMenu); gtk_box_pack_start (GTK_BOX (previewControlHbox), previewOutputMenu, FALSE, TRUE, 0); previewSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 99, 1, 1, 1))); gtk_widget_show (previewSlider); gtk_box_pack_start (GTK_BOX (previewControlHbox), previewSlider, TRUE, TRUE, 0); gtk_scale_set_digits (GTK_SCALE (previewSlider), 0); previewVideo = gtk_drawing_area_new (); gtk_widget_show (previewVideo); gtk_box_pack_start (GTK_BOX (previewVbox), previewVideo, TRUE, TRUE, 0); gtk_widget_set_size_request (previewVideo, 30, 30); gtk_widget_set_events (previewVideo, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK); previewLabel = gtk_label_new (QT_TR_NOOP("Preview")); gtk_widget_show (previewLabel); gtk_frame_set_label_widget (GTK_FRAME (previewFrame), previewLabel); dialogButtonBox = GTK_DIALOG (threshold_dialog)->action_area; gtk_widget_show (dialogButtonBox); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialogButtonBox), GTK_BUTTONBOX_END); cancelButton = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelButton); gtk_dialog_add_action_widget (GTK_DIALOG (threshold_dialog), cancelButton, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelButton, GTK_CAN_DEFAULT); okButton = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okButton); gtk_dialog_add_action_widget (GTK_DIALOG (threshold_dialog), okButton, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okButton, GTK_CAN_DEFAULT); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, threshold_dialog, "threshold_dialog"); GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, dialogVbox, "dialogVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, allButButtonsVbox, "allButButtonsVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, settingsOuterHbox, "settingsOuterHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, settingsOuterVbox, "settingsOuterVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueVbox, "minValueVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueLabel, "minValueLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueHbox, "minValueHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueSlider, "minValueSlider"); GLADE_HOOKUP_OBJECT (threshold_dialog, minValueSpinner, "minValueSpinner"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueVbox, "maxValueVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueLabel, "maxValueLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueHbox, "maxValueHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueSlider, "maxValueSlider"); GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueSpinner, "maxValueSpinner"); GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesHbox, "outputValuesHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesLabel, "outputValuesLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesMenu, "outputValuesMenu"); GLADE_HOOKUP_OBJECT (threshold_dialog, debugHbox, "debugHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, debugLabel, "debugLabel"); GLADE_HOOKUP_OBJECT (threshold_dialog, debugSpinButton, "debugSpinButton"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewFrame, "previewFrame"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewAlignment, "previewAlignment"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewVbox, "previewVbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewControlHbox, "previewControlHbox"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewOutputMenu, "previewOutputMenu"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewSlider, "previewSlider"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewVideo, "previewVideo"); GLADE_HOOKUP_OBJECT (threshold_dialog, previewLabel, "previewLabel"); GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, dialogButtonBox, "dialogButtonBox"); GLADE_HOOKUP_OBJECT (threshold_dialog, cancelButton, "cancelButton"); GLADE_HOOKUP_OBJECT (threshold_dialog, okButton, "okButton"); return threshold_dialog; }
void CUIHandler::ShowSettingsDlg(void) { GtkWidget* settingsDlg; GtkWidget* dialog_vbox1; GtkWidget* frame4; GtkWidget* alignment4; GtkWidget* vbox2; GtkWidget* radiobuttonBt; GtkWidget* hbox2; GtkWidget* radiobuttonInet; GtkWidget* label5; GtkWidget* inetPort; GtkWidget* label4; GtkWidget* dialog_action_area1; CUserSettings crtSettings = pSmartEngine->GetSettings(); settingsDlg = gtk_dialog_new_with_buttons("SmartCam Preferences", GTK_WINDOW(pSmartEngine->GetMainWindow()), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gtk_window_set_type_hint(GTK_WINDOW (settingsDlg), GDK_WINDOW_TYPE_HINT_DIALOG); dialog_vbox1 = GTK_DIALOG (settingsDlg)->vbox; gtk_widget_show (dialog_vbox1); frame4 = gtk_frame_new (NULL); gtk_widget_show (frame4); gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame4, TRUE, TRUE, 0); gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_IN); alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment4); gtk_container_add (GTK_CONTAINER (frame4), alignment4); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment4), 10, 10, 12, 12); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_container_add (GTK_CONTAINER (alignment4), vbox2); radiobuttonBt = gtk_radio_button_new_with_mnemonic(NULL, "Bluetooth"); gtk_box_pack_start(GTK_BOX (vbox2), radiobuttonBt, FALSE, FALSE, 0); hbox2 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox2); gtk_box_pack_start(GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0); radiobuttonInet = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radiobuttonBt), "TCP/IP (WiFi)"); gtk_box_pack_start(GTK_BOX (hbox2), radiobuttonInet, FALSE, FALSE, 0); label5 = gtk_label_new(" Port: "); gtk_box_pack_start(GTK_BOX(hbox2), label5, FALSE, FALSE, 0); inetPort = gtk_spin_button_new_with_range(1025, 65536, 1); gtk_box_pack_start(GTK_BOX(hbox2), inetPort, TRUE, TRUE, 0); label4 = gtk_label_new("Connection"); gtk_frame_set_label_widget(GTK_FRAME(frame4), label4); gtk_label_set_use_markup(GTK_LABEL(label4), TRUE); dialog_action_area1 = GTK_DIALOG(settingsDlg)->action_area; gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); g_signal_connect(G_OBJECT(radiobuttonBt), "toggled", G_CALLBACK(OnRadiobuttonBluetooth), inetPort); if(crtSettings.connectionType == CONN_BLUETOOTH) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonBt), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonInet), FALSE); g_object_set(G_OBJECT(inetPort), "sensitive", FALSE, NULL); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonBt), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobuttonInet), TRUE); g_object_set(G_OBJECT(inetPort), "sensitive", TRUE, NULL); } gtk_spin_button_set_value(GTK_SPIN_BUTTON(inetPort), crtSettings.inetPort); gtk_widget_show_all(settingsDlg); if(gtk_dialog_run(GTK_DIALOG(settingsDlg)) == GTK_RESPONSE_OK) { CUserSettings newSettings = crtSettings; if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobuttonBt))) { newSettings.connectionType = CONN_BLUETOOTH; } else { newSettings.connectionType = CONN_INET; newSettings.inetPort = gtk_spin_button_get_value(GTK_SPIN_BUTTON(inetPort)); } pSmartEngine->SaveSettings(newSettings); } gtk_widget_destroy(settingsDlg); }