本文整理汇总了C++中GTK_ACTION函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_ACTION函数的具体用法?C++ GTK_ACTION怎么用?C++ GTK_ACTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_ACTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: git_delete_branches_pane_init
static void
git_delete_branches_pane_init (GitDeleteBranchesPane *self)
{
gchar *objects[] = {"delete_branches_pane",
"ok_action",
"cancel_action",
NULL};
GError *error = NULL;
GtkAction *ok_action;
GtkAction *cancel_action;
self->priv = g_new0 (GitDeleteBranchesPanePriv, 1);
self->priv->builder = gtk_builder_new ();
if (!gtk_builder_add_objects_from_file (self->priv->builder, BUILDER_FILE,
objects,
&error))
{
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
}
ok_action = GTK_ACTION (gtk_builder_get_object (self->priv->builder,
"ok_action"));
cancel_action = GTK_ACTION (gtk_builder_get_object (self->priv->builder,
"cancel_action"));
g_signal_connect (G_OBJECT (ok_action), "activate",
G_CALLBACK (on_ok_action_activated),
self);
g_signal_connect_swapped (G_OBJECT (cancel_action), "activate",
G_CALLBACK (git_pane_remove_from_dock),
self);
}
示例2: activate_plugin
static gboolean activate_plugin(AnjutaPlugin *plugin) {
AnjutaUI *ui;
PlaylistDisplayPlugin *playlist_display_plugin;
GtkActionGroup* action_group;
GtkAction *new_playlist_action;
GtkAction *load_ipods_action;
/* Set preferences */
set_default_preferences();
/* Prepare the icons for the playlist */
register_icon_path(get_plugin_dir(), "playlist_display");
register_stock_icon(PREFERENCE_ICON, PREFERENCE_ICON_STOCK_ID);
register_stock_icon("playlist_display-photo", PLAYLIST_DISPLAY_PHOTO_ICON_STOCK_ID);
register_stock_icon("playlist_display-playlist", PLAYLIST_DISPLAY_PLAYLIST_ICON_STOCK_ID);
register_stock_icon("playlist_display-read", PLAYLIST_DISPLAY_READ_ICON_STOCK_ID);
register_stock_icon("playlist_display-add-dirs", PLAYLIST_DISPLAY_ADD_DIRS_ICON_STOCK_ID);
register_stock_icon("playlist_display-add-files", PLAYLIST_DISPLAY_ADD_FILES_ICON_STOCK_ID);
register_stock_icon("playlist_display-add-playlists", PLAYLIST_DISPLAY_ADD_PLAYLISTS_ICON_STOCK_ID);
register_stock_icon("playlist_display-sync", PLAYLIST_DISPLAY_SYNC_ICON_STOCK_ID);
playlist_display_plugin = (PlaylistDisplayPlugin*) plugin;
ui = anjuta_shell_get_ui(plugin->shell, NULL);
/* Add our playlist_actions */
action_group
= anjuta_ui_add_action_group_entries(ui, "ActionGroupPlaylistDisplay", _("Playlist Display"), playlist_actions, G_N_ELEMENTS (playlist_actions), GETTEXT_PACKAGE, TRUE, plugin);
playlist_display_plugin->action_group = action_group;
new_playlist_action = tool_menu_action_new (ACTION_NEW_PLAYLIST, _("New Playlist"), _("Create a new playlist for the selected iPod"), GTK_STOCK_NEW);
g_signal_connect(new_playlist_action, "activate", G_CALLBACK(on_new_playlist_activate), NULL);
gtk_action_group_add_action (playlist_display_plugin->action_group, GTK_ACTION (new_playlist_action));
load_ipods_action = tool_menu_action_new (ACTION_DISPLAY_LOAD_IPODS, _("Load iPods"), _("Load all or selected iPods"), PLAYLIST_DISPLAY_READ_ICON_STOCK_ID);
g_signal_connect(load_ipods_action, "activate", G_CALLBACK(on_load_ipods_mi), NULL);
gtk_action_group_add_action (playlist_display_plugin->action_group, GTK_ACTION (load_ipods_action));
/* Merge UI */
gchar *uipath = g_build_filename(get_ui_dir(), "playlist_display.ui", NULL);
playlist_display_plugin->uiid = anjuta_ui_merge(ui, uipath);
g_free(uipath);
playlist_display_plugin->playlist_view = pm_create_playlist_view(action_group);
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_ADDED, G_CALLBACK (playlist_display_playlist_added_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_REMOVED, G_CALLBACK (playlist_display_playlist_removed_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_ADDED, G_CALLBACK (playlist_display_itdb_added_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_REMOVED, G_CALLBACK (playlist_display_itdb_removed_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_UPDATED, G_CALLBACK (playlist_display_update_itdb_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_PREFERENCE_CHANGE, G_CALLBACK (playlist_display_preference_changed_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_DATA_CHANGED, G_CALLBACK (playlist_display_itdb_data_changed_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_DATA_SAVED, G_CALLBACK (playlist_display_itdb_data_changed_cb), NULL);
gtk_widget_show_all(playlist_display_plugin->playlist_view);
// Add widget directly as scrolling is handled internally by the widget
anjuta_shell_add_widget(plugin->shell, playlist_display_plugin->playlist_view, "PlaylistDisplayPlugin", _(" iPod Repositories"), PLAYLIST_DISPLAY_PLAYLIST_ICON_STOCK_ID, ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
return TRUE; /* FALSE if activation failed */
}
示例3: glide_window_slide_changed_cb
static void
glide_window_slide_changed_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
GlideWindow *w = (GlideWindow *) user_data;
GlideSlide *s = glide_document_get_nth_slide (w->priv->document,
glide_stage_manager_get_current_slide (w->priv->manager));
gint i;
glide_window_update_slide_label (w);
glide_window_animation_box_set_animation (w, glide_slide_get_animation (s));
i = glide_stage_manager_get_current_slide (w->priv->manager);
gtk_action_set_sensitive (GTK_ACTION (GLIDE_WINDOW_UI_OBJECT (w, "next-slide-action")), TRUE);
gtk_action_set_sensitive (GTK_ACTION (GLIDE_WINDOW_UI_OBJECT (w, "prev-slide-action")), TRUE);
if (i + 1 >= glide_document_get_n_slides (w->priv->document))
{
gtk_action_set_sensitive (GTK_ACTION (GLIDE_WINDOW_UI_OBJECT (w, "next-slide-action")), FALSE);
}
if (i == 0)
{
gtk_action_set_sensitive (GTK_ACTION (GLIDE_WINDOW_UI_OBJECT (w, "prev-slide-action")), FALSE);
}
}
示例4: actions_toggle_add
void
actions_toggle_add(GtkActionGroup *act_group, const struct _actionhooks *ahs,
int count)
{
int i;
GtkToggleAction *action;
char *nel = malloc(max_path);
for (i = 0; i < count; i++) {
char *label = gettext(ahs[i].label);
action = gtk_toggle_action_new(ahs[i].name,
label, ahs[i].tooltip == NULL ? label :
gettext(ahs[i].tooltip),
ahs[i].icon == NULL ? ahs[i].name : ahs[i].icon);
sprintf(nel, "<Actions>/actions/%s", ahs[i].name);
gtk_action_set_accel_path(GTK_ACTION(action), nel);
//gtk_action_connect_accelerator(action);
g_signal_connect(G_OBJECT(action), "activate",
ahs[i].handler,
GINT_TO_POINTER(ahs[i].parameter));
gtk_action_group_add_action_with_accel(act_group,
GTK_ACTION(action),
NULL);
}
free(nel);
}
示例5: update_discoverability
static void
update_discoverability (GtkTreeIter *iter)
{
gboolean discoverable;
GObject *object;
/* Avoid loops from changing the UI */
if (discover_lock != FALSE)
return;
discover_lock = TRUE;
object = gtk_builder_get_object (xml, "discoverable");
if (iter == NULL) {
discover_lock = FALSE;
gtk_action_set_visible (GTK_ACTION (object), FALSE);
return;
}
gtk_tree_model_get (devices_model, iter,
BLUETOOTH_COLUMN_DISCOVERABLE, &discoverable,
-1);
gtk_action_set_visible (GTK_ACTION (object), TRUE);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (object), discoverable);
discover_lock = FALSE;
}
示例6: nemo_action_set_tt
void
nemo_action_set_tt (NemoAction *action, NemoFile *file)
{
const gchar *orig_tt = nemo_action_get_orig_tt (action);
if (!test_string_for_label_token (orig_tt) || file == NULL ||
action->selection_type != SELECTION_SINGLE) {
gtk_action_set_tooltip (GTK_ACTION (action), orig_tt);
return;
}
gchar *display_name = nemo_file_get_display_name (file);
gchar **split = g_strsplit (orig_tt, TOKEN_LABEL_FILE_NAME, 2);
gchar *new_tt = g_strconcat (split[0], display_name, split[1], NULL);
gchar *escaped = eel_str_double_underscores (new_tt);
gtk_action_set_tooltip (GTK_ACTION (action), escaped);
g_strfreev (split);
g_free (display_name);
g_free (new_tt);
g_free (escaped);
}
示例7: build_menu
static void
build_menu (NemoBlankDesktopWindow *window)
{
if (window->details->popup_menu) {
return;
}
NemoActionManager *desktop_action_manager = nemo_desktop_manager_get_action_manager ();
if (window->details->actions_changed_id == 0) {
window->details->actions_changed_id = g_signal_connect_swapped (desktop_action_manager,
"changed",
G_CALLBACK (actions_changed_cb),
window);
}
GList *action_list = nemo_action_manager_list_actions (desktop_action_manager);
if (g_list_length (action_list) == 0)
return;
window->details->popup_menu = gtk_menu_new ();
gboolean show;
g_object_get (gtk_settings_get_default (), "gtk-menu-images", &show, NULL);
gtk_menu_attach_to_widget (GTK_MENU (window->details->popup_menu),
GTK_WIDGET (window),
NULL);
GtkWidget *item;
GList *l;
NemoAction *action;
for (l = action_list; l != NULL; l = l->next) {
action = l->data;
if (action->show_in_blank_desktop && action->dbus_satisfied) {
gchar *label = nemo_action_get_label (action, NULL, NULL);
item = gtk_image_menu_item_new_with_mnemonic (label);
g_free (label);
const gchar *stock_id = gtk_action_get_stock_id (GTK_ACTION (action));
const gchar *icon_name = gtk_action_get_icon_name (GTK_ACTION (action));
if (stock_id || icon_name) {
GtkWidget *image = stock_id ? gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU) :
gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), show);
}
gtk_widget_set_visible (item, TRUE);
g_signal_connect (item, "activate", G_CALLBACK (action_activated_callback), action);
gtk_menu_shell_append (GTK_MENU_SHELL (window->details->popup_menu), item);
}
}
}
示例8: pragha_system_titlebar_changed_cb
static void
pragha_system_titlebar_changed_cb (PraghaPreferences *preferences, GParamSpec *pspec, PraghaApplication *pragha)
{
PraghaToolbar *toolbar;
GtkWidget *window, *parent, *menubar;
GtkAction *action;
window = pragha_application_get_window (pragha);
toolbar = pragha_application_get_toolbar (pragha);
menubar = pragha_application_get_menubar (pragha);
g_object_ref(toolbar);
parent = gtk_widget_get_parent (GTK_WIDGET(menubar));
if (pragha_preferences_get_system_titlebar (preferences)) {
gtk_widget_hide(GTK_WIDGET(window));
action = pragha_application_get_menu_action (pragha,
"/Menubar/ViewMenu/Fullscreen");
gtk_action_set_sensitive (GTK_ACTION (action), TRUE);
action = pragha_application_get_menu_action (pragha,
"/Menubar/ViewMenu/Playback controls below");
gtk_action_set_sensitive (GTK_ACTION (action), TRUE);
gtk_window_set_titlebar (GTK_WINDOW (window), NULL);
gtk_window_set_title (GTK_WINDOW(window), _("Pragha Music Player"));
gtk_box_pack_start (GTK_BOX(parent), GTK_WIDGET(toolbar),
FALSE, FALSE, 0);
gtk_box_reorder_child(GTK_BOX(parent), GTK_WIDGET(toolbar), 1);
pragha_toolbar_set_style(toolbar, TRUE);
gtk_widget_show(GTK_WIDGET(window));
}
else {
gtk_widget_hide(GTK_WIDGET(window));
pragha_preferences_set_controls_below(preferences, FALSE);
action = pragha_application_get_menu_action (pragha,
"/Menubar/ViewMenu/Fullscreen");
gtk_action_set_sensitive (GTK_ACTION (action), FALSE);
action = pragha_application_get_menu_action (pragha,
"/Menubar/ViewMenu/Playback controls below");
gtk_action_set_sensitive (GTK_ACTION (action), FALSE);
gtk_container_remove (GTK_CONTAINER(parent), GTK_WIDGET(toolbar));
gtk_window_set_titlebar (GTK_WINDOW (window), GTK_WIDGET(toolbar));
pragha_toolbar_set_style(toolbar, FALSE);
gtk_widget_show(GTK_WIDGET(window));
}
g_object_unref(toolbar);
}
示例9: nautilus_window_create_toolbar_action_group
GtkActionGroup *
nautilus_window_create_toolbar_action_group (NautilusWindow *window)
{
NautilusNavigationState *navigation_state;
GtkActionGroup *action_group;
GtkAction *action;
action_group = gtk_action_group_new ("ToolbarActions");
gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
"name", NAUTILUS_ACTION_BACK,
"label", _("_Back"),
"stock_id", GTK_STOCK_GO_BACK,
"tooltip", _("Go to the previous visited location"),
"arrow-tooltip", _("Back history"),
"window", window,
"direction", NAUTILUS_NAVIGATION_DIRECTION_BACK,
"sensitive", FALSE,
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (action_back_callback), window);
gtk_action_group_add_action (action_group, action);
g_object_unref (action);
action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
"name", NAUTILUS_ACTION_FORWARD,
"label", _("_Forward"),
"stock_id", GTK_STOCK_GO_FORWARD,
"tooltip", _("Go to the next visited location"),
"arrow-tooltip", _("Forward history"),
"window", window,
"direction", NAUTILUS_NAVIGATION_DIRECTION_FORWARD,
"sensitive", FALSE,
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (action_forward_callback), window);
gtk_action_group_add_action (action_group, action);
g_object_unref (action);
action = GTK_ACTION
(gtk_toggle_action_new (NAUTILUS_ACTION_SEARCH,
_("Search"),
_("Search documents and folders by name"),
NULL));
gtk_action_group_add_action (action_group, action);
gtk_action_set_icon_name (GTK_ACTION (action), "edit-find-symbolic");
gtk_action_set_is_important (GTK_ACTION (action), TRUE);
g_object_unref (action);
navigation_state = nautilus_window_get_navigation_state (window);
nautilus_navigation_state_add_group (navigation_state, action_group);
return action_group;
}
示例10: killswitch_state_changed
static void
killswitch_state_changed (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
{
GObject *object;
BluetoothApplet *applet = BLUETOOTH_APPLET (gobject);
BluetoothKillswitchState state = bluetooth_applet_get_killswitch_state (applet);
gboolean sensitive = TRUE;
gboolean bstate = FALSE;
const char *label, *status_label;
if (state == BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER) {
object = gtk_builder_get_object (xml, "bluetooth-applet-popup");
gtk_menu_popdown (GTK_MENU (object));
update_icon_visibility ();
return;
}
if (state == BLUETOOTH_KILLSWITCH_STATE_SOFT_BLOCKED) {
label = N_("Turn on Bluetooth");
status_label = N_("Bluetooth: Off");
bstate = FALSE;
} else if (state == BLUETOOTH_KILLSWITCH_STATE_UNBLOCKED) {
label = N_("Turn off Bluetooth");
status_label = N_("Bluetooth: On");
bstate = TRUE;
} else if (state == BLUETOOTH_KILLSWITCH_STATE_HARD_BLOCKED) {
sensitive = FALSE;
label = NULL;
status_label = N_("Bluetooth: Disabled");
} else {
g_assert_not_reached ();
}
object = gtk_builder_get_object (xml, "killswitch-label");
gtk_action_set_label (GTK_ACTION (object), _(status_label));
gtk_action_set_visible (GTK_ACTION (object), TRUE);
object = gtk_builder_get_object (xml, "killswitch");
gtk_action_set_visible (GTK_ACTION (object), sensitive);
gtk_action_set_label (GTK_ACTION (object), _(label));
if (sensitive != FALSE) {
gtk_action_set_label (GTK_ACTION (object), _(label));
g_object_set_data (object, "bt-active", GINT_TO_POINTER (bstate));
}
object = gtk_builder_get_object (xml, "bluetooth-applet-ui-manager");
gtk_ui_manager_ensure_update (GTK_UI_MANAGER (object));
update_icon_visibility ();
}
示例11: games_pause_action_set_is_paused
void
games_pause_action_set_is_paused (GamesPauseAction *action, gboolean is_paused)
{
g_return_if_fail (GAMES_IS_PAUSE_ACTION (action));
if ((action->priv->is_paused && is_paused) || (!action->priv->is_paused && !is_paused))
return;
action->priv->is_paused = is_paused;
if (is_paused)
gtk_action_set_stock_id (GTK_ACTION (action), GAMES_STOCK_RESUME_GAME);
else
gtk_action_set_stock_id (GTK_ACTION (action), GAMES_STOCK_PAUSE_GAME);
g_object_notify (G_OBJECT (action), "is-paused");
g_signal_emit (G_OBJECT (action), signals[STATE_CHANGED], 0);
}
示例12: gtk_builder_new
static GtkWidget *create_popupmenu(void)
{
GObject *object;
GError *error = NULL;
xml = gtk_builder_new ();
if (gtk_builder_add_from_file (xml, "popup-menu.ui", &error) == 0) {
if (error->domain == GTK_BUILDER_ERROR) {
g_warning ("Failed to load popup-menu.ui: %s", error->message);
g_error_free (error);
return NULL;
}
g_error_free (error);
error = NULL;
if (gtk_builder_add_from_file (xml, PKGDATADIR "/popup-menu.ui", &error) == 0) {
g_warning ("Failed to load popup-menu.ui: %s", error->message);
g_error_free (error);
return NULL;
}
}
gtk_builder_connect_signals (xml, NULL);
if (bluetooth_applet_get_killswitch_state (applet) != BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER) {
GObject *object;
object = gtk_builder_get_object (xml, "killswitch-label");
gtk_action_set_visible (GTK_ACTION (object), TRUE);
}
if (option_debug != FALSE) {
GObject *object;
object = gtk_builder_get_object (xml, "quit");
gtk_action_set_visible (GTK_ACTION (object), TRUE);
}
object = gtk_builder_get_object (xml, "bluetooth-applet-ui-manager");
devices_action_group = gtk_action_group_new ("devices-action-group");
gtk_ui_manager_insert_action_group (GTK_UI_MANAGER (object),
devices_action_group, -1);
action_set_bold (GTK_UI_MANAGER (object),
GTK_ACTION (gtk_builder_get_object (xml, "devices-label")),
"/bluetooth-applet-popup/devices-label");
return GTK_WIDGET (gtk_builder_get_object (xml, "bluetooth-applet-popup"));
}
示例13: create_menu_item
static GtkWidget *
create_menu_item (GtkAction* action) {
GtkWidget* menu;
GtkWidget* menu_item;
GList* actions = XDIFF_EXT_SUBMENU_ACTION(action)->actions;
menu = gtk_menu_new ();
while(actions) {
GtkAction* a = GTK_ACTION(actions->data);
if(a != NULL) {
menu_item = gtk_action_create_menu_item(a);
gtk_widget_show(menu_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
} else {
GtkWidget* s = gtk_separator_menu_item_new();
gtk_widget_show(s);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), s);
}
actions = g_list_next(actions);
}
gtk_widget_show(menu);
menu_item = GTK_ACTION_CLASS(parent_class)->create_menu_item(action);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu);
gtk_widget_show(menu_item);
return menu_item;
}
示例14: empathy_mic_menu_add_microphone
static void
empathy_mic_menu_add_microphone (EmpathyMicMenu *self,
const gchar *name,
const gchar *description,
guint source_idx,
gboolean is_monitor)
{
EmpathyMicMenuPrivate *priv = self->priv;
GtkRadioAction *action;
GSList *group;
action = gtk_radio_action_new (name, description, NULL, NULL, source_idx);
gtk_action_group_add_action_with_accel (priv->action_group,
GTK_ACTION (action), NULL);
/* Set MONITOR_KEY on the action to non-NULL if it's a monitor
* because we don't want to show monitors if we can help it. */
if (is_monitor)
{
g_object_set_data (G_OBJECT (action), MONITOR_KEY,
GUINT_TO_POINTER (TRUE));
}
group = gtk_radio_action_get_group (GTK_RADIO_ACTION (priv->anchor_action));
gtk_radio_action_set_group (GTK_RADIO_ACTION (action), group);
g_queue_push_tail (priv->microphones, action);
g_signal_connect (action, "activate",
G_CALLBACK (empathy_mic_menu_activate_cb), self);
}
示例15: rg_remove_action
static VALUE
rg_remove_action(VALUE self, VALUE action)
{
gtk_action_group_remove_action(_SELF(self), GTK_ACTION(RVAL2GOBJ(action)));
G_CHILD_REMOVE(self, action);
return self;
}