Esempio n. 1
0
static GtkUIManager *
create_ui_manager (MduShell *shell)
{
        GtkUIManager *ui_manager;
        GError *error;

        shell->priv->action_group = gtk_action_group_new ("MateDiskUtilityActions");
        gtk_action_group_set_translation_domain (shell->priv->action_group, NULL);
        gtk_action_group_add_actions (shell->priv->action_group, entries, G_N_ELEMENTS (entries), shell);

        /* -------------------------------------------------------------------------------- */

        ui_manager = gtk_ui_manager_new ();
        gtk_ui_manager_insert_action_group (ui_manager, shell->priv->action_group, 0);

        error = NULL;
        if (!gtk_ui_manager_add_ui_from_string
            (ui_manager, ui, -1, &error)) {
                g_message ("Building menus failed: %s", error->message);
                g_error_free (error);
                gtk_main_quit ();
        }

        return ui_manager;
}
Esempio n. 2
0
static GtkWidget*
popup_menu_create (GtkTreeView *treeview)
{
	GtkUIManager   *ui_manager;
	GtkActionGroup *action_group;
	GtkWidget      *popup;

	g_return_val_if_fail (treeview != NULL, NULL);

	action_group = gtk_action_group_new ("MenuActions");
	gtk_action_group_set_translation_domain (action_group, NULL);
	gtk_action_group_add_actions (action_group,
				      popup_menu_items,
				      G_N_ELEMENTS (popup_menu_items), treeview);

	ui_manager = gtk_ui_manager_new ();
	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);

	if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, NULL))
		return NULL;

	popup = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");

	return popup;
}
Esempio n. 3
0
void
ip__gth_browser_construct_cb (GthBrowser *browser)
{
	BrowserData *data;
	GError      *error = NULL;

	g_return_if_fail (GTH_IS_BROWSER (browser));

	data = g_new0 (BrowserData, 1);

	data->action_group = gtk_action_group_new ("Image Print Actions");
	gtk_action_group_set_translation_domain (data->action_group, NULL);
	_gtk_action_group_add_actions_with_flags (data->action_group,
						  action_entries,
						  G_N_ELEMENTS (action_entries),
						  browser);
	gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->action_group, 0);

	data->fixed_merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_info, -1, &error);
	if (data->fixed_merge_id == 0) {
		g_warning ("building ui failed: %s", error->message);
		g_error_free (error);
	}

	g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
Esempio n. 4
0
int vwin_add_ui (windata_t *vwin, GtkActionEntry *entries,
		 gint n_entries, const gchar *ui_info)
{
    GtkActionGroup *actions;
    GError *err = NULL;

    actions = gtk_action_group_new("MyActions");
    gtk_action_group_set_translation_domain(actions, "gretl");

    gtk_action_group_add_actions(actions, entries, n_entries, vwin);

    vwin->ui = gtk_ui_manager_new();
    gtk_ui_manager_insert_action_group(vwin->ui, actions, 0);
    g_object_unref(actions);

    gtk_window_add_accel_group(GTK_WINDOW(vwin->main), 
			       gtk_ui_manager_get_accel_group(vwin->ui));

    gtk_ui_manager_add_ui_from_string(vwin->ui, ui_info, -1, &err);
    if (err != NULL) {
	g_message("building menus failed: %s", err->message);
	g_error_free(err);
    }

    vwin->mbar = gtk_ui_manager_get_widget(vwin->ui, "/menubar");

    return 0;
}
Esempio n. 5
0
int vwin_menu_add_item_unique (windata_t *vwin, 
			       const gchar *aname, 
			       const gchar *path, 
			       GtkActionEntry *entry)
{
    GList *list = gtk_ui_manager_get_action_groups(vwin->ui);
    GtkActionGroup *actions;
    guint id;

    while (list != NULL) {
	GtkActionGroup *group = list->data;

	if (!strcmp(aname, gtk_action_group_get_name(group))) {
	    gtk_ui_manager_remove_action_group(vwin->ui, group);
	    break;
	}
	list = list->next;
    }

    id = gtk_ui_manager_new_merge_id(vwin->ui);
    actions = gtk_action_group_new(aname);
    gtk_action_group_set_translation_domain(actions, "gretl");

    gtk_action_group_add_actions(actions, entry, 1, vwin);
    gtk_ui_manager_add_ui(vwin->ui, id, path, entry->name, entry->name,
			  GTK_UI_MANAGER_MENUITEM, FALSE);

    gtk_ui_manager_insert_action_group(vwin->ui, actions, 0);
    g_object_unref(actions);
	
    return id;
}
Esempio n. 6
0
static void
galeon_encoding_menu_set_window (GaleonEncodingMenu *menu, GaleonWindow *window)
{
	GtkActionGroup *action_group;
	GtkWidget *widget;
	GList *encodings;

	g_return_if_fail (GALEON_IS_WINDOW (window));

	menu->priv->window = window;
	menu->priv->merge  = GTK_UI_MANAGER (window->merge);

	action_group = gtk_action_group_new ("EncodingActions");
	gtk_action_group_set_translation_domain (action_group, NULL);
	menu->priv->action_group = action_group;

	gtk_action_group_add_actions (action_group, menu_entries,
				      n_menu_entries, menu);
	gtk_action_group_add_toggle_actions (action_group, toggle_menu_entries,
                                    	     n_toggle_menu_entries, menu);

	encodings = galeon_encodings_get_encodings (menu->priv->encodings, LG_ALL);
	g_list_foreach (encodings, (GFunc) add_action, menu);
	g_list_free (encodings);

	gtk_ui_manager_insert_action_group (menu->priv->merge,
					    action_group, 0);
	g_object_unref (action_group);

	widget = gtk_ui_manager_get_widget (menu->priv->merge,
					    "/menubar/View");
	g_signal_connect_object (widget, "activate",
				 G_CALLBACK (update_encoding_menu_cb),
				 menu, 0);
}
Esempio n. 7
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
install_menu (PlumaWindow *window)
{
	GtkUIManager *manager;
	WindowData *data = BOOKMARKS_DATA (window);
	GError *error = NULL;

	manager = pluma_window_get_ui_manager (window);
	data->action_group = gtk_action_group_new ("PlumaBookmarksPluginActions");

	gtk_action_group_set_translation_domain (data->action_group,
						 GETTEXT_PACKAGE);

	gtk_action_group_add_actions (data->action_group,
				      action_entries,
				      G_N_ELEMENTS (action_entries),
				      window);

	gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
	data->ui_id = gtk_ui_manager_add_ui_from_string (manager, uidefinition, -1, &error);

	if (!data->ui_id)
	{
		g_warning ("Could not load UI: %s", error->message);
		g_error_free (error);
	}
}
Esempio n. 9
0
static void
sheet_item_init (SheetItem *item)
{
	GError *error = NULL;

	item->priv = g_new0 (SheetItemPriv, 1);
	item->priv->selected = FALSE;
	item->priv->preserve_selection = FALSE;
	item->priv->data = NULL;
	item->priv->ui_manager = NULL;
	item->priv->action_group = NULL;

	item->priv->ui_manager = gtk_ui_manager_new ();
	item->priv->action_group = gtk_action_group_new ("action_group");
	gtk_action_group_set_translation_domain (item->priv->action_group, 
	                 GETTEXT_PACKAGE);
	gtk_action_group_add_actions (item->priv->action_group,
                     action_entries, G_N_ELEMENTS (action_entries), NULL);
	gtk_ui_manager_insert_action_group (item->priv->ui_manager, 
	                 item->priv->action_group, 0);
	
	if (!gtk_ui_manager_add_ui_from_string (item->priv->ui_manager, 
	                 sheet_item_context_menu, -1, &error)) {
		g_message ("building menus failed: %s", error->message);
		g_error_free (error);
	}
}
/**
 * gpm_applet_cb:
 * @_applet: GpmInhibitApplet instance created by the applet factory
 * @iid: Applet id
 *
 * the function called by libmate-panel-applet factory after creation
 **/
