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
GeditNotebook
gedit_notebook_new
gedit_notebook_add_tab
gedit_notebook_remove_tab
gedit_notebook_remove_all_tabs
gedit_notebook_reorder_tab
gedit_notebook_move_tab
......
......@@ -1030,17 +1030,17 @@ close_button_clicked (GtkCellRenderer *cell,
const gchar *path,
GeditDocumentsPanel *panel)
{
GtkTreeIter iter;
GeditTab *tab;
GeditNotebook *notebook;
GtkTreeIter iter;
GeditTab *tab;
GeditNotebook *notebook;
if (!gtk_tree_model_get_iter_from_string (panel->priv->model,
&iter, path))
{
return;
}
if (!gtk_tree_model_get_iter_from_string (panel->priv->model,
&iter, path))
{
return;
}
gtk_tree_model_get (panel->priv->model,
gtk_tree_model_get (panel->priv->model,
&iter,
NOTEBOOK_COLUMN, &notebook,
TAB_COLUMN, &tab,
......@@ -1052,7 +1052,8 @@ close_button_clicked (GtkCellRenderer *cell,
}
else
{
gedit_notebook_remove_tab (notebook, tab);
gtk_container_remove (GTK_CONTAINER (notebook),
GTK_WIDGET (tab));
g_object_unref (tab);
}
......
......@@ -793,12 +793,12 @@ gedit_multi_notebook_close_tabs (GeditMultiNotebook *mnb,
gint n;
n = gtk_notebook_page_num (GTK_NOTEBOOK (nbs->data),
GTK_WIDGET (l->data));
GTK_WIDGET (l->data));
if (n != -1)
{
gedit_notebook_remove_tab (GEDIT_NOTEBOOK (nbs->data),
GEDIT_TAB (l->data));
gtk_container_remove (GTK_CONTAINER (nbs->data),
GTK_WIDGET (l->data));
break;
}
}
......
......@@ -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:
* @src: a #GeditNotebook
......@@ -591,28 +580,11 @@ gedit_notebook_move_tab (GeditNotebook *src,
/* make sure the tab isn't destroyed while we move it */
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);
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:
* @nb: a #GeditNotebook
......@@ -625,7 +597,7 @@ gedit_notebook_remove_all_tabs (GeditNotebook *nb)
GList *tabs, *t;
g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
g_list_free (nb->priv->focused_pages);
nb->priv->focused_pages = NULL;
......
......@@ -108,9 +108,6 @@ void gedit_notebook_move_tab (GeditNotebook *src,
GeditTab *tab,
gint dest_position);
void gedit_notebook_remove_tab (GeditNotebook *nb,
GeditTab *tab);
void gedit_notebook_remove_all_tabs (GeditNotebook *nb);
void gedit_notebook_set_close_buttons_sensitive
......
......@@ -545,11 +545,10 @@ set_info_bar (GeditTab *tab,
static void
remove_tab (GeditTab *tab)
{
GeditNotebook *notebook;
GtkWidget *notebook;
notebook = GEDIT_NOTEBOOK (gtk_widget_get_parent (GTK_WIDGET (tab)));
gedit_notebook_remove_tab (notebook, tab);
notebook = gtk_widget_get_parent (GTK_WIDGET (tab));
gtk_container_remove (GTK_CONTAINER (notebook), GTK_WIDGET (tab));
}
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