[gedit] Remove gedit_notebook_remove_tab
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Remove gedit_notebook_remove_tab
- Date: Mon, 15 Aug 2011 15:03:00 +0000 (UTC)
commit c62135277228f1b6b2a7cf5852d5f4f086558819
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Aug 15 17:04:47 2011 +0200
Remove gedit_notebook_remove_tab
It's cleaner and faster to use gtk_container_remove
docs/reference/gedit-sections.txt | 1 -
gedit/gedit-documents-panel.c | 21 +++++++++++----------
gedit/gedit-multi-notebook.c | 6 +++---
gedit/gedit-notebook.c | 32 ++------------------------------
gedit/gedit-notebook.h | 3 ---
gedit/gedit-tab.c | 7 +++----
6 files changed, 19 insertions(+), 51 deletions(-)
---
diff --git a/docs/reference/gedit-sections.txt b/docs/reference/gedit-sections.txt
index 8956839..86dbb8f 100644
--- a/docs/reference/gedit-sections.txt
+++ b/docs/reference/gedit-sections.txt
@@ -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
diff --git a/gedit/gedit-documents-panel.c b/gedit/gedit-documents-panel.c
index 73d7bac..c156ec6 100644
--- a/gedit/gedit-documents-panel.c
+++ b/gedit/gedit-documents-panel.c
@@ -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, ¬ebook,
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);
}
diff --git a/gedit/gedit-multi-notebook.c b/gedit/gedit-multi-notebook.c
index 80f482d..0cd7c70 100644
--- a/gedit/gedit-multi-notebook.c
+++ b/gedit/gedit-multi-notebook.c
@@ -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;
}
}
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index 942a487..55cfd58 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -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,29 +580,12 @@ 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;
diff --git a/gedit/gedit-notebook.h b/gedit/gedit-notebook.h
index 4a1f981..9ea050d 100644
--- a/gedit/gedit-notebook.h
+++ b/gedit/gedit-notebook.h
@@ -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
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 8b8133b..36c9f05 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]