static void pluma_notebook_switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data) { PlumaNotebook *nb = PLUMA_NOTEBOOK (notebook); GtkWidget *child; PlumaView *view; child = gtk_notebook_get_nth_page (notebook, page_num); /* Remove the old page, we dont want to grow unnecessarily * the list */ if (nb->priv->focused_pages) { nb->priv->focused_pages = g_list_remove (nb->priv->focused_pages, child); } nb->priv->focused_pages = g_list_append (nb->priv->focused_pages, child); /* give focus to the view */ view = pluma_tab_get_view (PLUMA_TAB (child)); gtk_widget_grab_focus (GTK_WIDGET (view)); }
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 tab_added_cb (PlumaWindow *window, PlumaTab *tab, PlumaDrawspacesPlugin *plugin) { PlumaView *view; WindowData *data; data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY); g_return_if_fail (data != NULL); if (data->enable) { view = pluma_tab_get_view (tab); gtk_source_view_set_draw_spaces (GTK_SOURCE_VIEW (view), plugin->priv->flags); } }
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); }
/** * pluma_notebook_add_tab: * @nb: a #PlumaNotebook * @tab: a #PlumaTab * @position: the position where the @tab should be added * @jump_to: %TRUE to set the @tab as active * * Adds the specified @tab to the @nb. */ void pluma_notebook_add_tab (PlumaNotebook *nb, PlumaTab *tab, gint position, gboolean jump_to) { GtkWidget *tab_label; g_return_if_fail (PLUMA_IS_NOTEBOOK (nb)); g_return_if_fail (PLUMA_IS_TAB (tab)); tab_label = create_tab_label (nb, tab); gtk_notebook_insert_page (GTK_NOTEBOOK (nb), GTK_WIDGET (tab), tab_label, position); update_tabs_visibility (nb, TRUE); g_signal_emit (G_OBJECT (nb), signals[TAB_ADDED], 0, tab); /* The signal handler may have reordered the tabs */ position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab)); if (jump_to) { PlumaView *view; gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), position); g_object_set_data (G_OBJECT (tab), "jump_to", GINT_TO_POINTER (jump_to)); view = pluma_tab_get_view (tab); gtk_widget_grab_focus (GTK_WIDGET (view)); } }