Пример #1
0
static void
impl_update_ui (CeditPlugin *plugin,
		CeditWindow *window)
{
	WindowData *data;

	cedit_debug (DEBUG_PLUGINS);

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

	update_ui_real (window, data);
}
Пример #2
0
static void
impl_activate (CeditPlugin *plugin,
               CeditWindow *window)
{
    GtkUIManager *manager;
    WindowData *data;

    cedit_debug (DEBUG_PLUGINS);

    data = g_new (WindowData, 1);

    data->plugin = g_object_ref (plugin);
    data->dialog = NULL;
    data->ui_action_group = gtk_action_group_new ("CeditDocInfoPluginActions");

    gtk_action_group_set_translation_domain (data->ui_action_group,
            GETTEXT_PACKAGE);
    gtk_action_group_add_actions (data->ui_action_group,
                                  action_entries,
                                  G_N_ELEMENTS (action_entries),
                                  window);

    manager = cedit_window_get_ui_manager (window);
    gtk_ui_manager_insert_action_group (manager,
                                        data->ui_action_group,
                                        -1);

    data->ui_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,
                           data->ui_id,
                           MENU_PATH,
                           "DocumentStatistics",
                           "DocumentStatistics",
                           GTK_UI_MANAGER_MENUITEM,
                           FALSE);

    update_ui_real (window,
                    data);
}
Пример #3
0
static void
impl_activate (CeditPlugin *plugin,
	       CeditWindow *window)
{
	GtkUIManager *manager;
	WindowData *data;
	GError *error = NULL;

	cedit_debug (DEBUG_PLUGINS);

	data = g_slice_new (WindowData);

	manager = cedit_window_get_ui_manager (window);

	data->action_group = gtk_action_group_new ("CeditChangecasePluginActions");
	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,
							 submenu,
							 -1,
							 &error);
	if (data->ui_id == 0)
	{
		g_warning ("%s", error->message);
		free_window_data (data);
		return;
	}

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

	update_ui_real (window, data);
}
Пример #4
0
static void
impl_activate (GeditPlugin *plugin,
	       GeditWindow *window)
{
	GtkUIManager *manager;
	WindowData *data;
	ActionData *action_data;
	GList *docs, *l;

	gedit_debug (DEBUG_PLUGINS);

	data = g_slice_new (WindowData);
	action_data = g_slice_new (ActionData);
	action_data->plugin = plugin;
	action_data->window = window;

	manager = gedit_window_get_ui_manager (window);

	data->action_group = gtk_action_group_new ("GeditSpellPluginActions");
	gtk_action_group_set_translation_domain (data->action_group, 
						 GETTEXT_PACKAGE);
	gtk_action_group_add_actions_full (data->action_group,
					   action_entries,
					   G_N_ELEMENTS (action_entries),
					   action_data,
					   (GDestroyNotify) free_action_data);
	gtk_action_group_add_toggle_actions (data->action_group, 
					     toggle_action_entries,
					     G_N_ELEMENTS (toggle_action_entries),
					     window);

	gtk_ui_manager_insert_action_group (manager, data->action_group, -1);

	data->ui_id = gtk_ui_manager_new_merge_id (manager);

	data->message_cid = gtk_statusbar_get_context_id
			(GTK_STATUSBAR (gedit_window_get_statusbar (window)), 
			 "spell_plugin_message");

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

	gtk_ui_manager_add_ui (manager,
			       data->ui_id,
			       MENU_PATH,
			       "CheckSpell",
			       "CheckSpell",
			       GTK_UI_MANAGER_MENUITEM, 
			       FALSE);

	gtk_ui_manager_add_ui (manager, 
			       data->ui_id, 
			       MENU_PATH,
			       "AutoSpell", 
			       "AutoSpell",
			       GTK_UI_MANAGER_MENUITEM, 
			       FALSE);

	gtk_ui_manager_add_ui (manager, 
			       data->ui_id, 
			       MENU_PATH,
			       "ConfigSpell", 
			       "ConfigSpell",
			       GTK_UI_MANAGER_MENUITEM, 
			       FALSE);

	update_ui_real (window, data);

	docs = gedit_window_get_documents (window);
	for (l = docs; l != NULL; l = g_list_next (l))
	{
		set_auto_spell_from_metadata (window, GEDIT_DOCUMENT (l->data),
					      data->action_group);
	}

	data->tab_added_id =
		g_signal_connect (window, "tab-added",
				  G_CALLBACK (tab_added_cb), NULL);
	data->tab_removed_id =
		g_signal_connect (window, "tab-removed",
				  G_CALLBACK (tab_removed_cb), NULL);
}