static void set_action_critical(GtkOptionMenu *om, t_battmon_dialog *dialog) { t_battmon *battmon = dialog->battmon; battmon->options.action_on_critical = gtk_option_menu_get_history(om); gtk_widget_set_sensitive(dialog->en_command_critical, (gtk_option_menu_get_history(om) > 1) ? 1 : 0); /* gtk_widget_set_sensitive(dialog->revert, TRUE); */ }
static void date_optionmenu_changed_cb (GtkOptionMenu *option_menu, DialogData *data) { char *first_image = data->file_list->data; int idx = gtk_option_menu_get_history (option_menu); gtk_widget_set_sensitive (data->date_dateedit, idx == FOLLOWING_DATE); switch (idx) { case NO_DATE: case FOLLOWING_DATE: case NO_CHANGE: break; case CURRENT_DATE: gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), time (NULL)); break; case IMAGE_CREATION_DATE: gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), get_file_ctime (first_image)); break; case LAST_MODIFIED_DATE: gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), get_file_mtime (first_image)); break; case EXIF_DATE: gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), get_metadata_time (NULL, first_image)); break; } }
static void dithering_depth_menu_changed(GtkOptionMenu *dithering_depth_menu, gpointer user_data) { CtkDitheringControls *ctk_dithering_controls = CTK_DITHERING_CONTROLS(user_data); gint history, dithering_depth = NV_CTRL_DITHERING_DEPTH_AUTO; history = gtk_option_menu_get_history(dithering_depth_menu); dithering_depth = map_dithering_depth_menu_idx_to_nvctrl(history); NvCtrlSetAttribute(ctk_dithering_controls->handle, NV_CTRL_DITHERING_DEPTH, dithering_depth); g_signal_handlers_block_by_func (G_OBJECT(ctk_dithering_controls->dithering_depth_menu), G_CALLBACK(dithering_depth_menu_changed), (gpointer) ctk_dithering_controls); gtk_option_menu_set_history (GTK_OPTION_MENU(ctk_dithering_controls->dithering_depth_menu), dithering_depth); g_signal_handlers_unblock_by_func (G_OBJECT(ctk_dithering_controls->dithering_depth_menu), G_CALLBACK(dithering_depth_menu_changed), (gpointer) ctk_dithering_controls); /* reflecting the change in configuration to other widgets & reset button */ ctk_dithering_controls_setup(ctk_dithering_controls); post_dithering_depth_update(ctk_dithering_controls, dithering_depth); } /* dithering_depth_menu_changed() */
void gcb_set_playmode(GtkWidget *w, struct gchan *o) { gint mode; if((mode = gtk_option_menu_get_history(GTK_OPTION_MENU(w))) != -1) mixer->set_playmode(o->idx-1, mode); }
static void cb_select_charset(GtkOptionMenu *option_menu, FileInfo *selected_fi) { CharsetTable *ctable; static guint index_history = 0, prev_history; prev_history = index_history; index_history = gtk_option_menu_get_history(option_menu); if (!charset_menu_init_flag) { ctable = get_charset_table(); if (index_history < ctable->num + mode) { if (selected_fi->charset) g_free(selected_fi->charset); if (index_history == 0 && mode == OPEN) selected_fi->charset = NULL; else { selected_fi->charset = g_strdup(ctable->charset[index_history - mode]); } } else if (!get_manual_charset(option_menu, selected_fi)) { index_history = prev_history; gtk_option_menu_set_history(option_menu, index_history); } } }
/*# @method get_history GtkOptionMenu @brief Retrieves the index of the currently selected menu item. @return index of the selected menu item, or -1 if there are no menu items The menu items are numbered from top to bottom, starting with 0. */ FALCON_FUNC OptionMenu::get_history( VMARG ) { NO_ARGS MYSELF; GET_OBJ( self ); vm->retval( gtk_option_menu_get_history( (GtkOptionMenu*)_obj ) ); }
static void on_TextSourceDialog_response (GtkDialog *dialog, gint response_id, gpointer user_data) { if (GTK_RESPONSE_OK == response_id) { GtkWidget *temp; temp = lookup_widget(GTK_WIDGET(dialog), "TextSourceMenu"); uint index = gtk_option_menu_get_history(GTK_OPTION_MENU(temp)); const char *type = NULL; switch (index) { case 0: type = TEXT_SOURCE_DIALOG; break; case 1: type = TEXT_SOURCE_TIMED_FILE; break; case 2: type = TEXT_SOURCE_FILE_WITH_DIALOG; break; } if (type != NULL) { MyConfig->SetStringValue(CONFIG_TEXT_SOURCE_TYPE, type); if (index != 0) { temp = lookup_widget(GTK_WIDGET(dialog), "TextFileEntry"); MyConfig->SetStringValue(CONFIG_TEXT_SOURCE_FILE_NAME, gtk_entry_get_text(GTK_ENTRY(temp))); } MainWindowDisplaySources(); } } gtk_widget_destroy(GTK_WIDGET(dialog)); }
static void on_romaji_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data) { bool success; if (__widget_romaji_theme_menu != GTK_WIDGET (omenu)) { g_signal_handlers_block_by_func ( G_OBJECT (__widget_romaji_theme_menu), (gpointer) (on_romaji_theme_menu_changed), NULL); gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_romaji_theme_menu), gtk_option_menu_get_history (omenu)); g_signal_handlers_unblock_by_func ( G_OBJECT (__widget_romaji_theme_menu), (gpointer) (on_romaji_theme_menu_changed), NULL); success = load_romaji_theme (); setup_romaji_window_value (SCIM_ANTHY_TABLE_EDITOR (user_data)); } else { success = load_romaji_theme (); } if (success) { // sync widgets __style_changed = true; __config_changed = true; } }
static void on_TextSourceMenu_changed (GtkOptionMenu *optionmenu, gpointer user_data) { GtkWidget *dialog = GTK_WIDGET(user_data); EnableFromTextMenu(dialog, gtk_option_menu_get_history(optionmenu)); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_option_menu_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { if (data->action == GB_SAVING) gb_widget_output_int (data, History, gtk_option_menu_get_history (GTK_OPTION_MENU (widget))); }
static void dlg_response(GtkDialog * dlg_w, gint response, struct netselect_dlg * dlg) { switch(response) { case GTK_RESPONSE_OK: /* set network & port */ prefs_set(PREFS_NET_TYPE, gtk_option_menu_get_history( GTK_OPTION_MENU(dlg->net_type_option))); prefs_set(PREFS_NET_PORT, gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(dlg->net_port_spin))); prefs_set(PREFS_NET_USE_MULTICAST, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dlg->net_use_multicast_w))); prefs_set(PREFS_NET_MULTICAST_ADDR, dlg->detect_multicast_addr); prefs_set(PREFS_NET_BROADCAST_MASK, dlg->detect_broadcast_mask); prefs_set(PREFS_NET_IS_CONFIGURED, TRUE); /* hide the dialog */ netselect_dlg_destroy(&main_netselect_dlg); break; case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_DELETE_EVENT: if(!prefs_bool(PREFS_NET_IS_CONFIGURED)) { /* one cannot get away without network configured :) */ raise_event(EVENT_IFACE_EXIT, NULL, 0); } else { /* network is already configured, destroy the dialog and do nothing */ netselect_dlg_destroy(&main_netselect_dlg); } break; } }
static time_t get_requested_time (DialogData *data, const char *filename) { int idx = gtk_option_menu_get_history (GTK_OPTION_MENU (data->date_optionmenu)); time_t t = (time_t)0; switch (idx) { case NO_DATE: break; case FOLLOWING_DATE: t = gnome_date_edit_get_time (GNOME_DATE_EDIT (data->date_dateedit)); break; case CURRENT_DATE: t = time (NULL); break; case EXIF_DATE: t = get_metadata_time (NULL, filename); break; case LAST_MODIFIED_DATE: t = get_file_mtime (filename); break; case IMAGE_CREATION_DATE: t = get_file_ctime (filename); break; } return t; }
static bool load_romaji_theme (void) { GtkOptionMenu *omenu = GTK_OPTION_MENU (__widget_romaji_theme_menu); gint idx = gtk_option_menu_get_history (omenu); GtkWidget *menu = gtk_option_menu_get_menu (omenu); GList *list = gtk_container_get_children (GTK_CONTAINER (menu)); GtkWidget *menuitem = GTK_WIDGET (g_list_nth_data (list, idx)); if (!menuitem) return false; gint theme_idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), INDEX_KEY)); // set new romaji table if (idx == ROMAJI_THEME_INDEX_USER_DEFINED) { // User defined table __config_romaji_theme_file = __user_style_file.get_file_name (); StyleLines lines; bool success = __user_style_file.get_entry_list (lines, __romaji_fund_table); if (!success || lines.empty ()) setup_default_romaji_table (); return true; } else if (idx == ROMAJI_THEME_INDEX_DEFAULT) { // Default table __config_romaji_theme_file = ""; setup_default_romaji_table (); return true; } else if (theme_idx >= 0 && theme_idx < (int) __style_list.size ()) { // Tables defined in system theme files __config_romaji_theme_file = __style_list[theme_idx].get_file_name (); __user_style_file.delete_section (__romaji_fund_table); std::vector<String> keys; bool success = __style_list[theme_idx].get_key_list (keys, __romaji_fund_table); if (success) { std::vector<String>::iterator it; for (it = keys.begin (); it != keys.end (); it++) { std::vector<WideString> value; __style_list[theme_idx].get_string_array (value, __romaji_fund_table, *it); __user_style_file.set_string_array (__romaji_fund_table, *it, value); } } return true; } else { // error return false; } }
static void change_toolbar_style (GtkWidget *option_menu, GtkWidget *toolbar) { GtkToolbarStyle style; style = gtk_option_menu_get_history (GTK_OPTION_MENU (option_menu)); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), style); }
static void util_option_fwd_cb(GtkOptionMenu * opt_menu, gpointer callback) { ((util_option_changed_cb)callback)( gtk_option_menu_get_history(GTK_OPTION_MENU(opt_menu)), g_object_get_data(G_OBJECT(opt_menu), "changed_userdata") ); }
void KeyOptionView::onValueChange() { if (!myCurrentKey.empty()) { ((ZLKeyOptionEntry*)myOption)->onValueChange( myCurrentKey, gtk_option_menu_get_history(GTK_OPTION_MENU(myComboBox)) ); } }
static void host_changed_cb(GtkOptionMenu *menu, login_dlg *ldlg) { GSList *l; l = g_slist_nth(conf.hosts, gtk_option_menu_get_history(menu)); if (!l || !l->data) return; ldlg->curhost = l->data; populate_user_list(ldlg); }
/* * setup_reset_button() - enables the reset button if any of the current * settings are not the default. */ static void setup_reset_button(CtkDitheringControls *ctk_dithering_controls) { gint history; gint val; if (!GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_controls_box)) { /* Nothing is available, don't bother enabling the reset button yet. */ return; } /* The config menu is always available */ history = gtk_option_menu_get_history (GTK_OPTION_MENU(ctk_dithering_controls->dithering_config_menu)); val = map_dithering_config_menu_idx_to_nvctrl(history); if (val != NV_CTRL_DITHERING_AUTO) { goto enable; } if (GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_mode_box)) { history = gtk_option_menu_get_history (GTK_OPTION_MENU(ctk_dithering_controls->dithering_mode_menu)); val = ctk_dithering_controls->dithering_mode_table[history]; if (val != NV_CTRL_DITHERING_MODE_AUTO) { goto enable; } } if (GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_depth_box)) { history = gtk_option_menu_get_history (GTK_OPTION_MENU(ctk_dithering_controls->dithering_depth_menu)); val = map_dithering_depth_menu_idx_to_nvctrl(history); if (val != NV_CTRL_DITHERING_DEPTH_AUTO) { goto enable; } } /* Don't disable reset button here, since other settings that are not * managed by the ctk_image_slider here may need it enabled */ return; enable: gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE); }
static void icon_size_history_changed (GtkOptionMenu *menu, GtkToolbar *toolbar) { int icon_size; icon_size = gtk_option_menu_get_history (menu); icon_size += GTK_ICON_SIZE_SMALL_TOOLBAR; gtk_toolbar_set_icon_size (toolbar, icon_size); }
static void picture_store(JamView *view) { int sel = gtk_option_menu_get_history(GTK_OPTION_MENU(view->pic)); LJUser *user = jam_account_lj_get_user(JAM_ACCOUNT_LJ(view->account)); const char *pickw = NULL; if (sel > 0) pickw = g_slist_nth(user->pickws, sel-1)->data; jam_doc_set_picture(view->doc, pickw); }
static void corner_action_changed_cb (GtkOptionMenu *menu, gpointer corner) { if (gtk_option_menu_get_history (menu) == CUSTOM_ACTION) show_custom_action_dialog ( GTK_WINDOW (gtk_widget_get_ancestor ( GTK_WIDGET (menu), GTK_TYPE_DIALOG)), GPOINTER_TO_INT (corner), conf_client, NULL); }
GLADE_CB void comm_cable_changed (GtkOptionMenu *optionmenu, gpointer user_data) { gint nitem = gtk_option_menu_get_history(optionmenu); switch(nitem) { case 0: tmp_lp.link_type = LINK_TGL; break; case 1: tmp_lp.link_type = LINK_SER; break; case 2: tmp_lp.link_type = LINK_SLV; break; case 3: tmp_lp.link_type = LINK_PAR; break; case 4: tmp_lp.link_type = LINK_VTI; break; case 5: tmp_lp.link_type = LINK_TIE; break; case 6: tmp_lp.link_type = LINK_VTL; break; case 7: tmp_lp.link_type = LINK_NUL; break; } // force port to avoid libticables bad argument if(!init) { switch(tmp_lp.link_type) { case LINK_TGL: case LINK_SER: case LINK_AVR: case LINK_VTI: case LINK_TIE: case LINK_VTL: gtk_option_menu_set_history(GTK_OPTION_MENU(port), 5); gtk_option_menu_set_history(GTK_OPTION_MENU(port), 2); break; case LINK_PAR: case LINK_SLV: gtk_option_menu_set_history(GTK_OPTION_MENU(port), 5); gtk_option_menu_set_history(GTK_OPTION_MENU(port), 1); break; case LINK_NUL: gtk_option_menu_set_history(GTK_OPTION_MENU(port), 5); break; default: break; } } // change value /* if(tmo != NULL) { if(tmp_lp.link_type != LINK_NUL) gtk_spin_button_set_value(GTK_SPIN_BUTTON(tmo), link_cable.timeout); else gtk_spin_button_set_value(GTK_SPIN_BUTTON(tmo), params.timeout); } */ }
static void command_changed_cb(GtkOptionMenu *omenu, SettingsWidget *sw) { CommandList *cmds = sw->data; int cur = gtk_option_menu_get_history(GTK_OPTION_MENU(sw->widget)); jam_widget_set_visible(sw->data2, cmds[cur].label == NULL); if (cmds[cur].label != NULL) { const char *cmd = cmds[cur].command; string_replace((char**)sw->conf, cmd ? g_strdup(cmd) : NULL); gtk_entry_set_text(GTK_ENTRY(sw->subwidget), cmd ? cmd : ""); } }
gint ctk_drop_down_menu_get_current_value(CtkDropDownMenu *d) { gint i; i = gtk_option_menu_get_history(GTK_OPTION_MENU(d->option_menu)); if (i < d->num_entries) { return d->values[i].value; } else { return 0; /* XXX??? */ } } /* ctk_drop_down_menu_get_current_value() */
static void model_selected (GtkOptionMenu *om, gpointer data) { GtkTreeView *tree_view = GTK_TREE_VIEW (data); gint hist; hist = gtk_option_menu_get_history (om); if (models[hist] != gtk_tree_view_get_model (tree_view)) { gtk_tree_view_set_model (tree_view, models[hist]); } }
static void columns_selected (GtkOptionMenu *om, gpointer data) { GtkTreeView *tree_view = GTK_TREE_VIEW (data); gint hist; hist = gtk_option_menu_get_history (om); if (hist != get_columns_type ()) { set_columns_type (tree_view, hist); } }
static void cb_select_lineend(GtkOptionMenu *option_menu, FileInfo *selected_fi) { switch (gtk_option_menu_get_history(option_menu)) { case 1: selected_fi->lineend = CR+LF; break; case 2: selected_fi->lineend = CR; break; default: selected_fi->lineend = LF; } }
PollQuestion* pollmultidlg_run(GtkWindow *parent, PollQuestionMulti *qm) { PollQuestion *q = NULL; GtkTextBuffer *buffer; STACK(PollMultiDlg, pmdlg); pollmultidlg_init(pmdlg, parent); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(pmdlg->question)); if (qm) { GSList *l; GtkTreeIter iter; q = (PollQuestion*)qm; gtk_option_menu_set_history(GTK_OPTION_MENU(pmdlg->typemenu), q->type); gtk_text_buffer_insert_at_cursor(buffer, q->question, -1); for (l = qm->answers; l; l = l->next) { gtk_list_store_append(pmdlg->answers.store, &iter); gtk_list_store_set(pmdlg->answers.store, &iter, 0, l->data, -1); } } if (gtk_dialog_run(GTK_DIALOG(pmdlg->dlg)) == GTK_RESPONSE_OK) { GtkTextIter start, end; GtkTreeModel *model = GTK_TREE_MODEL(pmdlg->answers.store); GtkTreeIter iter; if (qm == NULL) qm = g_new0(PollQuestionMulti, 1); q = (PollQuestion*)qm; q->type = gtk_option_menu_get_history(GTK_OPTION_MENU(pmdlg->typemenu)); gtk_text_buffer_get_bounds(buffer, &start, &end); g_free(q->question); q->question = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); g_slist_foreach(qm->answers, (GFunc)g_free, NULL); g_slist_free(qm->answers); qm->answers = NULL; if (gtk_tree_model_get_iter_first(model, &iter)) { /* this is probably O(n^2) or something like that. * but there hopefully won't be that many answers. */ do { char *text; gtk_tree_model_get(model, &iter, 0, &text, -1); qm->answers = g_slist_append(qm->answers, text); } while (gtk_tree_model_iter_next(model, &iter)); } } gtk_widget_destroy(GTK_WIDGET(pmdlg->dlg)); return q; }
static void location_changed_cb(GtkWidget *optmenu, EContactEditorIm *editor) { int i = gtk_option_menu_get_history(GTK_OPTION_MENU(optmenu)); if (editor->location != NULL) g_free(editor->location); if (i == 0) editor->location = g_strdup("HOME"); else if (i == 1) editor->location = g_strdup("WORK"); else editor->location = NULL; }
/* * Writes the source code needed to create this widget. * You have to output everything necessary to create the widget here, though * there are some convenience functions to help. */ static void gb_option_menu_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data) { gint history; if (data->create_widget) { source_add (data, " %s = gtk_option_menu_new ();\n", data->wname); } gb_widget_write_standard_source (widget, data); history = gtk_option_menu_get_history (GTK_OPTION_MENU (widget)); if (history > 0) source_add (data, " gtk_option_menu_set_history (GTK_OPTION_MENU (%s), %i);\n", data->wname, history); }