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);
}
Example #2
0
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 */
}
Example #3
0
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);
    }
}
Example #4
0
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);
}
Example #5
0
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;
}
Example #6
0
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);
}
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);
        }
    }
}
Example #8
0
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);
}
Example #9
0
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;
}
Example #10
0
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 ();
}
Example #11
0
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);
}
Example #12
0
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"));
}
Example #13
0
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;
}
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);
}
Example #15
0
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;
}
Example #16
0
/**
 * create_game_menus
 * @ap: application pointer
 *
 * Description:
 * Creates the menus for application @ap
 *
 **/
void
create_game_menus (GtkUIManager * ui_manager)
{

  GtkActionGroup *action_group;
  games_stock_init ();

  action_group = gtk_action_group_new ("actions");

  gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
  gtk_action_group_add_actions (action_group, action_entry,
				G_N_ELEMENTS (action_entry), app);
  gtk_action_group_add_toggle_actions (action_group, toggle_action_entry,
				       G_N_ELEMENTS (toggle_action_entry),
				       app);

  gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
  gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, NULL);

  scores_action = gtk_action_group_get_action (action_group, "Scores");
  teleport_action = gtk_action_group_get_action (action_group, "Teleport");
  random_action = gtk_action_group_get_action (action_group, "Random");
  wait_action = gtk_action_group_get_action (action_group, "Wait");
  toolbar_toggle_action =
    gtk_action_group_get_action (action_group, "ShowToolbar");
  fullscreen_action = GTK_ACTION (games_fullscreen_action_new ("Fullscreen", GTK_WINDOW (app)));
  gtk_action_group_add_action_with_accel (action_group, fullscreen_action, NULL);

  return;
}
static void
empathy_mic_menu_microphone_removed_cb (EmpathyMicMonitor *monitor,
    guint source_idx,
    EmpathyMicMenu *self)
{
  EmpathyMicMenuPrivate *priv = self->priv;
  GList *l;

  for (l = priv->microphones->head; l != NULL; l = l->next)
    {
      GtkRadioAction *action = l->data;
      gint value;

      g_object_get (action, "value", &value, NULL);

      if (value != (gint) source_idx)
        {
          action = NULL;
          continue;
        }

      g_signal_handlers_disconnect_by_func (action,
          G_CALLBACK (empathy_mic_menu_activate_cb), self);

      gtk_action_group_remove_action (priv->action_group, GTK_ACTION (action));
      g_queue_remove (priv->microphones, action);
      break;
    }

  empathy_mic_menu_update (self);
}
Example #18
0
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);
}
Example #19
0
File: ui.c Project: samlown/glabels
/*---------------------------------------------------------------------------*/
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, "");
}
Example #20
0
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);
}
Example #21
0
void
_moo_action_set_accel_path (gpointer    action,
                            const char *accel_path)
{
    g_return_if_fail (MOO_IS_ACTION_BASE (action));
    gtk_action_set_accel_path (GTK_ACTION (action), accel_path);
}
Example #22
0
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);
}
Example #23
0
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));
}
Example #24
0
void fixup_labels( GObject *gobject, GParamSpec *arg1, gpointer user_data )
{
    /* TODO: handle 'use-markup' getting changed also */

    if ( arg1 && arg1->name && (strcmp("label", arg1->name) == 0) ) {
        GSList* proxies = gtk_action_get_proxies( GTK_ACTION(gobject) );
        gchar* str = 0;
        g_object_get( gobject, "label", &str, NULL );
        (void)user_data;
        while ( proxies ) {
            if ( GTK_IS_TOOL_ITEM(proxies->data) ) {
                /* Search for the things we built up in create_tool_item() */
                GList* children = gtk_container_get_children( GTK_CONTAINER(proxies->data) );
                if ( children && children->data ) {
                    if ( GTK_IS_HBOX(children->data) ) {
                        children = gtk_container_get_children( GTK_CONTAINER(children->data) );
                        if ( children && g_list_next(children) ) {
                            GtkWidget* child = GTK_WIDGET( g_list_next(children)->data );
                            if ( GTK_IS_LABEL(child) ) {
                                GtkLabel* lbl = GTK_LABEL(child);
                                if ( EGE_OUTPUT_ACTION(gobject)->private_data->useMarkup ) {
                                    gtk_label_set_markup( lbl, str );
                                } else {
                                    gtk_label_set_text( lbl, str );
                                }
                            }
                        }
                    }
                }
            }
            proxies = g_slist_next( proxies );
        }
        g_free( str );
    }
}
Example #25
0
static void
closure_accel_activate (GClosure     *closure,
                        GValue       *return_value,
                        guint         n_param_values,
                        const GValue *param_values,
                        gpointer      invocation_hint,
                        gpointer      marshal_data)
{
  if (gtk_action_is_sensitive (GTK_ACTION (closure->data)))
    {
      _gtk_action_emit_activate (GTK_ACTION (closure->data));
      
      /* we handled the accelerator */
      g_value_set_boolean (return_value, TRUE);
    }
}
Example #26
0
GtkAction *
gnac_ui_utils_get_action(GtkBuilder  *builder,
                         const gchar *action_name)
{
  GObject *object = gnac_ui_utils_get_object(builder, action_name);
  return G_IS_OBJECT(object) ? GTK_ACTION(object) : NULL;
}
Example #27
0
static void
shell_searchbar_option_changed_cb (GtkRadioAction *action,
                                   GtkRadioAction *current,
                                   EShellSearchbar *searchbar)
{
	EShellView *shell_view;
	const gchar *search_text;
	const gchar *label;
	gint current_value;

	shell_view = e_shell_searchbar_get_shell_view (searchbar);

	label = gtk_action_get_label (GTK_ACTION (current));
	e_shell_searchbar_set_search_hint (searchbar, label);

	current_value = gtk_radio_action_get_current_value (current);
	search_text = e_shell_searchbar_get_search_text (searchbar);

	if (current_value != SEARCH_OPTION_ADVANCED) {
		e_shell_view_set_search_rule (shell_view, NULL);
		e_shell_searchbar_set_search_text (searchbar, search_text);
		if (search_text != NULL && *search_text != '\0')
			e_shell_view_execute_search (shell_view);
		else {
			shell_searchbar_save_search_option (searchbar);
			gtk_widget_grab_focus (searchbar->priv->search_entry);
		}

	} else if (search_text != NULL)
		e_shell_searchbar_set_search_text (searchbar, NULL);
}
Example #28
0
static const gchar *
gtk_action_buildable_get_name (GtkBuildable *buildable)
{
  GtkAction *action = GTK_ACTION (buildable);

  return action->private_data->name;
}
Example #29
0
static void
update_discoverability (GObject    *gobject,
                        GParamSpec *pspec,
                        gpointer    user_data)
{
	BluetoothApplet *applet = BLUETOOTH_APPLET (gobject);
	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");

	discoverable = bluetooth_applet_get_discoverable (applet);

#ifndef HAVE_APP_INDICATOR
	gtk_action_set_visible (GTK_ACTION (object), TRUE);
#else
	gtk_action_set_sensitive (GTK_TOGGLE_ACTION (object), TRUE);
#endif
	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (object), discoverable);

	discover_lock = FALSE;
}
Example #30
0
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);
}