static gboolean
gpm_applet_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data)
{
	GpmInhibitApplet *applet = GPM_INHIBIT_APPLET(_applet);
	GtkActionGroup *action_group;
	gchar *ui_path;

	static const GtkActionEntry menu_actions [] = {
		{ "About", GTK_STOCK_ABOUT, N_("_About"),
		  NULL, NULL,
		  G_CALLBACK (gpm_applet_dialog_about_cb) },
		{ "Help", GTK_STOCK_HELP, N_("_Help"),
		  NULL, NULL,
		  G_CALLBACK (gpm_applet_help_cb) }
	};

	if (strcmp (iid, GPM_INHIBIT_APPLET_ID) != 0) {
		return FALSE;
	}

	action_group = gtk_action_group_new ("Inhibit Applet Actions");
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (action_group,
				      menu_actions,
				      G_N_ELEMENTS (menu_actions),
				      applet);
	ui_path = g_build_filename (INHIBIT_MENU_UI_DIR, "inhibit-applet-menu.xml", NULL);
	mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet), ui_path, action_group);
	g_free (ui_path);
	g_object_unref (action_group);

	gpm_applet_draw_cb (applet);
	return TRUE;
}
Esempio n. 11
0
void
db__gth_browser_construct_cb (GthBrowser *browser)
{
	BrowserData *data;
	GError      *error = NULL;

	g_return_if_fail (GTH_IS_BROWSER (browser));

	data = g_new0 (BrowserData, 1);
	data->action_group = gtk_action_group_new ("Desktop Background Actions");
	gtk_action_group_set_translation_domain (data->action_group, NULL);
	gtk_action_group_add_actions (data->action_group,
				      action_entries,
				      G_N_ELEMENTS (action_entries),
				      browser);
	gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->action_group, 0);

	if (! gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_info, -1, &error)) {
		g_message ("building menus failed: %s", error->message);
		g_clear_error (&error);
	}

	gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/FileListPopup/Screen_Actions/DesktopBackground")), TRUE);
	gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/FilePopup/Screen_Actions/DesktopBackground")), TRUE);

	g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
