static void sync_name_and_icon (PlumaTab *tab, GParamSpec *pspec, PlumaDocumentsPanel *panel) { GdkPixbuf *pixbuf; gchar *name; GtkTreeIter iter; get_iter_from_tab (panel, tab, &iter); name = tab_get_name (tab); pixbuf = _pluma_tab_get_icon (tab); gtk_list_store_set (GTK_LIST_STORE (panel->priv->model), &iter, PIXBUF_COLUMN, pixbuf, NAME_COLUMN, name, TAB_COLUMN, tab, -1); g_free (name); if (pixbuf != NULL) g_object_unref (pixbuf); }
static void sync_name_and_icon (GeditTab *tab, GParamSpec *pspec, GeditDocumentsPanel *panel) { GtkTreeIter iter; gedit_debug (DEBUG_PANEL); if (get_iter_from_tab (panel, gedit_multi_notebook_get_active_notebook (panel->priv->mnb), tab, &iter)) { gchar *name; GdkPixbuf *pixbuf; name = tab_get_name (tab); pixbuf = _gedit_tab_get_icon (tab); gtk_tree_store_set (GTK_TREE_STORE (panel->priv->model), &iter, PIXBUF_COLUMN, pixbuf, NAME_COLUMN, name, -1); g_free (name); if (pixbuf != NULL) { g_object_unref (pixbuf); } } }
static void select_active_tab (GeditDocumentsPanel *panel) { GeditNotebook *notebook; GeditTab *tab; gboolean have_tabs; notebook = gedit_multi_notebook_get_active_notebook (panel->priv->mnb); have_tabs = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) > 0; tab = gedit_multi_notebook_get_active_tab (panel->priv->mnb); if (notebook != NULL && tab != NULL && have_tabs) { GtkTreeIter iter; if (get_iter_from_tab (panel, notebook, tab, &iter)) select_iter (panel, &iter); } }
static void multi_notebook_tab_switched (GeditMultiNotebook *mnb, GeditNotebook *old_notebook, GeditTab *old_tab, GeditNotebook *new_notebook, GeditTab *new_tab, GeditDocumentsPanel *panel) { gedit_debug (DEBUG_PANEL); if (!panel->priv->setting_active_notebook && !_gedit_window_is_removing_tabs (panel->priv->window)) { GtkTreeIter iter; if (get_iter_from_tab (panel, new_notebook, new_tab, &iter) && gtk_tree_store_iter_is_valid (GTK_TREE_STORE (panel->priv->model), &iter)) { select_iter (panel, &iter); } } }
static void window_active_tab_changed (PlumaWindow *window, PlumaTab *tab, PlumaDocumentsPanel *panel) { g_return_if_fail (tab != NULL); if (!_pluma_window_is_removing_tabs (window)) { GtkTreeIter iter; GtkTreeSelection *selection; get_iter_from_tab (panel, tab, &iter); if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model), &iter)) { selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (panel->priv->treeview)); gtk_tree_selection_select_iter (selection, &iter); } } }
static void window_tab_added (PlumaWindow *window, PlumaTab *tab, PlumaDocumentsPanel *panel) { GtkTreeIter iter; GtkTreeIter sibling; GdkPixbuf *pixbuf; gchar *name; g_signal_connect (tab, "notify::name", G_CALLBACK (sync_name_and_icon), panel); g_signal_connect (tab, "notify::state", G_CALLBACK (sync_name_and_icon), panel); get_iter_from_tab (panel, tab, &sibling); panel->priv->adding_tab = TRUE; if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model), &sibling)) { gtk_list_store_insert_after (GTK_LIST_STORE (panel->priv->model), &iter, &sibling); } else { PlumaTab *active_tab; gtk_list_store_append (GTK_LIST_STORE (panel->priv->model), &iter); active_tab = pluma_window_get_active_tab (panel->priv->window); if (tab == active_tab) { GtkTreeSelection *selection; selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (panel->priv->treeview)); gtk_tree_selection_select_iter (selection, &iter); } } name = tab_get_name (tab); pixbuf = _pluma_tab_get_icon (tab); gtk_list_store_set (GTK_LIST_STORE (panel->priv->model), &iter, PIXBUF_COLUMN, pixbuf, NAME_COLUMN, name, TAB_COLUMN, tab, -1); g_free (name); if (pixbuf != NULL) g_object_unref (pixbuf); panel->priv->adding_tab = FALSE; }