[gnome-control-center] sharing: Convert to GtkListBox
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] sharing: Convert to GtkListBox
- Date: Tue, 2 Jul 2013 15:29:19 +0000 (UTC)
commit c0abad92e16a2fc63fbb286856e21175e0c527e9
Author: Alexander Larsson <alexl redhat com>
Date: Thu Jun 13 12:21:30 2013 +0200
sharing: Convert to GtkListBox
https://bugzilla.gnome.org/show_bug.cgi?id=702164
panels/sharing/cc-sharing-panel.c | 47 ++++++++++++++++++-------------------
panels/sharing/sharing.ui | 39 +++++++++++++++++++++++++-----
2 files changed, 55 insertions(+), 31 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index 2364837..7aa004e 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -20,7 +20,6 @@
*/
#include "cc-sharing-panel.h"
-#include "egg-list-box/egg-list-box.h"
#include "shell/cc-hostname-entry.h"
#include "cc-sharing-resources.h"
@@ -209,18 +208,18 @@ cc_sharing_panel_run_dialog (CcSharingPanel *self,
}
static void
-cc_sharing_panel_main_list_box_child_activated (EggListBox *listbox,
- GtkWidget *widget,
- CcSharingPanel *self)
+cc_sharing_panel_main_list_box_row_activated (GtkListBox *listbox,
+ GtkListBoxRow *row,
+ CcSharingPanel *self)
{
gchar *widget_name, *found;
- widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (widget)));
+ widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (row)));
if (!widget_name)
return;
- egg_list_box_select_child (listbox, NULL);
+ gtk_list_box_select_row (listbox, NULL);
/* replace "button" with "dialog" */
found = g_strrstr (widget_name, "button");
@@ -237,22 +236,22 @@ out:
}
static void
-cc_sharing_panel_main_list_box_update_separator (GtkWidget **separator,
- GtkWidget *child,
- GtkWidget *before,
- gpointer user_data)
+cc_sharing_panel_main_list_box_update_header (GtkListBoxRow *row,
+ GtkListBoxRow *before,
+ gpointer user_data)
{
- if (before == NULL)
- {
- g_clear_object (separator);
- return;
- }
+ GtkWidget *current;
- if (*separator != NULL)
+ if (before == NULL)
return;
- *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- g_object_ref_sink (*separator);
+ current = gtk_list_box_row_get_header (row);
+ if (current == NULL)
+ {
+ current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_show (current);
+ gtk_list_box_row_set_header (row, current);
+ }
}
static gboolean
@@ -984,8 +983,8 @@ cc_sharing_panel_init (CcSharingPanel *self)
gtk_container_add (GTK_CONTAINER (self), WID ("sharing-panel"));
- g_signal_connect (WID ("main-list-box"), "child-activated",
- G_CALLBACK (cc_sharing_panel_main_list_box_child_activated), self);
+ g_signal_connect (WID ("main-list-box"), "row-activated",
+ G_CALLBACK (cc_sharing_panel_main_list_box_row_activated), self);
priv->hostname_cancellable = g_cancellable_new ();
@@ -1007,11 +1006,11 @@ cc_sharing_panel_init (CcSharingPanel *self)
g_signal_connect (priv->screen_sharing_dialog, "response",
G_CALLBACK (gtk_widget_hide), NULL);
- egg_list_box_set_activate_on_single_click (EGG_LIST_BOX (WID ("main-list-box")),
+ gtk_list_box_set_activate_on_single_click (GTK_LIST_BOX (WID ("main-list-box")),
TRUE);
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (WID ("main-list-box")),
- cc_sharing_panel_main_list_box_update_separator,
- NULL, NULL);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("main-list-box")),
+ cc_sharing_panel_main_list_box_update_header,
+ NULL, NULL);
/* create the master switch */
priv->master_switch = gtk_switch_new ();
diff --git a/panels/sharing/sharing.ui b/panels/sharing/sharing.ui
index 9b1d6f5..2202da6 100644
--- a/panels/sharing/sharing.ui
+++ b/panels/sharing/sharing.ui
@@ -264,10 +264,13 @@
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
- <object class="EggListBox" id="main-list-box">
+ <object class="GtkListBox" id="main-list-box">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkListBoxRow" id="bluetooth-sharing-button">
<property name="visible">True</property>
<child>
- <object class="GtkBox" id="bluetooth-sharing-button">
+ <object class="GtkBox" id="box1">
<property name="border-width">12</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -299,8 +302,13 @@
</child>
</object>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="personal-file-sharing-button">
+ <property name="visible">True</property>
<child>
- <object class="GtkBox" id="personal-file-sharing-button">
+ <object class="GtkBox" id="box2">
<property name="border-width">12</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -332,8 +340,13 @@
</child>
</object>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="screen-sharing-button">
+ <property name="visible">True</property>
<child>
- <object class="GtkBox" id="screen-sharing-button">
+ <object class="GtkBox" id="box3">
<property name="border-width">12</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -365,8 +378,13 @@
</child>
</object>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="media-sharing-button">
+ <property name="visible">True</property>
<child>
- <object class="GtkBox" id="media-sharing-button">
+ <object class="GtkBox" id="box4">
<property name="border-width">12</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -398,8 +416,13 @@
</child>
</object>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="remote-login-button">
+ <property name="visible">True</property>
<child>
- <object class="GtkBox" id="remote-login-button">
+ <object class="GtkBox" id="box5">
<property name="border-width">12</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -433,6 +456,8 @@
</object>
</child>
</object>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -1081,7 +1106,7 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkBox" id="box1">
+ <object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]