Esempio n. 12
0
/* create the popup menu */
static void
_dtv_create_popup_menu (DiagramTreeView *dtv)
{
  static GtkActionEntry menu_items [] = {
    { "Select",  NULL, N_("Select"), NULL, NULL, G_CALLBACK (_dtv_select_items) },
    { "Locate",  NULL, N_("Locate"), NULL, NULL, G_CALLBACK (_dtv_locate_item) },
    { "Properties", NULL, N_("Properties"), NULL, NULL, G_CALLBACK(_dtv_showprops_item) }
  };
  static const gchar *ui_description =
    "<ui>"
    "  <popup name='PopupMenu'>"
    "    <menuitem action='Select'/>"
    "    <menuitem action='Locate'/>"
    "    <menuitem action='Properties'/>"
    "  </popup>"
    "</ui>";
  GtkActionGroup *action_group;

  g_return_if_fail (dtv->popup == NULL && dtv->ui_manager == NULL);

  action_group = gtk_action_group_new ("PopupActions");
  gtk_action_group_set_translation_domain (action_group, NULL); /* FIXME? */
  gtk_action_group_add_actions (action_group, menu_items,
				G_N_ELEMENTS (menu_items), dtv);

  dtv->ui_manager = gtk_ui_manager_new ();
  gtk_ui_manager_insert_action_group (dtv->ui_manager, action_group, 0);
  if (gtk_ui_manager_add_ui_from_string (dtv->ui_manager, ui_description, -1, NULL))
    dtv->popup = GTK_MENU(gtk_ui_manager_get_widget (dtv->ui_manager, "/ui/PopupMenu"));
}
Esempio n. 13
0
static 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_ui_manager_insert_action_group (ui_manager, action_group, 0);
  gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, NULL);

  gtk_window_add_accel_group (GTK_WINDOW (app),
			      gtk_ui_manager_get_accel_group (ui_manager));

  new_game_action = gtk_action_group_get_action (action_group, "NewGame");

  hint_action = gtk_action_group_get_action (action_group, "Hint");
  undo_action = gtk_action_group_get_action (action_group, "UndoMove");
  fullscreen_action = GTK_ACTION (games_fullscreen_action_new ("Fullscreen", GTK_WINDOW (app)));
  gtk_action_group_add_action_with_accel (action_group, fullscreen_action, NULL);
}
Esempio n. 14
0
static void
usage_view_activate (PlannerView *view)
{
	PlannerUsageViewPriv *priv;
	gchar		     *filename;

	priv = PLANNER_USAGE_VIEW (view)->priv;

	priv->actions = gtk_action_group_new ("TimeTableView");
	gtk_action_group_set_translation_domain (priv->actions, GETTEXT_PACKAGE);

	gtk_action_group_add_actions (priv->actions, entries, G_N_ELEMENTS (entries), view);

	gtk_ui_manager_insert_action_group (priv->ui_manager, priv->actions, 0);
	filename = mrp_paths_get_ui_dir ("time-table-view.ui");
	priv->merged_id = gtk_ui_manager_add_ui_from_file (priv->ui_manager,
							   filename,
							   NULL);
	g_free (filename);
	gtk_ui_manager_ensure_update (priv->ui_manager);

        usage_view_update_zoom_sensitivity (view);

	gtk_widget_grab_focus (priv->tree);
}
void 
nautilus_navigation_window_initialize_actions (NautilusNavigationWindow *window)
{
	GtkActionGroup *action_group;
	GtkUIManager *ui_manager;
	GtkAction *action;
	
	action_group = gtk_action_group_new ("NavigationActions");
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
	window->details->navigation_action_group = action_group;
	gtk_action_group_add_actions (action_group, 
				      navigation_entries, G_N_ELEMENTS (navigation_entries),
				      window);
	gtk_action_group_add_toggle_actions (action_group, 
					     navigation_toggle_entries, G_N_ELEMENTS (navigation_toggle_entries),
					     window);

	action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
			       "name", "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,
			       "is_important", TRUE,
			       NULL);
	g_signal_connect (action, "activate",
			  G_CALLBACK (action_back_callback), window);
	gtk_action_group_add_action_with_accel (action_group,
						action,
						"<alt>Left");
	g_object_unref (action);

	action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
			       "name", "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,
			       "is_important", TRUE,
			       NULL);
	g_signal_connect (action, "activate",
			  G_CALLBACK (action_forward_callback), window);
	gtk_action_group_add_action_with_accel (action_group,
						action,
						"<alt>Right");

	g_object_unref (action);

	action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_SEARCH);
	g_object_set (action, "short_label", _("_Search"), NULL);

	ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));

	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
	g_object_unref (action_group); /* owned by ui_manager */
}
Esempio n. 16
0
static void
eog_reload_plugin_activate (EogWindowActivatable *activatable)
{
	GtkUIManager *manager;
	EogReloadPlugin *plugin = EOG_RELOAD_PLUGIN (activatable);

	eog_debug (DEBUG_PLUGINS);

	manager = eog_window_get_ui_manager (plugin->window);

	plugin->ui_action_group = gtk_action_group_new ("EogReloadPluginActions");

	gtk_action_group_set_translation_domain (plugin->ui_action_group,
						 GETTEXT_PACKAGE);

	gtk_action_group_add_actions (plugin->ui_action_group,
				      action_entries,
				      G_N_ELEMENTS (action_entries),
				      plugin->window);

	gtk_ui_manager_insert_action_group (manager,
					    plugin->ui_action_group,
					    -1);

	plugin->ui_id = gtk_ui_manager_add_ui_from_string (manager,
							   ui_definition,
							   -1, NULL);
	g_warn_if_fail (plugin->ui_id != 0);
}
static TargetCallbackData *
initialize_clipboard_component_with_callback_data (GtkEditable *target,
        GtkUIManager *ui_manager,
        gboolean shares_selection_changes,
        SelectAllCallback select_all_callback,
        ConnectCallbacksFunc connect_callbacks,
        ConnectCallbacksFunc disconnect_callbacks)
{
    GtkActionGroup *action_group;
    TargetCallbackData *target_data;

    action_group = gtk_action_group_new ("ClipboardActions");
    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
    gtk_action_group_add_actions (action_group,
                                  clipboard_entries, G_N_ELEMENTS (clipboard_entries),
                                  target);

    /* Do the actual connection of the UI to the container at
     * focus time, and disconnect at both focus and destroy
     * time.
     */
    target_data = g_new (TargetCallbackData, 1);
    target_data->ui_manager = ui_manager;
    target_data->action_group = action_group;
    target_data->shares_selection_changes = shares_selection_changes;
    target_data->select_all_callback = select_all_callback;
    target_data->connect_callbacks = connect_callbacks;
    target_data->disconnect_callbacks = disconnect_callbacks;

    return target_data;
}
Esempio n. 18
0
static void
gam_app_init (GamApp *gam_app)
{
    GamAppPrivate *priv;

    g_return_if_fail (GAM_IS_APP (gam_app));

    priv = GAM_APP_GET_PRIVATE (gam_app);

    priv->gconf_client = gconf_client_get_default ();
    /*gconf_client_add_dir (priv->gconf_client,
                          "/apps/PAW/PAWed/preferences",
                          GCONF_CLIENT_PRELOAD_NONE,
                          NULL);*/

    priv->ui_manager = gtk_ui_manager_new ();
    priv->ui_accel_group = gtk_ui_manager_get_accel_group (priv->ui_manager);

    priv->main_action_group = gtk_action_group_new ("MainActions");

#ifdef ENABLE_NLS
    gtk_action_group_set_translation_domain (priv->main_action_group, GETTEXT_PACKAGE);
#endif

    priv->status_bar = gtk_statusbar_new ();
    priv->tip_message_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (priv->status_bar),
                                                          "GamAppToolTips");

    priv->notebook = gtk_notebook_new ();
    gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
    gtk_notebook_set_tab_pos (GTK_NOTEBOOK (priv->notebook), GTK_POS_TOP);
    priv->view_mixers_cb_active=TRUE;
}
Esempio n. 19
0
File: menus.c Progetto: GNOME/dia
static GtkActionGroup *
create_or_ref_display_actions (gboolean include_common)
{
  if (display_actions)
    return g_object_ref (display_actions);
  display_actions = gtk_action_group_new ("display-actions");
  gtk_action_group_set_translation_domain (display_actions, NULL);
  gtk_action_group_set_translate_func (display_actions, _dia_translate, NULL, NULL);
  if (include_common)
    gtk_action_group_add_actions (display_actions, common_entries,
                  G_N_ELEMENTS (common_entries), NULL);
  gtk_action_group_add_actions (display_actions, display_entries,
                G_N_ELEMENTS (display_entries), NULL);
  gtk_action_group_add_toggle_actions (display_actions, display_toggle_entries,
                G_N_ELEMENTS (display_toggle_entries),
                NULL);
  gtk_action_group_add_radio_actions (display_actions,
                display_select_radio_entries,
                G_N_ELEMENTS (display_select_radio_entries),
                0, /* SELECT_REPLACE - first radio entry */
                G_CALLBACK (select_style_callback),
                NULL);
  /* the initial reference */
  return display_actions;
}
Esempio n. 20
0
static gboolean
gdict_applet_factory (MatePanelApplet *applet,
                      const gchar *iid,
		      gpointer     data)
{
  gboolean retval = FALSE;
  gchar *ui_path;
  GdictApplet *dictionary_applet = GDICT_APPLET (applet);
  GdictAppletPrivate *priv = dictionary_applet->priv;

  if (((!strcmp (iid, "DictionaryApplet"))) && gdict_create_data_dir ())
    {
      /* Set up the menu */
      priv->context_menu_action_group = gtk_action_group_new ("Dictionary Applet Actions");
      gtk_action_group_set_translation_domain(priv->context_menu_action_group,
                                              GETTEXT_PACKAGE);
      gtk_action_group_add_actions(priv->context_menu_action_group,
								gdict_applet_menu_actions,
								G_N_ELEMENTS (gdict_applet_menu_actions),
								applet);
      ui_path = g_build_filename(PKGDATADIR, "dictionary-applet-menu.xml", NULL);
      mate_panel_applet_setup_menu_from_file (applet, ui_path,
                                              priv->context_menu_action_group);
      g_free (ui_path);

      gtk_widget_show (GTK_WIDGET (applet));

      /* set the menu items insensitive */
      gdict_applet_set_menu_items_sensitive (dictionary_applet, FALSE);
      
      retval = TRUE;
    }

  return retval;
}
Esempio n. 21
0
static void
create_menus (GtkUIManager * ui_manager)
{
  GtkActionGroup *action_group;

  action_group = gtk_action_group_new ("MenuActions");

  gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
  gtk_action_group_add_actions (action_group, action_entry,
                                G_N_ELEMENTS (action_entry), window);

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

  new_game_action = gtk_action_group_get_action (action_group, "NewGame");
  scores_action = gtk_action_group_get_action (action_group, "Scores");
  end_game_action = gtk_action_group_get_action (action_group, "EndGame");
  pause_action = gtk_action_group_get_action (action_group, "Pause");
  resume_action = gtk_action_group_get_action (action_group, "Resume");

  preferences_action = gtk_action_group_get_action (action_group,
                                                    "Preferences");
  fullscreen_action = gtk_action_group_get_action (action_group,
                                                   "Fullscreen");
  leave_fullscreen_action = gtk_action_group_get_action (action_group,
                                                         "LeaveFullscreen");
  new_network_action = gtk_action_group_get_action (action_group,
                                                    "NewNetworkGame");
#ifndef GGZ_CLIENT
  gtk_action_set_sensitive (new_network_action, FALSE);
#endif
  player_list_action = gtk_action_group_get_action (action_group, "PlayerList");

}
Esempio n. 22
0
void
edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
{
	BrowserData *data;
	GError      *error = NULL;

	g_return_if_fail (GTH_IS_BROWSER (browser));

	data = g_new0 (BrowserData, 1);
	data->browser = browser;

	data->actions = gtk_action_group_new ("Edit Metadata Actions");
	gtk_action_group_set_translation_domain (data->actions, NULL);
	_gtk_action_group_add_actions_with_flags (data->actions,
						  edit_metadata_action_entries,
						  G_N_ELEMENTS (edit_metadata_action_entries),
						  browser);
	gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->actions, 0);

	if (! gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_info, -1, &error)) {
		g_message ("building menus failed: %s", error->message);
		g_error_free (error);
	}

	if (gth_main_extension_is_active ("list_tools") && ! gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_file_tools_info, -1, &error)) {
		g_message ("building menus failed: %s", error->message);
		g_error_free (error);
	}

	g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
