static gchar * tab_get_name (GeditTab *tab) { GeditDocument *doc; gchar *name; gchar *docname; gchar *tab_name; gedit_debug (DEBUG_PANEL); g_return_val_if_fail (GEDIT_IS_TAB (tab), NULL); doc = gedit_tab_get_document (tab); name = gedit_document_get_short_name_for_display (doc); /* Truncate the name so it doesn't get insanely wide. */ docname = gedit_utils_str_middle_truncate (name, MAX_DOC_NAME_LENGTH); if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc))) { if (gedit_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 (gedit_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 tab_removed_cb (GeditWindow *window, GeditTab *tab, gpointer useless) { GeditDocument *doc; GeditView *view; doc = gedit_tab_get_document (tab); view = gedit_tab_get_view (tab); g_signal_handlers_disconnect_by_func (doc, on_document_loaded, window); }
static void tab_removed_cb (GeditWindow *window, GeditTab *tab, GeditSpellPlugin *plugin) { GeditDocument *doc; doc = gedit_tab_get_document (tab); g_object_set_data (G_OBJECT (doc), GEDIT_AUTOMATIC_SPELL_VIEW, NULL); g_signal_handlers_disconnect_by_func (doc, on_document_loaded, plugin); g_signal_handlers_disconnect_by_func (doc, on_document_saved, plugin); }
static void tab_added_cb (GeditWindow *window, GeditTab *tab, gpointer useless) { GeditDocument *doc; GeditView *view; doc = gedit_tab_get_document (tab); view = gedit_tab_get_view (tab); g_signal_connect (doc, "loaded", G_CALLBACK (on_document_loaded), window); }
static void on_tab_removed (GeditWindow *window, GeditTab *tab, GeditPlugin *plugin) { GeditDocument *doc; GeditView *view; doc = gedit_tab_get_document (tab); view = gedit_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 treeview_selection_changed (GtkTreeSelection *selection, GeditDocumentsPanel *panel) { GtkTreeIter iter; gedit_debug (DEBUG_PANEL); if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { GeditNotebook *notebook; GeditTab *tab; gtk_tree_model_get (panel->priv->model, &iter, NOTEBOOK_COLUMN, ¬ebook, TAB_COLUMN, &tab, -1); if (tab != NULL) { gedit_multi_notebook_set_active_tab (panel->priv->mnb, tab); if (notebook != NULL) g_object_unref (notebook); g_object_unref (tab); } else if (notebook != NULL) { panel->priv->setting_active_notebook = TRUE; gtk_widget_grab_focus (GTK_WIDGET (notebook)); panel->priv->setting_active_notebook = FALSE; tab = gedit_multi_notebook_get_active_tab (panel->priv->mnb); if (tab != NULL) { g_signal_connect (gedit_tab_get_document (tab), "changed", G_CALLBACK (document_changed), panel); } g_object_unref (notebook); } } }
static void multi_notebook_tab_removed (GeditMultiNotebook *mnb, GeditNotebook *notebook, GeditTab *tab, GeditDocumentsPanel *panel) { gedit_debug (DEBUG_PANEL); g_signal_handlers_disconnect_by_func (gedit_tab_get_document (tab), G_CALLBACK (document_changed), panel); g_signal_handlers_disconnect_by_func (tab, G_CALLBACK (sync_name_and_icon), panel); refresh_list (panel); }
static void on_tab_added (GeditWindow *window, GeditTab *tab, GeditPlugin *plugin) { GeditDocument *doc; GeditView *view; doc = gedit_tab_get_document (tab); view = gedit_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); }