static void composer_setup_charset_menu (EMsgComposer *composer) { EHTMLEditor *editor; GtkUIManager *ui_manager; const gchar *path; GList *list; guint merge_id; editor = e_msg_composer_get_editor (composer); ui_manager = e_html_editor_get_ui_manager (editor); path = "/main-menu/options-menu/charset-menu"; merge_id = gtk_ui_manager_new_merge_id (ui_manager); list = gtk_action_group_list_actions (composer->priv->charset_actions); list = g_list_sort (list, (GCompareFunc) e_action_compare_by_label); while (list != NULL) { GtkAction *action = list->data; gtk_ui_manager_add_ui ( ui_manager, merge_id, path, gtk_action_get_name (action), gtk_action_get_name (action), GTK_UI_MANAGER_AUTO, FALSE); list = g_list_delete_link (list, list); } gtk_ui_manager_ensure_update (ui_manager); }
gint gimp_action_name_compare (GimpAction *action1, GimpAction *action2) { return strcmp (gtk_action_get_name ((GtkAction *) action1), gtk_action_get_name ((GtkAction *) action2)); }
static void drag_end_cb (GtkWidget *widget, GdkDragContext *context, EggEditableToolbar *etoolbar) { GtkAction *action; gint flags; if (gtk_widget_get_parent (widget) != NULL) { gtk_widget_show (widget); #if GTK_CHECK_VERSION (2, 16, 0) action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget)); #else action = gtk_widget_get_action (widget); #endif if (action == NULL) return; flags = egg_toolbars_model_get_name_flags (etoolbar->priv->model, gtk_action_get_name (action)); if (!(flags & EGG_TB_MODEL_NAME_INFINITE)) { flags |= EGG_TB_MODEL_NAME_USED; egg_toolbars_model_set_name_flags (etoolbar->priv->model, gtk_action_get_name (action), flags); } } }
static void browser_create (void) { MidoriApp* app; MidoriBrowser* browser; GtkActionGroup* action_group; GList* actions; app = midori_app_new (); browser = midori_app_create_browser (app); gtk_widget_destroy (GTK_WIDGET (browser)); app = midori_app_new (); browser = midori_app_create_browser (app); action_group = midori_browser_get_action_group (browser); actions = gtk_action_group_list_actions (action_group); while (actions) { GtkAction* action = actions->data; if (g_strcmp0 (gtk_action_get_name (action), "WindowClose")) if (g_strcmp0 (gtk_action_get_name (action), "EncodingCustom")) if (g_strcmp0 (gtk_action_get_name (action), "AddSpeedDial")) gtk_action_activate (action); actions = g_list_next (actions); } g_list_free (actions); gtk_widget_destroy (GTK_WIDGET (browser)); g_object_unref (app); }
void nautilus_navigation_window_load_extension_toolbar_items (NautilusNavigationWindow *window) { GtkActionGroup *action_group; GtkAction *action; GtkUIManager *ui_manager; GList *items; GList *l; NautilusMenuItem *item; guint merge_id; ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window)); if (window->details->extensions_toolbar_merge_id != 0) { gtk_ui_manager_remove_ui (ui_manager, window->details->extensions_toolbar_merge_id); window->details->extensions_toolbar_merge_id = 0; } if (window->details->extensions_toolbar_action_group != NULL) { gtk_ui_manager_remove_action_group (ui_manager, window->details->extensions_toolbar_action_group); window->details->extensions_toolbar_action_group = NULL; } merge_id = gtk_ui_manager_new_merge_id (ui_manager); window->details->extensions_toolbar_merge_id = merge_id; action_group = gtk_action_group_new ("ExtensionsToolbarGroup"); window->details->extensions_toolbar_action_group = action_group; gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_ui_manager_insert_action_group (ui_manager, action_group, -1); g_object_unref (action_group); /* owned by ui manager */ items = get_extension_toolbar_items (window); for (l = items; l != NULL; l = l->next) { item = NAUTILUS_MENU_ITEM (l->data); action = nautilus_toolbar_action_from_menu_item (item); gtk_action_group_add_action (action_group, GTK_ACTION (action)); g_object_unref (action); gtk_ui_manager_add_ui (ui_manager, merge_id, TOOLBAR_PATH_EXTENSION_ACTIONS, gtk_action_get_name (action), gtk_action_get_name (action), GTK_UI_MANAGER_TOOLITEM, FALSE); g_object_unref (item); } g_list_free (items); }
static int model_action_code (GtkAction *action) { const gchar *s = gtk_action_get_name(action); int ci = gretl_command_number(s); if (ci == 0) { /* look up "GUI special" */ if (!strcmp(s, "PANEL_WLS")) ci = PANEL_WLS; else if (!strcmp(s, "PANEL_B")) ci = PANEL_B; else if (!strcmp(s, "VLAGSEL")) ci = VLAGSEL; else if (!strcmp(s, "blogit")) ci = LOGIT; else if (!strcmp(s, "ologit")) ci = OLOGIT; else if (!strcmp(s, "mlogit")) ci = MLOGIT; else if (!strcmp(s, "bprobit")) ci = PROBIT; else if (!strcmp(s, "oprobit")) ci = OPROBIT; else if (!strcmp(s, "reprobit")) ci = REPROBIT; else if (!strcmp(s, "iv-liml")) ci = IV_LIML; else if (!strcmp(s, "iv-gmm")) ci = IV_GMM; else if (!strcmp(s, "countmod")) ci = COUNTMOD; } return ci; }
void fsave_callback (GtkAction *action, gpointer p) { const gchar *s = gtk_action_get_name(action); int ci = fsave_code(s); file_save(p, ci); }
static void drag_data_get_cb (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint32 time, EggToolbarEditor *editor) { GtkAction *action; const char *target; action = GTK_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action")); if (action) { target = gtk_action_get_name (action); } else { target = "separator"; } gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar *)target, strlen (target)); }
static void gimp_color_button_use_color (GtkAction *action, GimpColorButton *button) { const gchar *name; GimpRGB color; name = gtk_action_get_name (action); gimp_color_button_get_color (button, &color); if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_FG)) { if (_gimp_get_foreground_func) _gimp_get_foreground_func (&color); else gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0); } else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_BG)) { if (_gimp_get_background_func) _gimp_get_background_func (&color); else gimp_rgba_set (&color, 1.0, 1.0, 1.0, 1.0); } else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_BLACK)) { gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0); } else if (! strcmp (name, GIMP_COLOR_BUTTON_COLOR_WHITE)) { gimp_rgba_set (&color, 1.0, 1.0, 1.0, 1.0); } gimp_color_button_set_color (button, &color); }
static void on_terminal_command_cb (GtkAction * action, TerminalPlugin *term_plugin) { VteTerminal *term; gchar c; if (term_plugin->child_pid) term = VTE_TERMINAL (term_plugin->term); else term = VTE_TERMINAL (term_plugin->shell); /* this only works for control + letter */ c = gtk_action_get_name (action) [strlen (gtk_action_get_name (action)) - 1] - 64; vte_terminal_feed_child (term, &c, 1); }
static void encoding_activate_cb (GtkAction *action, GaleonEncodingMenu *menu) { GaleonEmbed *embed; GaleonEncodingPageInfo *info; const char *name, *encoding; if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) == FALSE || menu->priv->update_tag) { return; } name = gtk_action_get_name (action); encoding = name + strlen("Encoding"); embed = galeon_window_get_active_embed (menu->priv->window); info = galeon_embed_get_encoding_info (embed); /* Force only when different from current encoding */ if (info->encoding && strcmp (info->encoding, encoding) != 0) { galeon_embed_set_encoding (embed, encoding); } galeon_encoding_page_info_free (info); galeon_encodings_add_recent (menu->priv->encodings, encoding); }
void model_stat_callback (GtkAction *action, gpointer data) { const gchar *s = gtk_action_get_name(action); windata_t *vwin = (windata_t *) data; MODEL *pmod = vwin->data; int code = M_ESS; if (!strcmp(s, "ess")) { code = M_ESS; } else if (!strcmp(s, "se")) { code = M_SIGMA; } else if (!strcmp(s, "rsq")) { code = M_RSQ; } else if (!strcmp(s, "trsq")) { code = M_TRSQ; } else if (!strcmp(s, "df")) { code = M_DF; } else if (!strcmp(s, "lnL")) { code = M_LNL; } else if (!strcmp(s, "AIC")) { code = M_AIC; } else if (!strcmp(s, "BIC")) { code = M_BIC; } else if (!strcmp(s, "HQC")) { code = M_HQC; } add_model_stat(pmod, code, vwin); }
static void open_file_from_filelist (GtkAction *action) { const gchar *s = gtk_action_get_name(action); char ftype[8]; int i; sscanf(s, "%s %d", ftype, &i); if (!strcmp(ftype, "Data")) { strcpy(tryfile, datap[i]); if (strstr(tryfile, ".csv")) { int resp = csv_options_dialog(OPEN_DATA, GRETL_OBJ_DSET, NULL); if (canceled(resp)) { return; } } verify_open_data(NULL, 0); } else if (!strcmp(ftype, "Script")) { strcpy(tryfile, scriptp[i]); do_open_script(EDIT_SCRIPT); } else if (!strcmp(ftype, "Session")) { strcpy(tryfile, sessionp[i]); verify_open_session(); } else if (!strcmp(ftype, "Gfn")) { edit_specified_package(gfnp[i]); } }
static void shell_searchbar_save_search_scope (EShellSearchbar *searchbar) { EShellView *shell_view; EActionComboBox *action_combo_box; GtkRadioAction *radio_action; GKeyFile *key_file; const gchar *action_name; const gchar *state_group; const gchar *key; shell_view = e_shell_searchbar_get_shell_view (searchbar); /* Search scope is hard-coded to the default state group. */ state_group = STATE_GROUP_DEFAULT; key = STATE_KEY_SEARCH_SCOPE; key_file = e_shell_view_get_state_key_file (shell_view); action_combo_box = e_shell_searchbar_get_scope_combo_box (searchbar); radio_action = e_action_combo_box_get_action (action_combo_box); if (radio_action != NULL) radio_action = e_radio_action_get_current_action (radio_action); if (radio_action != NULL) { action_name = gtk_action_get_name (GTK_ACTION (radio_action)); g_key_file_set_string (key_file, state_group, key, action_name); } else g_key_file_remove_key (key_file, state_group, key, NULL); e_shell_view_set_state_dirty (shell_view); }
static void shell_searchbar_save_search_filter (EShellSearchbar *searchbar) { EShellView *shell_view; EActionComboBox *action_combo_box; GtkRadioAction *radio_action; GKeyFile *key_file; const gchar *action_name; const gchar *state_group; const gchar *key; shell_view = e_shell_searchbar_get_shell_view (searchbar); state_group = e_shell_searchbar_get_state_group (searchbar); g_return_if_fail (state_group != NULL); key = STATE_KEY_SEARCH_FILTER; key_file = e_shell_view_get_state_key_file (shell_view); action_combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); radio_action = e_action_combo_box_get_action (action_combo_box); if (radio_action != NULL) radio_action = e_radio_action_get_current_action (radio_action); if (radio_action != NULL) { action_name = gtk_action_get_name (GTK_ACTION (radio_action)); g_key_file_set_string (key_file, state_group, key, action_name); } else g_key_file_remove_key (key_file, state_group, key, NULL); e_shell_view_set_state_dirty (shell_view); }
static void _action_done (GtkActionGroup *action_group, GtkAction *action, gpointer user_data) { dia_log_message ("Done '%s'\n", gtk_action_get_name (action)); }
char * _moo_action_make_accel_path (gpointer action) { GtkActionGroup *group = NULL; MooActionCollection *collection; const char *name, *group_name, *collection_name; g_return_val_if_fail (MOO_IS_ACTION_BASE (action), NULL); group = _moo_action_get_group (action); g_return_val_if_fail (MOO_IS_ACTION_GROUP (group), NULL); collection = _moo_action_group_get_collection (MOO_ACTION_GROUP (group)); g_return_val_if_fail (MOO_IS_ACTION_COLLECTION (collection), NULL); name = gtk_action_get_name (GTK_ACTION (action)); group_name = gtk_action_group_get_name (group); collection_name = moo_action_collection_get_name (collection); g_return_val_if_fail (collection_name != NULL, NULL); g_return_val_if_fail (name != NULL && name[0] != 0, NULL); if (group_name) return g_strdup_printf ("<MooAction>/%s/%s/%s", collection_name, group_name, name); else return g_strdup_printf ("<MooAction>/%s/%s", collection_name, name); }
/*---------------------------------------------------------------------------*/ static void view_ui_item_toggled_cb (GtkToggleAction *action, GtkUIManager *ui) { const gchar *name; gboolean state; gl_debug (DEBUG_UI, "START"); g_return_if_fail (action && GTK_IS_TOGGLE_ACTION (action)); name = gtk_action_get_name (GTK_ACTION (action)); state = gtk_toggle_action_get_active (action); gl_debug (DEBUG_UI, "Action = %s, State = %d", name, state); if (strcmp (name, "ViewMainToolBar") == 0) { gl_prefs_model_set_main_toolbar_visible (gl_prefs, state); set_app_main_toolbar_style (ui); } if (strcmp (name, "ViewDrawingToolBar") == 0) { gl_prefs_model_set_drawing_toolbar_visible (gl_prefs, state); set_app_drawing_toolbar_style (ui); } gl_debug (DEBUG_UI, ""); }
static void _set_flags(GtkToggleAction *action) { char *temp = NULL; uint64_t debug_flags_plus = 0, debug_flags_minus = 0; uint64_t flag = (uint64_t)NO_VAL; const char *name; if (!action) return; name = gtk_action_get_name(GTK_ACTION(action)); if (!name) return; if (debug_str2flags((char *)name, &flag) != SLURM_SUCCESS) return; if (action && gtk_toggle_action_get_active(action)) debug_flags_plus |= flag; else debug_flags_minus |= flag; if (!slurm_set_debugflags(debug_flags_plus, debug_flags_minus)) temp = g_strdup_printf("Slurmctld DebugFlags reset"); else temp = g_strdup_printf("Problem with set DebugFlags request"); display_edit_note(temp); g_free(temp); }
static void plugin_action_cb (GtkAction *action, GigglePlugin *plugin) { char *callback_name; GigglePluginCallback callback; const GSignalInvocationHint *hint; hint = g_signal_get_invocation_hint (action); g_signal_handlers_disconnect_by_func (action, plugin_action_cb, plugin); callback_name = plugin_get_callback_name (gtk_action_get_name (action), g_signal_name (hint->signal_id)); callback = plugin_lookup_symbol (plugin, callback_name); if (callback) { g_signal_connect (action, g_signal_name (hint->signal_id), G_CALLBACK (callback), plugin); callback (action, plugin); } g_free (callback_name); }
static void eex_folder_unsubscribe_cb (GtkAction *action, EShellView *shell_view) { gchar *uri = NULL; const gchar *name; g_return_if_fail (shell_view != NULL); name = gtk_action_get_name (action); g_return_if_fail (name != NULL); name = strrchr (name, '-'); g_return_if_fail (name != NULL && *name == '-'); if (is_eex_source_selected (shell_view, &uri)) { EShellSidebar *shell_sidebar; ESourceSelector *selector = NULL; ESource *source; shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); g_return_if_fail (shell_sidebar != NULL); g_object_get (shell_sidebar, "selector", &selector, NULL); g_return_if_fail (selector != NULL); source = e_source_selector_ref_primary_selection (selector); call_folder_unsubscribe (name + 1, uri, source); g_object_unref (source); } g_free (uri); }
static void plugin_action_cb (GtkAction *action, GigglePlugin *plugin) { char *callback_name; GigglePluginCallback callback; const GSignalInvocationHint *hint; g_signal_handlers_disconnect_by_func (action, plugin_action_cb, plugin); hint = g_signal_get_invocation_hint (action); callback_name = plugin_get_callback_name (gtk_action_get_name (action), g_signal_name (hint->signal_id)); callback = plugin_lookup_symbol (plugin, callback_name); if (callback) { g_signal_connect (action, g_signal_name (hint->signal_id), G_CALLBACK (callback), plugin); callback (action, plugin); } else if (!strcmp (g_signal_name (hint->signal_id), "activate")) { g_warning ("%s: Cannot find %s()", G_STRFUNC, callback_name); } g_free (callback_name); }
static void activate_action(GtkAction *action, VALUE self) { VALUE action_procs = rb_ivar_get(self, id_action_procs); VALUE proc = rb_hash_aref(action_procs, CSTR2RVAL(gtk_action_get_name(action))); if (! NIL_P(proc)) rb_funcall(proc, id_call, 2, self, GOBJ2RVAL(action)); }
void open_data (GtkAction *action) { if (!dataset_locked()) { int code = open_data_code(gtk_action_get_name(action)); file_selector(code, FSEL_DATA_NONE, NULL); } }
static int nist_verbosity (GtkAction *action) { const gchar *s = gtk_action_get_name(action); if (!strcmp(s, "NistVVerbose")) return 2; else if (!strcmp(s, "NistVerbose")) return 1; else return 0; }
static void remove_action_item (GtkAction *action, GtkUIManager *manager) { guint menu_merge_id; GList *actions, *l; menu_merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (action), "merge-id")); gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), menu_merge_id); actions = gtk_action_group_list_actions (devices_action_group); for (l = actions; l != NULL; l = l->next) { GtkAction *a = l->data; /* Don't remove the top-level action straight away */ if (g_str_equal (gtk_action_get_name (a), gtk_action_get_name (action)) != FALSE) continue; /* But remove all the sub-actions for it */ if (g_str_has_prefix (gtk_action_get_name (a), gtk_action_get_name (action)) != FALSE) gtk_action_group_remove_action (devices_action_group, a); } g_list_free (actions); gtk_action_group_remove_action (devices_action_group, action); }
static void empathy_mic_menu_update (EmpathyMicMenu *self) { EmpathyMicMenuPrivate *priv = self->priv; GList *l; GtkUIManager *ui_manager; EmpathyGstAudioSrc *audio; guint current_mic; ui_manager = empathy_call_window_get_ui_manager (priv->window); audio = empathy_call_window_get_audio_src (priv->window); current_mic = empathy_audio_src_get_microphone (audio); empathy_mic_menu_clean (self); priv->ui_id = gtk_ui_manager_new_merge_id (ui_manager); for (l = priv->microphones->head; l != NULL; l = l->next) { GtkRadioAction *action = l->data; const gchar *name = gtk_action_get_name (GTK_ACTION (action)); gint value; gboolean active; g_object_get (action, "value", &value, NULL); active = (value == (gint) current_mic); if (active) { priv->in_update = TRUE; gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE); priv->in_update = FALSE; } /* If action is a monitor then don't show it in the UI, BUT do * display it regardless if it is the current device. This is so * we don't have a rubbish UI by showing monitor devices in * Empathy, but still show the correct device when someone plays * with pavucontrol. */ if (g_object_get_data (G_OBJECT (action), MONITOR_KEY) != NULL && !active) continue; gtk_ui_manager_add_ui (ui_manager, priv->ui_id, /* TODO: this should probably be passed from the call * window, seeing that it's a reference to * empathy-call-window.ui. */ "/menubar1/edit/menumicrophone", name, name, GTK_UI_MANAGER_MENUITEM, FALSE); } }
static void eex_folder_subscribe_cb (GtkAction *action, EShellView *shell_view) { const gchar *name; name = gtk_action_get_name (action); g_return_if_fail (name != NULL); name = strrchr (name, '-'); g_return_if_fail (name != NULL && *name == '-'); call_folder_subscribe (name + 1); }
static void browser_tooltips (void) { MidoriBrowser* browser; GtkActionGroup* action_group; GList* actions; gchar* toolbar; guint errors = 0; browser = midori_browser_new (); action_group = midori_browser_get_action_group (browser); actions = gtk_action_group_list_actions (action_group); toolbar = g_strjoinv (" ", (gchar**)midori_browser_get_toolbar_actions (browser)); while (actions) { GtkAction* action = actions->data; const gchar* name = gtk_action_get_name (action); if (strstr ("CompactMenu Location Separator", name)) { actions = g_list_next (actions); continue; } if (strstr (toolbar, name) != NULL) { if (!gtk_action_get_tooltip (action)) { printf ("'%s' can be toolbar item but tooltip is unset\n", name); errors++; } } else { if (gtk_action_get_tooltip (action)) { printf ("'%s' is no toolbar item but tooltip is set\n", name); errors++; } } actions = g_list_next (actions); } g_free (toolbar); g_list_free (actions); gtk_widget_destroy (GTK_WIDGET (browser)); if (errors) g_error ("Tooltip errors"); }
const char * _moo_action_get_display_name (gpointer action) { const char *display_name; g_return_val_if_fail (MOO_IS_ACTION_BASE (action), NULL); display_name = get_string (action, "moo-action-display-name"); if (!display_name) display_name = gtk_action_get_name (GTK_ACTION (action)); return display_name; }