Esempio n. 23
0
static GtkActionGroup *get_named_group (GtkUIManager *uim,
					const char *name, 
					int *newgroup)
{
    GList *list = gtk_ui_manager_get_action_groups(uim); 
    GtkActionGroup *actions = NULL;

    while (list != NULL) {
	GtkActionGroup *group = list->data;

	if (!strcmp(gtk_action_group_get_name(group), name)) {
	    actions = group;
	    break;
	}
	list = list->next;
    } 

    if (actions == NULL) {
	actions = gtk_action_group_new(name);
	gtk_action_group_set_translation_domain(actions, "gretl");
	*newgroup = 1;
    } else {
	*newgroup = 0;
    }

    return actions;
}
Esempio n. 24
0
//==============================================================================
// PRIVATE METHODS							       =
//==============================================================================
static void merge_ui_def(GebrGuiHelpEditWindow * window, gboolean revert_visible)
{
    GtkActionGroup * action_group;
    GtkUIManager * ui_manager;
    GtkAction * action;
    GError * error = NULL;
    gchar * path;

    ui_manager = gebr_gui_help_edit_window_get_ui_manager(window);

    action_group = gtk_action_group_new("DebrHelpEditGroup");
    gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
    gtk_action_group_add_actions(action_group, action_entries, n_action_entries, window);
    action = gtk_action_group_get_action(action_group, "JumpToMenu");
    g_object_set(action, "hide-if-empty", FALSE, NULL);
    action = gtk_action_group_get_action(action_group, "RevertAction");
    gtk_action_set_sensitive(action, revert_visible);

    gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
    gtk_ui_manager_add_ui_from_string(ui_manager, ui_def, -1, &error);
    g_object_unref(action_group);

    path = g_strconcat (gebr_gui_help_edit_window_get_tool_bar_mark (window),
                        "/PreviewAction",
                        NULL);
    action = gtk_ui_manager_get_action (ui_manager, path);
    g_signal_connect (action, "toggled", G_CALLBACK (on_preview_toggled), window);
    g_free (path);

    if (error != NULL) {
        g_warning("%s\n", error->message);
        g_clear_error(&error);
    }
}
Esempio n. 25
0
static VALUE
rg_set_translation_domain(VALUE self, VALUE domain)
{
    gtk_action_group_set_translation_domain(_SELF(self), 
                                            NIL_P(domain) ? (const gchar*)NULL : RVAL2CSTR(domain));
    return self;
}
static GObject* 
seahorse_gkr_keyring_commands_constructor (GType type, guint n_props, GObjectConstructParam *props) 
{
	SeahorseGkrKeyringCommands *self = SEAHORSE_GKR_KEYRING_COMMANDS (G_OBJECT_CLASS (seahorse_gkr_keyring_commands_parent_class)->constructor (type, n_props, props));
	GtkActionGroup *actions;
	SeahorseView *view;
	
	g_return_val_if_fail (SEAHORSE_IS_GKR_KEYRING_COMMANDS (self), NULL);
	
	view = seahorse_commands_get_view (SEAHORSE_COMMANDS (self));
	g_return_val_if_fail (view, NULL);
	seahorse_view_register_commands (view, &keyring_predicate, SEAHORSE_COMMANDS (self));

	actions = gtk_action_group_new ("gkr-keyring");
	gtk_action_group_set_translation_domain (actions, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (actions, ENTRIES_KEYRING, G_N_ELEMENTS (ENTRIES_KEYRING), self);
	seahorse_view_register_ui (view, &keyring_predicate, UI_KEYRING, actions);
	self->pv->action_lock = g_object_ref (gtk_action_group_get_action (actions, "keyring-lock"));
	self->pv->action_unlock = g_object_ref (gtk_action_group_get_action (actions, "keyring-unlock"));
	self->pv->action_default = g_object_ref (gtk_action_group_get_action (actions, "keyring-default"));
	g_object_unref (actions);
	
	/* Watch and wait for selection changes and diddle lock/unlock */ 
	g_signal_connect (view, "selection-changed", G_CALLBACK (on_view_selection_changed), self);

	return G_OBJECT (self);
}
Esempio n. 27
0
static gboolean accessx_status_applet_fill(MatePanelApplet* applet)
{
    AccessxStatusApplet* sapplet;
    AtkObject* atk_object;
    GtkActionGroup* action_group;
    gchar* ui_path;
    gboolean was_realized = FALSE;

    sapplet = create_applet(applet);

    if (!gtk_widget_get_realized(sapplet->box))
    {
        g_signal_connect_after(G_OBJECT(sapplet->box), "realize", G_CALLBACK(accessx_status_applet_realize), sapplet);
    }
    else
    {
        accessx_status_applet_initialize(sapplet);
        was_realized = TRUE;
    }

    g_object_connect(sapplet->applet,
                     "signal::destroy", accessx_status_applet_destroy, sapplet,
                     "signal::change_orient", accessx_status_applet_reorient, sapplet,
                     "signal::change_size", accessx_status_applet_resize, sapplet,
                     NULL);

    g_signal_connect(sapplet->applet, "button_press_event", G_CALLBACK(button_press_cb), sapplet);
    g_signal_connect(sapplet->applet, "key_press_event", G_CALLBACK(key_press_cb), sapplet);

    action_group = gtk_action_group_new("Accessx Applet Actions");
    gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
    gtk_action_group_add_actions(action_group, accessx_status_applet_menu_actions, G_N_ELEMENTS(accessx_status_applet_menu_actions), sapplet);
    ui_path = g_build_filename(ACCESSX_MENU_UI_DIR, "accessx-status-applet-menu.xml", NULL);
    mate_panel_applet_setup_menu_from_file(sapplet->applet, ui_path, action_group);
    g_free(ui_path);

    if (mate_panel_applet_get_locked_down(sapplet->applet))
    {
        GtkAction* action = gtk_action_group_get_action(action_group, "Dialog");
        gtk_action_set_visible(action, FALSE);
    }

    g_object_unref(action_group);

    gtk_widget_set_tooltip_text(GTK_WIDGET(sapplet->applet), _("Keyboard Accessibility Status"));

    atk_object = gtk_widget_get_accessible(GTK_WIDGET(sapplet->applet));
    atk_object_set_name(atk_object, _("AccessX Status"));
    atk_object_set_description(atk_object, _("Displays current state of keyboard accessibility features"));
    gtk_widget_show_all(GTK_WIDGET(sapplet->applet));

    if (was_realized)
    {
        accessx_status_applet_reset(sapplet);
    }

    mate_panel_applet_set_background_widget (sapplet->applet, GTK_WIDGET (sapplet->applet));

    return TRUE;
}
static void
seahorse_gkr_keyring_commands_class_init (SeahorseGkrKeyringCommandsClass *klass)
{
	GtkActionGroup *actions;
	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
	SeahorseCommandsClass *cmd_class = SEAHORSE_COMMANDS_CLASS (klass);
	
	seahorse_gkr_keyring_commands_parent_class = g_type_class_peek_parent (klass);

	gobject_class->constructor = seahorse_gkr_keyring_commands_constructor;
	gobject_class->finalize = seahorse_gkr_keyring_commands_finalize;

	cmd_class->show_properties = seahorse_gkr_keyring_commands_show_properties;
	cmd_class->delete_objects = seahorse_gkr_keyring_commands_delete_objects;
	
	g_type_class_add_private (gobject_class, sizeof (SeahorseGkrKeyringCommandsPrivate));

	/* Setup the predicate for these commands */
	keyring_predicate.type = SEAHORSE_TYPE_GKR_KEYRING;
	
	/* Register this class as a commands */
	seahorse_registry_register_type (seahorse_registry_get (), SEAHORSE_TYPE_GKR_KEYRING_COMMANDS, 
	                                 SEAHORSE_GKR_TYPE_STR, "commands", NULL, NULL);
	
	/* Register this as a generator */
	actions = gtk_action_group_new ("gkr-generate");
	gtk_action_group_set_translation_domain (actions, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (actions, ENTRIES_NEW, G_N_ELEMENTS (ENTRIES_NEW), NULL);
	seahorse_registry_register_object (NULL, G_OBJECT (actions), SEAHORSE_GKR_TYPE_STR, "generator", NULL);
}
Esempio n. 29
0
G_MODULE_EXPORT void
plugin_init (PlannerPlugin *plugin)
{
	PlannerPluginPriv *priv;
	GtkUIManager      *ui;
	gchar             *filename;

	priv = g_new0 (PlannerPluginPriv, 1);
	plugin->priv = priv;

	priv->actions = gtk_action_group_new ("HTML plugin actions");
	gtk_action_group_set_translation_domain (priv->actions, GETTEXT_PACKAGE);

	gtk_action_group_add_actions (priv->actions,
				      action_entries,
				      G_N_ELEMENTS (action_entries),
				      plugin);

	ui = planner_window_get_ui_manager (plugin->main_window);
	gtk_ui_manager_insert_action_group (ui, priv->actions, 0);

	filename = mrp_paths_get_ui_dir ("html-plugin.ui");
	gtk_ui_manager_add_ui_from_file (ui, filename, NULL);
	g_free (filename);

	gtk_ui_manager_ensure_update (ui);
}
static void
impl_attach_window (EphyExtension *ext,
		    EphyWindow *window)
{
	LOG ("EphyJavaConsoleExtension attach_window");

	if (java_console_is_available ())
	{
		GtkUIManager *manager;
		WindowData *data;

		data = g_new0 (WindowData, 1);

		g_object_set_data_full (G_OBJECT (window), WINDOW_DATA_KEY, data,
					(GDestroyNotify) g_free);

		data->action_group = gtk_action_group_new ("EphyJCExtActions");
		gtk_action_group_set_translation_domain (data->action_group, GETTEXT_PACKAGE);
		gtk_action_group_add_actions (data->action_group, action_entries,
				      	      G_N_ELEMENTS (action_entries), window);

		manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
		gtk_ui_manager_insert_action_group (manager, data->action_group, 0);
		g_object_unref (data->action_group);

		data->merge_id = gtk_ui_manager_new_merge_id (manager);

		gtk_ui_manager_add_ui (manager, data->merge_id, "/menubar/ToolsMenu",
				       ACTION_NAME_SHOW_CONSOLE, ACTION_NAME_SHOW_CONSOLE,
				       GTK_UI_MANAGER_MENUITEM, FALSE);
	}
}