コード例 #1
0
ファイル: gedit-notebook.c プロジェクト: TheLazyPerson/gedit
static void
gedit_notebook_page_removed (GtkNotebook *notebook,
                             GtkWidget   *page,
                             guint        page_num)
{
	GeditNotebook *nb = GEDIT_NOTEBOOK (notebook);
	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));
	}
}
コード例 #2
0
ファイル: ephy-notebook.c プロジェクト: GNOME/epiphany
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);
}
コード例 #3
0
ファイル: gedit-notebook.c プロジェクト: jaseemabid/gedit
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);
	}
}
コード例 #4
0
ファイル: cedit-notebook.c プロジェクト: cranes-bill/cedit
/**
 * cedit_notebook_remove_tab:
 * @nb: a #CeditNotebook
 * @tab: a #CeditTab
 *
 * Removes @tab from @nb.
 */
void
cedit_notebook_remove_tab (CeditNotebook *nb,
			   CeditTab      *tab)
{
	gint position, curr;

	g_return_if_fail (CEDIT_IS_NOTEBOOK (nb));
	g_return_if_fail (CEDIT_IS_TAB (tab));

	/* Remove the page from the focused pages list */
	nb->priv->focused_pages =  g_list_remove (nb->priv->focused_pages,
						  tab);

	position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
	curr = gtk_notebook_get_current_page (GTK_NOTEBOOK (nb));

	if (position == curr)
	{
		smart_tab_switching_on_closure (nb, tab);
	}

	remove_tab (tab, nb);
}