/* Get the type of view (3D, 3D flat or 2D) */ void change_perspective(GtkWidget *widget, gpointer data) { GSList *list; const gchar *label; list = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM(data)); while(list) { if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { label = gtk_menu_item_get_label(GTK_MENU_ITEM(widget)); list = NULL; if (strcmp(label, "2D (D)") == 0) { viewType = TWO_D; } else { if (strcmp(label, "3D (D)") == 0){ viewType = THREE_D; } else { viewType = THREE_D_FLAT; } } newEvent = TRUE; } else { list = g_slist_next(list); } } }
static void menu_on_dial_contact(GtkMenuItem *menuItem, gpointer arg) { struct gtk_mod *mod = arg; const char *uri = gtk_menu_item_get_label(menuItem); /* Queue dial from the main thread */ mqueue_push(mod->mq, MQ_CONNECT, (char *)uri); }
/* * メニューの中のどれかが選択されたときに呼ばれるコールバック関数。 * label にセットされているテキストを変更する。 */ static void menu_activated(GtkMenuItem *menuitem, GtkWidget *label) { const gchar *name = gtk_menu_item_get_label(menuitem); char message[100]; snprintf(message, 100, "%sの注文を承りました。", name); gtk_label_set_text(GTK_LABEL(label), message); }
G_MODULE_EXPORT gboolean on_compatibility_change(GtkWidget *widget, gtk_widgets_t *data) { _version = parse_version(gtk_menu_item_get_label((GtkMenuItem *)widget)); const char *v = get_version_string(_version); update_config(CONF_VERSION, v); return (void)data, TRUE; }
static void pocketvox_indicator_module_toggled(PocketvoxIndicator *indicator, gpointer data) { GtkCheckMenuItem *widget = (GtkCheckMenuItem *)data; g_return_if_fail(NULL != indicator); g_return_if_fail(NULL != widget); g_signal_emit(indicator, pocketvox_indicator_signals[INDICATOR_MODULE_TOGGLED], 0, gtk_menu_item_get_label((GtkMenuItem *)widget)); }
void itemclick(GtkMenuItem *mi, Client *c) { int i; const char *label; label = gtk_menu_item_get_label(mi); for(i = 0; i < LENGTH(items); i++) if(!strcmp(items[i].label, label)) items[i].func(c, &(items[i].arg)); }
static void plugin_exec (GtkWidget *widget, gpointer user_data) { Plugin *plugin; Documentable *doc = document_manager_get_current_documentable(main_window.docmg); if (!doc) return; GtkPluginManagerMenu *menu= GTK_PLUGIN_MANAGER_MENU (user_data); plugin = get_plugin_by_name(menu->priv->plugmg, (gchar *) gtk_menu_item_get_label (GTK_MENU_ITEM(widget))); plugin_run(plugin, doc); }
extern "C" G_MODULE_EXPORT void menuItemCallback(GtkWidget *button, gpointer data) { if(gOptionsDlg) { char const * const label = gtk_menu_item_get_label(GTK_MENU_ITEM(button)); char const * p = strchr(label, ' '); if(p) p++; gOptionsDlg->buildConfig(reinterpret_cast<char const * const>(p)); } }
G_MODULE_EXPORT void on_plot_item_activate( GtkObject *object, gpointer user_data) { const gchar *label= gtk_menu_item_get_label(GTK_MENU_ITEM(object)); char *plot1_commands[]= { "plotall", "plotover", "plotsr" }; char *plot2_commands[]= { "plotauto", "plotlog", "plotsame", "plotscale", "pa" }; int found= FALSE; char temporary[512]; int ii; strcpy(temporary, label); strtolower(temporary); // expects to have ellipsis at the end.. if(strlen(temporary)>3) { temporary[strlen(temporary)-3]= '\0'; } for(ii= 0; ii<ARRAY_SIZE(plot1_commands); ii++) { if(strcmp(plot1_commands[ii], temporary)==0) { strcpy(plot_cmd, temporary); set_left_footer("Type the x-axis and y-axis"); set_cmd_prompt("X-AXIS Y-AXIS: "); ui_globals.action = PLOT_GET_XY; found= TRUE; } } if(!found) { for(ii= 0; ii<ARRAY_SIZE(plot2_commands); ii++) { if(strcmp(plot2_commands[ii], temporary)==0) { strcpy(plot_cmd, temporary); set_left_footer("Type the x-axis and y-axis"); set_cmd_prompt("X-AXIS Y-AXIS: "); ui_globals.action = PLOT_GET_BE; found= TRUE; } } } if(!found) { fprintf(stderr, "Didn't find plot command: %s\n", temporary); } }
static void activate_password_item (GtkMenuItem *item, UmPasswordDialog *um) { const char *password; password = gtk_menu_item_get_label (item); gtk_entry_set_text (GTK_ENTRY (um->password_entry), password); gtk_entry_set_text (GTK_ENTRY (um->verify_entry), ""); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (um->show_password_button), TRUE); gtk_widget_grab_focus (um->verify_entry); }
static void menuitem_response_cb (GtkMenuItem *item, gpointer *user_data ) { const gchar *label_text; GtkTreeIter iter, iter_now = {0, NULL, NULL, NULL}; gboolean valid; gint active = 1; gint active_now = 1; GncCombott *combott = GNC_COMBOTT (user_data); GncCombottPrivate *priv = GNC_COMBOTT_GET_PRIVATE (combott); label_text = gtk_menu_item_get_label (item); /* Set the button Label */ gtk_label_set_text(GTK_LABEL(priv->label), label_text); gtk_misc_set_alignment (GTK_MISC(priv->label), 0, 0.5); /* Get the corresponding entry in the list store */ valid = gtk_tree_model_get_iter_first (priv->model, &iter); while (valid) { /* Walk through the list, reading each row */ gchar *str_data; gchar *tip_data; gtk_tree_model_get (priv->model, &iter, priv->text_col, &str_data, priv->tip_col, &tip_data, -1); if(!g_strcmp0(str_data, label_text)) { active_now = active; iter_now = iter; } g_free (str_data); g_free (tip_data); active ++; valid = gtk_tree_model_iter_next (priv->model, &iter); } /* Emit Changed signal if we have selected a new entry */ if(priv->active != active_now) { priv->active = active_now; priv->active_iter = iter_now; g_signal_emit (combott, combott_signals[CHANGED], 0); } }
static GtkWidget *create_charset_menu(FileInfo *selected_fi) { GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); GtkTreeIter iter; GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); GtkWidget *option_menu = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); CharsetTable *ctable; guint i; if (mode == OPEN) { gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, _("Auto-Detect"), -1); } ctable = get_charset_table(); for (i = 0; i < ctable->num; i++) { gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, ctable->str[i], -1); } menu_item_manual_charset = NULL; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, gtk_menu_item_get_label(GTK_MENU_ITEM(init_menu_item_manual_charset(selected_fi->charset_flag ? selected_fi->charset : NULL))), -1); charset_menu_init_flag = TRUE; g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(cb_select_charset), selected_fi); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (option_menu), renderer, FALSE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (option_menu), renderer, "text", 0, NULL); i = 0; if (selected_fi->charset) { do { if (g_ascii_strcasecmp(selected_fi->charset, ctable->charset[i]) == 0) break; i++; } while (i < ctable->num); if (mode == OPEN && selected_fi->charset_flag == FALSE) { g_free(selected_fi->charset); selected_fi->charset = NULL; } else if (i == ctable->num && selected_fi->charset_flag == FALSE) { init_menu_item_manual_charset(selected_fi->charset); } i += mode; } if (mode == SAVE || selected_fi->charset_flag) gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), i); charset_menu_init_flag = FALSE; return option_menu; }
void on_menu_cal_click(GtkMenuItem *item, gpointer data) { const gchar *today_text; GtkClipboard *clipboard; today_text = gtk_menu_item_get_label(item); /* tell the clipboard manager to make the data persistent */ clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_can_store(clipboard, NULL, 0); /* set clipboard text */ gtk_clipboard_set_text(clipboard, today_text, -1); }
void activate(GApplication *app, gpointer user_data) { GtkMenuItem *menu_cal; const gchar *today_text; GNotification *notification; menu_cal = GTK_MENU_ITEM(gtk_builder_get_object(builder, "menu_cal")); today_text = gtk_menu_item_get_label(menu_cal); /* create a notify with today_text when app activates */ notification = g_notification_new(_("Acal")); g_notification_set_body(notification, today_text); g_application_send_notification(app, "today-notify", notification); g_object_unref(notification); }
/* * show/hide voltage graph */ void on_view_voltage_graph (GtkWidget* widget, gpointer data) { const gchar *label; label = gtk_menu_item_get_label ((GtkMenuItem*) widget); /* *hbox1 is the father of vobx2(acc_graph) & vbox3(gyro_graph) */ if (label[0] == '-') { gtk_widget_hide(GTK_WIDGET (gtk_builder_get_object (theXml, "hbox1"))); gtk_menu_item_set_label ((GtkMenuItem*) widget, "+ Acc/Gyro Graph"); } else { gtk_widget_show(GTK_WIDGET (gtk_builder_get_object (theXml, "hbox1"))); gtk_menu_item_set_label ((GtkMenuItem*) widget, "- Acc/Gyro Graph"); } }
G_MODULE_EXPORT void on_viewMenu_activate( GtkObject *object, gpointer user_data) { GtkMenuItem *item= GTK_MENU_ITEM(object); if(gtk_menu_item_get_submenu(item) != NULL) { char buffer[100]; char *prefix= "Plot Window"; GtkMenu *menu= GTK_MENU(gtk_menu_item_get_submenu(item)); GList *initial_list = gtk_container_get_children(GTK_CONTAINER(menu)); // iterate the linked list and remove all the Plot Window entries... GList *entry= initial_list; while(entry) { if(GTK_IS_MENU_ITEM(entry->data) && !GTK_IS_SEPARATOR_MENU_ITEM(entry->data)) { const char *existing_label= gtk_menu_item_get_label(GTK_MENU_ITEM(entry->data)); // fprintf(stderr, "Label %s\n", existing_label); if(startswith(existing_label, prefix)) { // fprintf(stderr, "Removing %s\n", existing_label); // do we have to remove it explicitly, or can we just nuke and pave? gtk_widget_destroy(GTK_WIDGET(entry->data)); } } entry= entry->next; } g_list_free(initial_list); int ii; for(ii= 0; ii<MAXIMUM_NUMBER_OF_WINDOWS; ii++) { if (wininfo.windows[ii]==1) { sprintf(buffer, "%s %d", prefix, ii+1); GtkWidget *child= gtk_menu_item_new_with_label(buffer); gtk_signal_connect (GTK_OBJECT (child), "activate", GTK_SIGNAL_FUNC (on_activate_plot_window), GINT_TO_POINTER (ii)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), child); gtk_widget_show(child); } } } }
static void dev_menuitem_toggled(GtkMenuItem *item, GtkComboBox *combo) { GtkTreeModel *model = gtk_combo_box_get_model(combo); GtkTreeIter iter; if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))) return; if (gtk_tree_model_get_iter_first(model, &iter)) do { gchar *name; gtk_tree_model_get(model, &iter, 0, &name, -1); if (g_str_equal(name, gtk_menu_item_get_label(item))) { gtk_combo_box_set_active_iter(combo, &iter); return; } } while (gtk_tree_model_iter_next(model, &iter)); }
/* * start/stop channel graph/3D copter drawing */ void on_start_activate (GtkWidget* widget, gpointer data) { const gchar *label; label = gtk_menu_item_get_label ((GtkMenuItem*) widget); if (label[2] == 'o') { mx_rx_unregister(&mx, ANALOG_DATA_RESPONSE, parse_packet); gtk_menu_item_set_label ((GtkMenuItem*) widget, "Start"); // sensors caliberation attitude.acc_nml_x = acc_data[accdata_present_index].value[ACCX_CHANNEL]; attitude.acc_nml_y = acc_data[accdata_present_index].value[ACCY_CHANNEL]; attitude.acc_nml_z = acc_data[accdata_present_index].value[ACCZ_CHANNEL]; } else { mx_rx_register(&mx, ANALOG_DATA_RESPONSE, parse_packet, NULL); gtk_menu_item_set_label ((GtkMenuItem*) widget, "Stop"); } }
void activate_user (GtkCheckMenuItem *menu, gpointer data) { const char *label; gboolean active; int idx = 0; if (data == NULL) { /* Bogus condition to use parameters */ ; } label = gtk_menu_item_get_label((GtkMenuItem *)menu); active = gtk_check_menu_item_get_active(menu); for (idx = 0; idx < progopts->menu_len; idx++) { if (!strcmp(progopts->menu_items[idx], label)) { progopts->userdef[idx] = active ? 1 : -progopts->userdef[idx]; break; } } }
static void on_toolbar_reconfigured(GtkToolItem *tool_item, ToolItem *item) { GtkToolShell *shell = GTK_TOOL_SHELL(gtk_widget_get_parent(item->widget)); gboolean large = gtk_tool_shell_get_icon_size(shell) > GTK_ICON_SIZE_MENU; gchar *tooltip = NULL; if (gtk_tool_shell_get_style(shell) == GTK_TOOLBAR_ICONS) { GtkMenuItem *menu_item = GTK_MENU_ITEM(debug_menu_items[item->index].widget); tooltip = g_strdup(gtk_menu_item_get_label(menu_item)); utils_str_remove_chars(tooltip, "_"); } gtk_tool_item_set_tooltip_text(tool_item, tooltip); g_free(tooltip); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(tool_item), get_widget(item->icon[large])); }
static void on_pick_screen (GtkWidget *item, PlayerAV *self) { GdkRectangle rect; gint num; if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) { num = atoi (gtk_menu_item_get_label (GTK_MENU_ITEM (item))) - 1; self->priv->monitor = num; if (self->priv->fs_win) { GdkScreen *screen = gdk_screen_get_default (); gdk_screen_get_monitor_geometry (screen, num, &rect); gtk_window_move (GTK_WINDOW (self->priv->fs_win), rect.x, rect.y); } } }
static void banlist_copyentry (GtkWidget *menuitem, GtkTreeView *view) { GtkTreeModel *model; GtkTreeSelection *sel; GtkTreeIter iter; GValue mask; GValue from; GValue date; char *str; memset (&mask, 0, sizeof (mask)); memset (&from, 0, sizeof (from)); memset (&date, 0, sizeof (date)); /* get selection (which should have been set on click) * and temporarily switch to single mode to get selected iter */ sel = gtk_tree_view_get_selection (view); gtk_tree_selection_set_mode (sel, GTK_SELECTION_SINGLE); if (gtk_tree_selection_get_selected (sel, &model, &iter)) { gtk_tree_model_get_value (model, &iter, MASK_COLUMN, &mask); gtk_tree_model_get_value (model, &iter, FROM_COLUMN, &from); gtk_tree_model_get_value (model, &iter, DATE_COLUMN, &date); /* poor way to get which is selected but it works */ if (strcmp (_("Copy mask"), gtk_menu_item_get_label (GTK_MENU_ITEM(menuitem))) == 0) str = g_value_dup_string (&mask); else str = g_strdup_printf (_("%s on %s by %s"), g_value_get_string (&mask), g_value_get_string (&date), g_value_get_string (&from)); if (str[0] != 0) gtkutil_copy_to_clipboard (menuitem, NULL, str); g_value_unset (&mask); g_value_unset (&from); g_value_unset (&date); g_free (str); } gtk_tree_selection_set_mode (sel, GTK_SELECTION_MULTIPLE); }
static void on_menu_item_activate(GtkMenuItem *item, XmrIndicatorPlugin *plugin) { const gchar *menu = gtk_menu_item_get_label(item); if(g_strcmp0(menu, GTK_STOCK_QUIT) == 0) { xmr_window_quit(plugin->window); } else if(g_strcmp0(menu, GTK_STOCK_MEDIA_PLAY) == 0) { xmr_window_play(plugin->window); gtk_widget_hide(GTK_WIDGET(item)); gtk_widget_show(plugin->menu_item_pause); } else if(g_strcmp0(menu, GTK_STOCK_MEDIA_PAUSE) == 0) { xmr_window_pause(plugin->window); gtk_widget_hide(GTK_WIDGET(item)); gtk_widget_show(plugin->menu_item_play); } else if(g_strcmp0(menu, GTK_STOCK_MEDIA_NEXT) == 0) { xmr_window_play_next(plugin->window); } else if(g_strcmp0(menu, _("Show")) == 0) { gtk_widget_show(GTK_WIDGET(plugin->window)); gtk_window_present(GTK_WINDOW(plugin->window)); } else if(g_strcmp0(menu, _("Love")) == 0) { xmr_window_love(plugin->window); } else if(g_strcmp0(menu, _("Hate")) == 0) { xmr_window_hate(plugin->window); } }
void gw_spellcheck_menuitem_activated_cb (GtkWidget *widget, gpointer data) { //Declarations GwSpellcheck *spellcheck; GwSpellcheckPrivate *priv; const gchar *query; const gchar *replacement; gchar *buffer; gint start_offset; gint end_offset; gint index; //Initializations spellcheck = GW_SPELLCHECK (data); priv = spellcheck->priv; query = gtk_entry_get_text (priv->entry); start_offset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "start-offset")); end_offset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "end-offset")); replacement = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); buffer = g_new (gchar, strlen(replacement) + strlen(query)); index = gtk_editable_get_position (GTK_EDITABLE (priv->entry)); //Build the replacement query string strncpy(buffer, query, start_offset); strcpy (buffer + start_offset, replacement); strcat (buffer, query + end_offset); //Update where the cursor should be relative to the replacement word length if (index >= start_offset + strlen(replacement)) index += strlen(buffer) - strlen(query); //Showtime gtk_entry_set_text (GTK_ENTRY (priv->entry), buffer); gtk_editable_set_position (GTK_EDITABLE (priv->entry), index); //Cleanup g_free (buffer); }
Php::Value GtkMenuItem_::get_label() { std::string ret = gtk_menu_item_get_label (GTK_MENU_ITEM(instance)); return ret; }
bool WebPopupMenuProxyGtk::typeAheadFind(GdkEventKey* event) { // If we were given a non-printable character just skip it. gunichar unicodeCharacter = gdk_keyval_to_unicode(event->keyval); if (!g_unichar_isprint(unicodeCharacter)) { resetTypeAheadFindState(); return false; } glong charactersWritten; GUniquePtr<gunichar2> utf16String(g_ucs4_to_utf16(&unicodeCharacter, 1, nullptr, &charactersWritten, nullptr)); if (!utf16String) { resetTypeAheadFindState(); return false; } // If the character is the same as the last character, the user is probably trying to // cycle through the menulist entries. This matches the WebCore behavior for collapsed menulists. static const uint32_t searchTimeoutMs = 1000; bool repeatingCharacter = unicodeCharacter != m_previousKeyEventCharacter; if (event->time - m_previousKeyEventTimestamp > searchTimeoutMs) m_currentSearchString = String(reinterpret_cast<UChar*>(utf16String.get()), charactersWritten); else if (repeatingCharacter) m_currentSearchString.append(String(reinterpret_cast<UChar*>(utf16String.get()), charactersWritten)); m_previousKeyEventTimestamp = event->time; m_previousKeyEventCharacter = unicodeCharacter; GUniquePtr<GList> children(gtk_container_get_children(GTK_CONTAINER(m_popup))); if (!children) return true; // We case fold before searching, because strncmp does not handle non-ASCII characters. GUniquePtr<gchar> searchStringWithCaseFolded(g_utf8_casefold(m_currentSearchString.utf8().data(), -1)); size_t prefixLength = strlen(searchStringWithCaseFolded.get()); // If a menu item has already been selected, start searching from the current // item down the list. This will make multiple key presses of the same character // advance the selection. GList* currentChild = children.get(); if (m_currentlySelectedMenuItem) { currentChild = g_list_find(children.get(), m_currentlySelectedMenuItem); if (!currentChild) { m_currentlySelectedMenuItem = nullptr; currentChild = children.get(); } // Repeating characters should iterate. if (repeatingCharacter) { if (GList* nextChild = g_list_next(currentChild)) currentChild = nextChild; } } GList* firstChild = currentChild; do { currentChild = g_list_next(currentChild); if (!currentChild) currentChild = children.get(); GUniquePtr<gchar> itemText(g_utf8_casefold(gtk_menu_item_get_label(GTK_MENU_ITEM(currentChild->data)), -1)); if (!strncmp(searchStringWithCaseFolded.get(), itemText.get(), prefixLength)) { gtk_menu_shell_select_item(GTK_MENU_SHELL(m_popup), GTK_WIDGET(currentChild->data)); break; } } while (currentChild != firstChild); return true; }
void serial_port_cb(GtkWidget *item, gpointer data) { serial_port = strdup(gtk_menu_item_get_label(GTK_MENU_ITEM(item))); update_status_bar(); }
void plugin_init(G_GNUC_UNUSED GeanyData *gdata) { GeanyKeyGroup *scope_key_group; char *gladefile = g_build_filename(PLUGINDATADIR, "scope.glade", NULL); GError *gerror = NULL; GtkWidget *menubar1 = find_widget(geany->main_widgets->window, "menubar1"); guint item; const MenuKey *menu_key = debug_menu_keys; ToolItem *tool_item = toolbar_items; const ScopeCallback *scb; main_locale_init(LOCALEDIR, GETTEXT_PACKAGE); scope_key_group = plugin_set_key_group(geany_plugin, "scope", COUNT_KB, NULL); builder = gtk_builder_new(); gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE); scp_tree_store_register_dynamic(); if (!gtk_builder_add_from_file(builder, gladefile, &gerror)) { msgwin_status_add(_("Scope: %s."), gerror->message); g_warning(_("Scope: %s."), gerror->message); g_error_free(gerror); g_object_unref(builder); builder = NULL; } g_free(gladefile); if (!builder) return; /* interface */ #ifndef G_OS_UNIX gtk_widget_hide(get_widget("terminal_show")); #endif debug_item = get_widget("debug_item"); if (menubar1) gtk_menu_shell_insert(GTK_MENU_SHELL(menubar1), debug_item, DEBUG_MENU_ITEM_POS); else gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), debug_item); menu_connect("debug_menu", &debug_menu_info, NULL); ui_add_document_sensitive(get_widget("scope_reset_markers")); ui_add_document_sensitive(get_widget("scope_cleanup_files")); for (item = 0; item < EVALUATE_KB; item++, menu_key++) { keybindings_set_item(scope_key_group, item, on_scope_key, 0, 0, menu_key->name, _(menu_key->label), debug_menu_items[item].widget); } geany_statusbar = GTK_STATUSBAR(gtk_widget_get_parent(geany->main_widgets->progressbar)); debug_statusbar = get_widget("debug_statusbar"); debug_state_label = GTK_LABEL(get_widget("debug_state_label")); gtk_box_pack_end(GTK_BOX(geany_statusbar), debug_statusbar, FALSE, FALSE, 0); debug_panel = get_widget("debug_panel"); gtk_notebook_append_page(GTK_NOTEBOOK(geany->main_widgets->message_window_notebook), debug_panel, get_widget("debug_label")); /* startup */ gtk216_init(); program_init(); prefs_init(); conterm_init(); inspect_init(); register_init(); parse_init(); debug_init(); views_init(); thread_init(); break_init(); watch_init(); stack_init(); local_init(); memory_init(); menu_init(); menu_set_popup_keybindings(scope_key_group, item); for (item = 0; tool_item->index != -1; item++, tool_item++) { GtkMenuItem *menu_item = GTK_MENU_ITEM(debug_menu_items[tool_item->index].widget); GtkToolItem *button = gtk_tool_button_new(NULL, gtk_menu_item_get_label(menu_item)); gtk_tool_button_set_use_underline(GTK_TOOL_BUTTON(button), gtk_menu_item_get_use_underline(menu_item)); g_signal_connect(button, "clicked", G_CALLBACK(on_toolbar_button_clicked), GINT_TO_POINTER(tool_item->index)); g_signal_connect(button, "toolbar-reconfigured", G_CALLBACK(on_toolbar_reconfigured), tool_item); tool_item->widget = GTK_WIDGET(button); plugin_add_toolbar_item(geany_plugin, button); } toolbar_update_state(DS_INACTIVE); views_update_state(DS_INACTIVE); configure_toolbar(); g_signal_connect(debug_panel, "switch-page", G_CALLBACK(on_view_changed), NULL); for (scb = scope_callbacks; scb->name; scb++) plugin_signal_connect(geany_plugin, NULL, scb->name, FALSE, scb->callback, NULL); }
static void _property_choice_callback(GtkMenuItem *item, gpointer user_data) { dt_lib_camera_t *lib = (dt_lib_camera_t *)user_data; gtk_entry_set_text(GTK_ENTRY(lib->gui.pname), gtk_menu_item_get_label(item)); }
static void store_populate_menu_items (GtkListStore *store, GtkMenuShell *menu, const gchar *parent_path) { GList *children; GList *node; children = gtk_container_get_children (GTK_CONTAINER (menu)); for (node = children; node; node = node->next) { if (GTK_IS_SEPARATOR_MENU_ITEM (node->data) || ! gtk_widget_get_visible (node->data)) { /* skip that */ } else if (GTK_IS_MENU_ITEM (node->data)) { GtkWidget *submenu; gchar *path; gchar *item_label; gboolean use_underline; GtkStockItem item; if (GTK_IS_IMAGE_MENU_ITEM (node->data) && gtk_image_menu_item_get_use_stock (node->data) && gtk_stock_lookup (gtk_menu_item_get_label (node->data), &item)) { item_label = g_strdup (item.label); use_underline = TRUE; } else { item_label = g_strdup (gtk_menu_item_get_label (node->data)); use_underline = gtk_menu_item_get_use_underline (node->data); } /* remove underlines */ if (use_underline) { gchar *p = item_label; gsize len = strlen (p); while ((p = strchr (p, '_')) != NULL) { len -= (gsize) (p - item_label); memmove (p, p + 1, len); } } if (parent_path) { path = g_strconcat (parent_path, PATH_SEPARATOR, item_label, NULL); } else { path = g_strdup (item_label); } submenu = gtk_menu_item_get_submenu (node->data); if (submenu) { /* go deeper in the menus... */ store_populate_menu_items (store, GTK_MENU_SHELL (submenu), path); } else { gchar *tmp; gchar *tooltip; gchar *label = g_markup_printf_escaped ("<big>%s</big>", item_label); tooltip = gtk_widget_get_tooltip_markup (node->data); if (tooltip) { SETPTR (label, g_strconcat (label, "\n<small>", tooltip, "</small>", NULL)); g_free (tooltip); } tmp = g_markup_escape_text (path, -1); SETPTR (label, g_strconcat (label, "\n<small><i>", tmp, "</i></small>", NULL)); g_free (tmp); gtk_list_store_insert_with_values (store, NULL, -1, COL_LABEL, label, COL_PATH, path, COL_TYPE, COL_TYPE_MENU_ITEM, COL_WIDGET, node->data, -1); g_free (label); } g_free (item_label); g_free (path); } else { g_warning ("Unknown widget type in the menu: %s", G_OBJECT_TYPE_NAME (node->data)); } } g_list_free (children); }