static void show_tabs_changed_cb (GSettings *settings, char *key, EphyNotebook *nb) { update_tabs_visibility (nb, FALSE); }
static void show_tabs_changed (GObject *object, GParamSpec *pspec, gpointer *data) { update_tabs_visibility (GEDIT_MULTI_NOTEBOOK (data)); }
static void notebook_page_removed (GtkNotebook *notebook, GtkWidget *child, guint page_num, GeditMultiNotebook *mnb) { GeditTab *tab = GEDIT_TAB (child); guint num_tabs; gboolean last_notebook; --mnb->priv->total_tabs; num_tabs = gtk_notebook_get_n_pages (notebook); last_notebook = (mnb->priv->notebooks->next == NULL); if (mnb->priv->total_tabs == 0) { mnb->priv->active_tab = NULL; g_object_notify (G_OBJECT (mnb), "active-tab"); } g_signal_emit (G_OBJECT (mnb), signals[TAB_REMOVED], 0, notebook, tab); /* Not last notebook but last tab of the notebook, this means we have to remove the current notebook */ if (num_tabs == 0 && !mnb->priv->removing_notebook && !last_notebook) { remove_notebook (mnb, GTK_WIDGET (notebook)); } update_tabs_visibility (mnb); }
static void ephy_notebook_remove (GtkContainer *container, GtkWidget *tab_widget) { GtkNotebook *gnotebook = GTK_NOTEBOOK (container); EphyNotebook *notebook = EPHY_NOTEBOOK (container); int position, curr; if (!EPHY_IS_EMBED (tab_widget)) return; /* Remove the page from the focused pages list */ notebook->focused_pages = g_list_remove (notebook->focused_pages, tab_widget); position = gtk_notebook_page_num (gnotebook, tab_widget); curr = gtk_notebook_get_current_page (gnotebook); if (position == curr) { smart_tab_switching_on_closure (notebook, tab_widget); } GTK_CONTAINER_CLASS (ephy_notebook_parent_class)->remove (container, tab_widget); update_tabs_visibility (notebook, FALSE); }
void ephy_notebook_set_adaptive_mode (EphyNotebook *notebook, EphyAdaptiveMode adaptive_mode) { g_assert (EPHY_IS_NOTEBOOK (notebook)); notebook->adaptive_mode = adaptive_mode; update_tabs_visibility (notebook, FALSE); }
void ephy_notebook_set_tabs_allowed (EphyNotebook *nb, gboolean tabs_allowed) { nb->tabs_allowed = tabs_allowed != FALSE; update_tabs_visibility (nb, FALSE); g_object_notify_by_pspec (G_OBJECT (nb), obj_properties[PROP_TABS_ALLOWED]); }
/** * pluma_notebook_set_always_show_tabs: * @nb: a #PlumaNotebook * @show_tabs: %TRUE to always show the tabs * * Sets the visibility of the tabs in the @nb. */ void pluma_notebook_set_always_show_tabs (PlumaNotebook *nb, gboolean show_tabs) { g_return_if_fail (PLUMA_IS_NOTEBOOK (nb)); nb->priv->always_show_tabs = (show_tabs != FALSE); update_tabs_visibility (nb, FALSE); }
/* We only use this to hide tabs in fullscreen mode so for now * we do not have a real property etc. */ void _gedit_multi_notebook_set_show_tabs (GeditMultiNotebook *mnb, gboolean show) { g_return_if_fail (GEDIT_IS_MULTI_NOTEBOOK (mnb)); mnb->priv->show_tabs = show != FALSE; update_tabs_visibility (mnb); }
/** * cedit_notebook_set_always_show_tabs: * @nb: a #CeditNotebook * @show_tabs: %TRUE to always show the tabs * * Sets the visibility of the tabs in the @nb. */ void cedit_notebook_set_always_show_tabs (CeditNotebook *nb, gboolean show_tabs) { g_return_if_fail (CEDIT_IS_NOTEBOOK (nb)); nb->priv->always_show_tabs = (show_tabs != FALSE); update_tabs_visibility (nb, FALSE); }
static void remove_tab (GtrTab *tab, GtrNotebook *notebook) { remove_tab_label (notebook, tab); /* Destroy the tab to break circular refs */ gtk_widget_destroy (GTK_WIDGET (tab)); update_tabs_visibility (notebook); }
/** * gtr_notebook_add_page: * @notebook: a #GtrNotebook * @tab: a #GtrTab * * Adds a new #GtrTab to @notebook. */ void gtr_notebook_add_page (GtrNotebook * notebook, GtrTab * tab) { GtkWidget *label; g_return_if_fail (GTR_IS_NOTEBOOK (notebook)); g_return_if_fail (GTR_IS_TAB (tab)); label = create_tab_label (notebook, tab); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), GTK_WIDGET (tab), label); update_tabs_visibility (notebook); }
static void notebook_page_added (GtkNotebook *notebook, GtkWidget *child, guint page_num, GeditMultiNotebook *mnb) { GeditTab *tab = GEDIT_TAB (child); ++mnb->priv->total_tabs; update_tabs_visibility (mnb); g_signal_emit (G_OBJECT (mnb), signals[TAB_ADDED], 0, notebook, tab); }
static void gedit_notebook_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GeditNotebook *notebook = GEDIT_NOTEBOOK (object); switch (prop_id) { case PROP_SHOW_TABS_MODE: notebook->priv->show_tabs_mode = g_value_get_enum (value); update_tabs_visibility (notebook, FALSE); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gedit_notebook_page_removed (GtkNotebook *notebook, GtkWidget *page, guint page_num) { GeditNotebook *nb = GEDIT_NOTEBOOK (notebook); gint num_pages; gint curr; GtkWidget *tab_label; tab_label = get_tab_label (GEDIT_TAB (page)); if (tab_label != NULL) { g_signal_handlers_disconnect_by_func (tab_label, G_CALLBACK (on_tab_label_destroyed), page); g_signal_handlers_disconnect_by_func (tab_label, G_CALLBACK (close_button_clicked_cb), nb); } /* Remove the page from the focused pages list */ nb->priv->focused_pages = g_list_remove (nb->priv->focused_pages, page); curr = gtk_notebook_get_current_page (notebook); if (page_num == curr) { smart_tab_switching_on_closure (nb, GEDIT_TAB (page)); } num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb)); /* If there is no tabs, calling this is pointless */ if (num_pages > 0) { update_tabs_visibility (nb, FALSE); } }
static void remove_tab (CeditTab *tab, CeditNotebook *nb) { gint position; position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab)); /* we ref the tab so that it's still alive while the tabs_removed * signal is processed. */ g_object_ref (tab); remove_tab_label (nb, tab); gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position); update_tabs_visibility (nb, FALSE); g_signal_emit (G_OBJECT (nb), signals[TAB_REMOVED], 0, tab); g_object_unref (tab); }
static void gedit_notebook_page_added (GtkNotebook *notebook, GtkWidget *page, guint page_num) { GeditNotebook *nb = GEDIT_NOTEBOOK (notebook); GtkWidget *tab_label; tab_label = get_tab_label (GEDIT_TAB (page)); g_signal_connect (tab_label, "destroy", G_CALLBACK (on_tab_label_destroyed), page); g_signal_connect (tab_label, "close-clicked", G_CALLBACK (close_button_clicked_cb), nb); update_tabs_visibility (GEDIT_NOTEBOOK (notebook), FALSE); }
/** * cedit_notebook_add_tab: * @nb: a #CeditNotebook * @tab: a #CeditTab * @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 cedit_notebook_add_tab (CeditNotebook *nb, CeditTab *tab, gint position, gboolean jump_to) { GtkWidget *tab_label; g_return_if_fail (CEDIT_IS_NOTEBOOK (nb)); g_return_if_fail (CEDIT_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) { CeditView *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 = cedit_tab_get_view (tab); gtk_widget_grab_focus (GTK_WIDGET (view)); } }
static int ephy_notebook_insert_page (GtkNotebook *gnotebook, GtkWidget *tab_widget, GtkWidget *tab_label, GtkWidget *menu_label, int position) { EphyNotebook *notebook = EPHY_NOTEBOOK (gnotebook); /* Destroy passed-in tab label */ if (tab_label != NULL) { g_object_ref_sink (tab_label); g_object_unref (tab_label); } g_assert (EPHY_IS_EMBED (tab_widget)); tab_label = build_tab_label (notebook, EPHY_EMBED (tab_widget)); update_tabs_visibility (notebook, TRUE); position = GTK_NOTEBOOK_CLASS (ephy_notebook_parent_class)->insert_page (gnotebook, tab_widget, tab_label, menu_label, position); gtk_notebook_set_tab_reorderable (gnotebook, tab_widget, TRUE); gtk_notebook_set_tab_detachable (gnotebook, tab_widget, TRUE); gtk_container_child_set (GTK_CONTAINER (gnotebook), GTK_WIDGET (tab_widget), "tab-expand", g_settings_get_boolean (EPHY_SETTINGS_UI, EPHY_PREFS_UI_EXPAND_TABS_BAR), NULL); return position; }