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);
	}
}
Esempio n. 2
0
static void
impl_attach_window (EphyExtension *extension,
		    EphyWindow *window)
{
	GtkUIManager *manager;
	GtkActionGroup *action_group;
	GtkAction *action;
	GSettings *settings;
	EphyLocationController *location_controller;

	g_signal_connect (EPHY_SETTINGS_LOCKDOWN,
			  "changed::" EPHY_PREFS_LOCKDOWN_FULLSCREEN,
			  G_CALLBACK (fullscreen_cb), window);
	g_signal_connect (EPHY_SETTINGS_LOCKDOWN,
			  "changed::" EPHY_PREFS_LOCKDOWN_ARBITRARY_URL,
			  G_CALLBACK (arbitrary_url_cb), window);

	/* Trigger an initial state on these elements. */
	fullscreen_cb (EPHY_SETTINGS_LOCKDOWN,
		       EPHY_PREFS_LOCKDOWN_FULLSCREEN, window);
	arbitrary_url_cb (EPHY_SETTINGS_LOCKDOWN,
			  EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, window);

	manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));

	action_group = find_action_group (manager, "WindowActions");
	bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
				   action_group, window_actions,
				   G_N_ELEMENTS (window_actions));

	action_group = find_action_group (manager, "PopupsActions");
	bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
				   action_group, popup_actions,
				   G_N_ELEMENTS (popup_actions));

	action = gtk_action_group_get_action (action_group,
					      "SetImageAsBackground");
	settings = ephy_settings_get ("org.gnome.desktop.background");
	g_settings_bind_writable (settings, "picture-filename",
				  action, "sensitive", FALSE);

	action_group = find_action_group (manager, "SpecialToolbarActions");
	bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
				   action_group, special_toolbar_actions,
				   G_N_ELEMENTS (special_toolbar_actions));

	location_controller = ephy_window_get_location_controller (window);
	bind_location_controller (EPHY_SETTINGS_LOCKDOWN, location_controller);
}
static void
impl_attach_window (EphyExtension *extension,
                    EphyWindow *window)
{
  SoupFlyCBData *cb_data;
  GtkActionGroup *action_group;
  GtkUIManager *manager;
  guint merge_id;
  WindowData *data;
  EphySoupFlyExtensionPrivate *priv = EPHY_SOUP_FLY_EXTENSION (extension)->priv;

  LOG ("EphySoupFlyExtension attach_window");

  cb_data = g_new (SoupFlyCBData, 1);
  cb_data->extension = EPHY_SOUP_FLY_EXTENSION (extension);
  cb_data->window = window;

  data = g_new (WindowData, 1);

  data->action_group = action_group =
    gtk_action_group_new ("EphySoupFlyExtensionActions");
  gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
  gtk_action_group_add_actions_full (action_group, action_entries,
                                     G_N_ELEMENTS (action_entries), cb_data,
                                     g_free);

  manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
  gtk_ui_manager_insert_action_group (manager, action_group, 0);
  data->ui_id = merge_id = gtk_ui_manager_new_merge_id (manager);

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

  gtk_ui_manager_add_ui (manager, merge_id, "/ui/PagePopup/ExtensionsMenu",
                         "SoupFlySep", NULL,
                         GTK_UI_MANAGER_SEPARATOR, FALSE);
  gtk_ui_manager_add_ui (manager, merge_id, "/ui/PagePopup/ExtensionsMenu",
                         "SoupFly", "SoupFly",
                         GTK_UI_MANAGER_MENUITEM, FALSE);

  if (priv->is_logging == FALSE) {
    soup_fly_start (priv->fly);
    priv->is_logging = TRUE;
  }
}
static void
impl_detach_window (EphyExtension *ext,
		    EphyWindow *window)
{
	GtkUIManager *manager;
	WindowData *data;

	manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));

	data = (WindowData *) g_object_get_data (G_OBJECT (window),
						 WINDOW_DATA_KEY);
	g_assert (data != NULL);

	gtk_ui_manager_remove_ui (manager, data->ui_id);
	gtk_ui_manager_remove_action_group (manager, data->action_group);

	g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
}
static void
impl_detach_window (EphyExtension *ext,
		    EphyWindow *window)
{
	WindowData *data;
	
	LOG ("EphyJavaConsoleExtension detach_window");

	data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);

	if (data) 
	{
		GtkUIManager *manager;
	
		manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
		gtk_ui_manager_remove_ui (manager, data->merge_id);
		gtk_ui_manager_remove_action_group (manager, data->action_group);

		g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
	}
}
static void
impl_attach_window (EphyExtension *ext,
		    EphyWindow *window)
{
	GtkUIManager *manager;
	GtkActionGroup *action_group;
	guint ui_id;
	WindowData *data;

	LOG ("EphyGreasemonkeyExtension attach_window");

	data = g_new0 (WindowData, 1);

	manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));

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

	gtk_ui_manager_insert_action_group (manager, action_group, 0);

	data->ui_id = ui_id = gtk_ui_manager_new_merge_id (manager);

	data->window = window;

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

	gtk_ui_manager_add_ui (manager, ui_id, "/EphyLinkPopup",
			       "GreasemonkeySep1", NULL,
			       GTK_UI_MANAGER_SEPARATOR, TRUE);
	gtk_ui_manager_add_ui (manager, ui_id, "/EphyLinkPopup",
			       ACTION_NAME, ACTION_NAME,
			       GTK_UI_MANAGER_MENUITEM, TRUE);
	gtk_ui_manager_add_ui (manager, ui_id, "/EphyLinkPopup",
			       "GreasemonkeySep2", NULL,
			       GTK_UI_MANAGER_SEPARATOR, TRUE);
}
Esempio n. 7
0
static void
button_press_cb (GtkWidget *button, GdkEventButton *event, EphyPageMenuAction *action)
{
  GtkWidget *menu;
  EphyWindow *window;
  GtkUIManager *manager;
  guint event_button = 1;
  guint32 event_time = 0;

  if (!button) {
    GSList *l = gtk_action_get_proxies (GTK_ACTION (action));
    if (GTK_IS_BUTTON (l->data))
      button = GTK_WIDGET (l->data);
  }

  g_return_if_fail (GTK_IS_BUTTON (button));

  if (!action->priv->menu) {
    window = ephy_window_action_get_window (EPHY_WINDOW_ACTION (action));
    manager = ephy_window_get_ui_manager (window);
    menu = gtk_ui_manager_get_widget (manager, "/ui/PagePopup");

    g_signal_connect (menu, "notify::visible",
                      G_CALLBACK (visible_cb), button);

    action->priv->menu = g_object_ref (menu);
    action->priv->button = g_object_ref (button);
  }

  if (event) {
    event_button = event->button;
    event_time = event->time;
  }

  gtk_menu_popup (GTK_MENU (action->priv->menu),
                  NULL, NULL,
                  (GtkMenuPositionFunc)menu_position_func, button,
                  event_button, event_time);
}
static void
impl_attach_window (EphyExtension *ext,
		    EphyWindow *window)
{
	EphyExtensionsManagerUIExtension *extension = EPHY_EXTENSIONS_MANAGER_UI_EXTENSION (ext);
	GtkActionGroup *action_group;
	GtkUIManager *manager;
	guint ui_id;
	WindowData *data;

	data = g_new (WindowData, 1);

	manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));

	data->extension = extension;

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

	gtk_ui_manager_insert_action_group (manager, action_group, -1);
	g_object_unref (action_group);

	data->ui_id = ui_id = gtk_ui_manager_new_merge_id (manager);

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

	gtk_ui_manager_add_ui (manager, ui_id, "/ui/PagePopup/ExtensionsMenu",
			       "ExtensionsManagerUISep", NULL,
			       GTK_UI_MANAGER_SEPARATOR, FALSE);
	gtk_ui_manager_add_ui (manager, ui_id, "/ui/PagePopup/ExtensionsMenu",
			       "ExtensionsManagerUI", "ExtensionsManagerUI",
			       GTK_UI_MANAGER_MENUITEM, FALSE);
}