[gnome-control-center] shell: Add GtkNotebook helper functions
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Add GtkNotebook helper functions
- Date: Sat, 18 Aug 2012 15:12:15 +0000 (UTC)
commit 72fd5636e5f769d887796caaf450efeaa139ec9b
Author: Bastien Nocera <hadess hadess net>
Date: Sat Aug 18 16:02:39 2012 +0100
shell: Add GtkNotebook helper functions
https://bugzilla.gnome.org/show_bug.cgi?id=682127
shell/gnome-control-center.c | 57 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index 7294804..b219f9a 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -92,6 +92,63 @@ struct _GnomeControlCenterPrivate
CcSmallScreen small_screen;
};
+/* Notebook helpers */
+static GtkWidget *
+notebook_get_selected_page (GtkWidget *notebook)
+{
+ int curr;
+
+ curr = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
+ if (curr == -1)
+ return NULL;
+ return gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), curr);
+}
+
+static void
+notebook_select_page (GtkWidget *notebook,
+ GtkWidget *page)
+{
+ int i, num;
+
+ num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+ for (i = 0; i < num; i++)
+ {
+ if (gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), i) == page)
+ {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), i);
+ return;
+ }
+ }
+
+ g_warning ("Couldn't select GtkNotebook page %p", page);
+}
+
+static void
+notebook_remove_page (GtkWidget *notebook,
+ GtkWidget *page)
+{
+ int i, num;
+
+ num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+ for (i = 0; i < num; i++)
+ {
+ if (gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), i) == page)
+ {
+ gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), i);
+ return;
+ }
+ }
+
+ g_warning ("Couldn't find GtkNotebook page to remove %p", page);
+}
+
+static void
+notebook_add_page (GtkWidget *notebook,
+ GtkWidget *page)
+{
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
+}
+
static const gchar *
get_icon_name_from_g_icon (GIcon *gicon)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]