Esempio n. 1
0
static void
tab_added_cb (PlumaWindow *window,
	      PlumaTab    *tab,
	      PlumaSpellPlugin *plugin)
{
	PlumaDocument *doc;
	gchar *uri;

	doc = pluma_tab_get_document (tab);

	g_object_get(G_OBJECT(doc), "uri", &uri, NULL);

	if (!uri)
	{
		set_auto_spell_from_metadata (plugin, doc, plugin->priv->action_group);

		g_free(uri);
	}

	g_signal_connect (doc, "loaded",
			  G_CALLBACK (on_document_loaded),
			  plugin);

	g_signal_connect (doc, "saved",
			  G_CALLBACK (on_document_saved),
			  plugin);
}
Esempio n. 2
0
static void
tab_removed_cb (PlumaWindow *window,
		PlumaTab    *tab,
		PlumaSpellPlugin *plugin)
{
	PlumaDocument *doc;

	doc = pluma_tab_get_document (tab);
	
	g_signal_handlers_disconnect_by_func (doc, on_document_loaded, plugin);
	g_signal_handlers_disconnect_by_func (doc, on_document_saved, plugin);
}
Esempio n. 3
0
static gchar *
tab_get_name (PlumaTab *tab)
{
	PlumaDocument *doc;
	gchar *name;
	gchar *docname;
	gchar *tab_name;

	g_return_val_if_fail (PLUMA_IS_TAB (tab), NULL);

	doc = pluma_tab_get_document (tab);

	name = pluma_document_get_short_name_for_display (doc);

	/* Truncate the name so it doesn't get insanely wide. */
	docname = pluma_utils_str_middle_truncate (name, MAX_DOC_NAME_LENGTH);

	if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))
	{
		if (pluma_document_get_readonly (doc))
		{
			tab_name = g_markup_printf_escaped ("<i>%s</i> [<i>%s</i>]",
							    docname,
							    _("Read-Only"));
		}
		else
		{
			tab_name = g_markup_printf_escaped ("<i>%s</i>", 
							    docname);
		}
	}
	else
	{
		if (pluma_document_get_readonly (doc))
		{
			tab_name = g_markup_printf_escaped ("%s [<i>%s</i>]",
							    docname,
							    _("Read-Only"));
		}
		else
		{
			tab_name = g_markup_escape_text (docname, -1);
		}
	}

	g_free (docname);
	g_free (name);

	return tab_name;
}
static void
on_tab_removed (PlumaWindow *window,
	        PlumaTab    *tab,
	        PlumaPlugin *plugin)
{
	PlumaDocument *doc;
	PlumaView *view;

	doc = pluma_tab_get_document (tab);
	view = pluma_tab_get_view (tab);

	g_signal_handlers_disconnect_by_func (doc, on_document_loaded, view);
	g_signal_handlers_disconnect_by_func (doc, on_document_saved, view);

	disable_bookmarks (view);
}
static void
on_tab_added (PlumaWindow *window,
	      PlumaTab    *tab,
	      PlumaPlugin *plugin)
{
	PlumaDocument *doc;
	PlumaView *view;

	doc = pluma_tab_get_document (tab);
	view = pluma_tab_get_view (tab);

	g_signal_connect (doc, "loaded",
			  G_CALLBACK (on_document_loaded),
			  view);
	g_signal_connect (doc, "saved",
			  G_CALLBACK (on_document_saved),
			  view);

	enable_bookmarks (view, plugin);
}