Commit c6213527 authored by Paolo Borelli's avatar Paolo Borelli

Remove gedit_notebook_remove_tab

It's cleaner and faster to use gtk_container_remove
parent f065913c
...@@ -211,7 +211,6 @@ GeditNotebookPrivate ...@@ -211,7 +211,6 @@ GeditNotebookPrivate
GeditNotebook GeditNotebook
gedit_notebook_new gedit_notebook_new
gedit_notebook_add_tab gedit_notebook_add_tab
gedit_notebook_remove_tab
gedit_notebook_remove_all_tabs gedit_notebook_remove_all_tabs
gedit_notebook_reorder_tab gedit_notebook_reorder_tab
gedit_notebook_move_tab gedit_notebook_move_tab
......
...@@ -1030,17 +1030,17 @@ close_button_clicked (GtkCellRenderer *cell, ...@@ -1030,17 +1030,17 @@ close_button_clicked (GtkCellRenderer *cell,
const gchar *path, const gchar *path,
GeditDocumentsPanel *panel) GeditDocumentsPanel *panel)
{ {
GtkTreeIter iter; GtkTreeIter iter;
GeditTab *tab; GeditTab *tab;
GeditNotebook *notebook; GeditNotebook *notebook;
if (!gtk_tree_model_get_iter_from_string (panel->priv->model, if (!gtk_tree_model_get_iter_from_string (panel->priv->model,
&iter, path)) &iter, path))
{ {
return; return;
} }
gtk_tree_model_get (panel->priv->model, gtk_tree_model_get (panel->priv->model,
&iter, &iter,
NOTEBOOK_COLUMN, &notebook, NOTEBOOK_COLUMN, &notebook,
TAB_COLUMN, &tab, TAB_COLUMN, &tab,
...@@ -1052,7 +1052,8 @@ close_button_clicked (GtkCellRenderer *cell, ...@@ -1052,7 +1052,8 @@ close_button_clicked (GtkCellRenderer *cell,
} }
else else
{ {
gedit_notebook_remove_tab (notebook, tab); gtk_container_remove (GTK_CONTAINER (notebook),
GTK_WIDGET (tab));
g_object_unref (tab); g_object_unref (tab);
} }
......
...@@ -793,12 +793,12 @@ gedit_multi_notebook_close_tabs (GeditMultiNotebook *mnb, ...@@ -793,12 +793,12 @@ gedit_multi_notebook_close_tabs (GeditMultiNotebook *mnb,
gint n; gint n;
n = gtk_notebook_page_num (GTK_NOTEBOOK (nbs->data), n = gtk_notebook_page_num (GTK_NOTEBOOK (nbs->data),
GTK_WIDGET (l->data)); GTK_WIDGET (l->data));
if (n != -1) if (n != -1)
{ {
gedit_notebook_remove_tab (GEDIT_NOTEBOOK (nbs->data), gtk_container_remove (GTK_CONTAINER (nbs->data),
GEDIT_TAB (l->data)); GTK_WIDGET (l->data));
break; break;
} }
} }
......
...@@ -555,17 +555,6 @@ gedit_notebook_add_tab (GeditNotebook *nb, ...@@ -555,17 +555,6 @@ gedit_notebook_add_tab (GeditNotebook *nb,
} }
} }
static void
remove_tab (GeditTab *tab,
GeditNotebook *nb)
{
gint position;
position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position);
}
/** /**
* gedit_notebook_move_tab: * gedit_notebook_move_tab:
* @src: a #GeditNotebook * @src: a #GeditNotebook
...@@ -591,28 +580,11 @@ gedit_notebook_move_tab (GeditNotebook *src, ...@@ -591,28 +580,11 @@ gedit_notebook_move_tab (GeditNotebook *src,
/* make sure the tab isn't destroyed while we move it */ /* make sure the tab isn't destroyed while we move it */
g_object_ref (tab); g_object_ref (tab);
remove_tab (tab, src); gtk_container_remove (GTK_CONTAINER (src), GTK_WIDGET (tab));
gedit_notebook_add_tab (dest, tab, dest_position, TRUE); gedit_notebook_add_tab (dest, tab, dest_position, TRUE);
g_object_unref (tab); g_object_unref (tab);
} }
/**
* gedit_notebook_remove_tab:
* @nb: a #GeditNotebook
* @tab: a #GeditTab
*
* Removes @tab from @nb.
*/
void
gedit_notebook_remove_tab (GeditNotebook *nb,
GeditTab *tab)
{
g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
g_return_if_fail (GEDIT_IS_TAB (tab));
remove_tab (tab, nb);
}
/** /**
* gedit_notebook_remove_all_tabs: * gedit_notebook_remove_all_tabs:
* @nb: a #GeditNotebook * @nb: a #GeditNotebook
...@@ -625,7 +597,7 @@ gedit_notebook_remove_all_tabs (GeditNotebook *nb) ...@@ -625,7 +597,7 @@ gedit_notebook_remove_all_tabs (GeditNotebook *nb)
GList *tabs, *t; GList *tabs, *t;
g_return_if_fail (GEDIT_IS_NOTEBOOK (nb)); g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
g_list_free (nb->priv->focused_pages); g_list_free (nb->priv->focused_pages);
nb->priv->focused_pages = NULL; nb->priv->focused_pages = NULL;
......
...@@ -108,9 +108,6 @@ void gedit_notebook_move_tab (GeditNotebook *src, ...@@ -108,9 +108,6 @@ void gedit_notebook_move_tab (GeditNotebook *src,
GeditTab *tab, GeditTab *tab,
gint dest_position); gint dest_position);
void gedit_notebook_remove_tab (GeditNotebook *nb,
GeditTab *tab);
void gedit_notebook_remove_all_tabs (GeditNotebook *nb); void gedit_notebook_remove_all_tabs (GeditNotebook *nb);
void gedit_notebook_set_close_buttons_sensitive void gedit_notebook_set_close_buttons_sensitive
......
...@@ -545,11 +545,10 @@ set_info_bar (GeditTab *tab, ...@@ -545,11 +545,10 @@ set_info_bar (GeditTab *tab,
static void static void
remove_tab (GeditTab *tab) remove_tab (GeditTab *tab)
{ {
GeditNotebook *notebook; GtkWidget *notebook;
notebook = GEDIT_NOTEBOOK (gtk_widget_get_parent (GTK_WIDGET (tab))); notebook = gtk_widget_get_parent (GTK_WIDGET (tab));
gtk_container_remove (GTK_CONTAINER (notebook), GTK_WIDGET (tab));
gedit_notebook_remove_tab (notebook, tab);
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment