[gnome-initial-setup] Remove most uses of egg-list-box in a dumb way
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] Remove most uses of egg-list-box in a dumb way
- Date: Tue, 22 Oct 2013 17:41:52 +0000 (UTC)
commit e7ec22c9469c63d6d28cf19c4017e7d423e272ce
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jun 27 17:17:46 2013 -0400
Remove most uses of egg-list-box in a dumb way
Ideally, we should be setting things on the GtkListBoxRow directly,
rather than doing this.
.gitmodules | 3 -
Makefile.am | 2 +-
autogen.sh | 6 -
configure.ac | 12 +-
gnome-initial-setup/gnome-initial-setup.c | 4 -
gnome-initial-setup/pages/goa/gis-goa-page.c | 28 ++--
gnome-initial-setup/pages/goa/gis-goa-page.ui | 2 +-
.../pages/keyboard/cc-input-chooser.c | 200 +++++++-------------
.../pages/keyboard/gis-keyboard-page.c | 135 +++++++------
.../pages/keyboard/gis-keyboard-page.ui | 2 +-
.../pages/keyboard/input-chooser.ui | 2 +-
.../pages/language/cc-language-chooser.c | 132 +++++---------
.../pages/language/language-chooser.ui | 2 +-
.../pages/network/gis-network-page.c | 57 +++---
.../pages/network/gis-network-page.ui | 2 +-
po/POTFILES.skip | 1 -
16 files changed, 235 insertions(+), 355 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 4216bdd..d75bd5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_CFLAGS = ${WARN_CFLAGS}
-SUBDIRS = egg-list-box data gnome-initial-setup po
+SUBDIRS = data gnome-initial-setup po
EXTRA_DIST = \
autogen.sh \
diff --git a/autogen.sh b/autogen.sh
index e0b53d5..108eeaf 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -18,11 +18,5 @@ which gnome-autogen.sh || {
exit 1
}
-git submodule update --init --recursive
-
-cd egg-list-box
-sh autogen.sh --no-configure
-cd ..
-
REQUIRED_AUTOMAKE_VERSION=1.7
. gnome-autogen.sh
diff --git a/configure.ac b/configure.ac
index f30d42a..3d604ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,15 +23,6 @@ GNOME_DESKTOP_REQUIRED_VERSION=3.7.5
POLKIT_REQUIRED_VERSION=0.103
GDM_REQUIRED_VERSION=3.8.3
-# EggListBox submodule
-prev_top_build_prefix=$ac_top_build_prefix
-prev_ac_configure_args=$ac_configure_args
-AX_CONFIG_DIR([egg-list-box])
-ac_top_build_prefix=$prev_top_build_prefix
-ac_configure_args=$prev_ac_configure_args
-
-export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"$ac_top_build_prefix"egg-list-box
-
PKG_CHECK_MODULES(INITIAL_SETUP,
NetworkManager >= $NETWORK_MANAGER_REQUIRED_VERSION
libnm-glib >= $NETWORK_MANAGER_REQUIRED_VERSION
@@ -49,8 +40,7 @@ PKG_CHECK_MODULES(INITIAL_SETUP,
gio-unix-2.0 >= $GLIB_REQUIRED_VERSION
gdm >= $GDM_REQUIRED_VERSION
pango >= $PANGO_REQUIRED_VERSION
- pwquality
- egg-list-box-uninstalled)
+ pwquality)
PKG_CHECK_MODULES(COPY_WORKER, gio-2.0)
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 0cb370a..3d96b8b 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -38,8 +38,6 @@
#include <cheese-gtk.h>
#endif
-#include <egg-list-box.h>
-
#include "pages/language/gis-language-page.h"
#include "pages/keyboard/gis-keyboard-page.h"
#include "pages/eulas/gis-eula-pages.h"
@@ -243,8 +241,6 @@ main (int argc, char *argv[])
}
#endif
- g_type_ensure (EGG_TYPE_LIST_BOX);
-
driver = gis_driver_new (get_mode ());
g_signal_connect (driver, "rebuild-pages", G_CALLBACK (rebuild_pages_cb), NULL);
status = g_application_run (G_APPLICATION (driver), argc, argv);
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.c b/gnome-initial-setup/pages/goa/gis-goa-page.c
index c6d1f36..b3242d2 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.c
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.c
@@ -34,8 +34,6 @@
#define GOA_BACKEND_API_IS_SUBJECT_TO_CHANGE
#include <goabackend/goabackend.h>
-#include <egg-list-box.h>
-
#include "cc-online-accounts-add-account-dialog.h"
#include <glib/gi18n.h>
@@ -219,7 +217,7 @@ add_account_to_list (GisGoaPage *page, GoaObject *object)
goa_account_get_presentation_identity (account));
list = WID ("online-accounts-list");
- egg_list_box_set_selection_mode (EGG_LIST_BOX (list), GTK_SELECTION_NONE);
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_hexpand (box, TRUE);
@@ -350,20 +348,18 @@ network_status_changed (GNetworkMonitor *monitor,
}
static void
-update_separator_func (GtkWidget **separator,
- GtkWidget *child,
- GtkWidget *before,
- gpointer user_data)
+update_header_func (GtkListBoxRow *child,
+ GtkListBoxRow *before,
+ gpointer user_data)
{
+ GtkWidget *header;
+
if (before == NULL)
return;
- if (*separator == NULL)
- {
- *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- g_object_ref_sink (*separator);
- gtk_widget_show (*separator);
- }
+ header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_list_box_row_set_header (child, header);
+ gtk_widget_show (header);
}
static void
@@ -410,9 +406,9 @@ gis_goa_page_constructed (GObject *object)
page);
list = WID ("online-accounts-list");
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (list),
- update_separator_func,
- NULL, NULL);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (list),
+ update_header_func,
+ NULL, NULL);
gis_page_set_complete (GIS_PAGE (page), TRUE);
}
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.ui b/gnome-initial-setup/pages/goa/gis-goa-page.ui
index 96fb346..9c81282 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.ui
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.ui
@@ -55,7 +55,7 @@
<property name="margin-right">0</property>
<property name="hexpand">True</property>
<child>
- <object class="EggListBox" id="online-accounts-list">
+ <object class="GtkListBox" id="online-accounts-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
diff --git a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
index 077be91..86e7e8d 100644
--- a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
+++ b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
@@ -24,8 +24,6 @@
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnome-desktop/gnome-languages.h>
-#include <egg-list-box.h>
-
#include <../language/cc-common-language.h>
#include <../language/cc-util.h>
#include "cc-input-chooser.h"
@@ -307,23 +305,18 @@ set_fixed_size (GtkWidget *chooser)
}
static void
-update_separator (GtkWidget **separator,
- GtkWidget *child,
- GtkWidget *before,
- gpointer user_data)
+update_header_func (GtkListBoxRow *child,
+ GtkListBoxRow *before,
+ gpointer user_data)
{
- if (*separator && !GTK_IS_SEPARATOR (*separator))
- {
- gtk_widget_destroy (*separator);
- *separator = NULL;
- }
+ GtkWidget *header;
- if (*separator == NULL)
- {
- *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- g_object_ref_sink (*separator);
- gtk_widget_show (*separator);
- }
+ if (before == NULL)
+ return;
+
+ header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_list_box_row_set_header (child, header);
+ gtk_widget_show (header);
}
static void
@@ -371,9 +364,8 @@ show_input_sources_for_locale (GtkWidget *chooser,
gtk_adjustment_set_value (priv->adjustment,
gtk_adjustment_get_lower (priv->adjustment));
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (priv->list), update_separator, NULL, NULL);
- egg_list_box_refilter (EGG_LIST_BOX (priv->list));
- egg_list_box_set_selection_mode (EGG_LIST_BOX (priv->list), GTK_SELECTION_SINGLE);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (priv->list), update_header_func, NULL, NULL);
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (priv->list), GTK_SELECTION_SINGLE);
if (gtk_widget_is_visible (priv->filter_entry))
gtk_widget_grab_focus (priv->filter_entry);
@@ -425,9 +417,8 @@ show_locale_widgets (GtkWidget *chooser)
gtk_adjustment_set_value (priv->adjustment,
gtk_adjustment_get_lower (priv->adjustment));
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (priv->list), update_separator, NULL, NULL);
- egg_list_box_refilter (EGG_LIST_BOX (priv->list));
- egg_list_box_set_selection_mode (EGG_LIST_BOX (priv->list), GTK_SELECTION_NONE);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (priv->list), update_header_func, NULL, NULL);
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (priv->list), GTK_SELECTION_NONE);
if (gtk_widget_is_visible (priv->filter_entry))
gtk_widget_grab_focus (priv->filter_entry);
@@ -439,32 +430,30 @@ show_locale_widgets (GtkWidget *chooser)
}
static gint
-list_sort (GtkWidget *a,
- GtkWidget *b,
- gpointer data)
+list_sort (GtkListBoxRow *a,
+ GtkListBoxRow *b,
+ gpointer data)
{
GtkWidget *chooser = data;
CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
+ GtkWidget *wa, *wb;
LocaleInfo *ia;
LocaleInfo *ib;
const gchar *la;
const gchar *lb;
gint retval;
- /* Always goes at the start */
- if (a == priv->no_results)
- return -1;
- if (b == priv->no_results)
- return 1;
+ wa = gtk_bin_get_child (GTK_BIN (a));
+ wb = gtk_bin_get_child (GTK_BIN (b));
/* Always goes at the end */
- if (a == priv->more_item)
+ if (wa == priv->more_item)
return 1;
- if (b == priv->more_item)
+ if (wb == priv->more_item)
return -1;
- ia = g_object_get_data (G_OBJECT (a), "locale-info");
- ib = g_object_get_data (G_OBJECT (b), "locale-info");
+ ia = g_object_get_data (G_OBJECT (wa), "locale-info");
+ ib = g_object_get_data (G_OBJECT (wb), "locale-info");
/* The "Other" locale always goes at the end */
if (!ia->id[0] && ib->id[0])
@@ -511,22 +500,21 @@ match_all (gchar **words,
}
static gboolean
-list_filter (GtkWidget *child,
- gpointer user_data)
+list_filter (GtkListBoxRow *row,
+ gpointer user_data)
{
GtkDialog *chooser = user_data;
CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
LocaleInfo *info;
gboolean is_extra;
const gchar *source_name;
+ GtkWidget *child;
+
+ child = gtk_bin_get_child (GTK_BIN (row));
if (child == priv->more_item)
return !priv->showing_extra;
- /* We hide this in the after-refilter handler below. */
- if (child == priv->no_results)
- return TRUE;
-
is_extra = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "is-extra"));
if (!priv->showing_extra && is_extra)
@@ -551,14 +539,21 @@ list_filter (GtkWidget *child,
}
static void
-update_separator_filter (GtkWidget **separator,
- GtkWidget *child,
- GtkWidget *before,
- gpointer user_data)
+update_header_func_filter (GtkListBoxRow *row,
+ GtkListBoxRow *row_before,
+ gpointer user_data)
{
+ GtkWidget *child;
+ GtkWidget *before;
+
LocaleInfo *child_info = NULL;
LocaleInfo *before_info = NULL;
+ GtkWidget *header;
+
+ child = gtk_bin_get_child (GTK_BIN (row));
+ before = gtk_bin_get_child (GTK_BIN (row_before));
+
if (child)
child_info = g_object_get_data (G_OBJECT (child), "locale-info");
@@ -569,32 +564,12 @@ update_separator_filter (GtkWidget **separator,
return;
if (child_info == before_info)
- {
- /* Create a regular separator if we don't have one */
- if (*separator && !GTK_IS_SEPARATOR (*separator))
- {
- gtk_widget_destroy (*separator);
- *separator = NULL;
- }
-
- if (*separator == NULL)
- *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- }
+ header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
else
- {
- /* Create a locale heading separator if we don't have one */
- if (*separator && GTK_IS_SEPARATOR (*separator))
- {
- gtk_widget_destroy (*separator);
- *separator = NULL;
- }
-
- if (*separator == NULL)
- *separator = locale_separator_widget_new (child_info->name);
- }
+ header = locale_separator_widget_new (child_info->name);
- g_object_ref_sink (*separator);
- gtk_widget_show_all (*separator);
+ gtk_widget_show_all (header);
+ gtk_list_box_row_set_header (row, header);
}
static void
@@ -606,8 +581,6 @@ show_filter_widgets (GtkWidget *chooser)
remove_all_children (GTK_CONTAINER (priv->list));
- gtk_container_add (GTK_CONTAINER (priv->list), priv->no_results);
-
g_hash_table_iter_init (&iter, priv->locales);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &info))
add_input_source_widgets_for_locale (chooser, info);
@@ -616,10 +589,10 @@ show_filter_widgets (GtkWidget *chooser)
gtk_adjustment_set_value (priv->adjustment,
gtk_adjustment_get_lower (priv->adjustment));
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (priv->list),
- update_separator_filter, NULL, NULL);
- egg_list_box_refilter (EGG_LIST_BOX (priv->list));
- egg_list_box_set_selection_mode (EGG_LIST_BOX (priv->list), GTK_SELECTION_SINGLE);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (priv->list),
+ update_header_func_filter, NULL, NULL);
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (priv->list), GTK_SELECTION_SINGLE);
+ gtk_list_box_set_placeholder (GTK_LIST_BOX (priv->list), priv->no_results);
if (gtk_widget_is_visible (priv->filter_entry))
gtk_widget_grab_focus (priv->filter_entry);
@@ -672,49 +645,12 @@ filter_changed (GtkWidget *chooser)
if (!was_filtering)
show_filter_widgets (chooser);
else if (strvs_differ (priv->filter_words, previous_words))
- egg_list_box_refilter (EGG_LIST_BOX (priv->list));
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->list));
}
g_strfreev (previous_words);
}
-typedef struct {
- gint count;
- GtkWidget *ignore;
-} CountChildrenData;
-
-static void
-count_visible_children (GtkWidget *widget,
- gpointer user_data)
-{
- CountChildrenData *data = user_data;
- if (widget != data->ignore &&
- gtk_widget_get_child_visible (widget) &&
- gtk_widget_get_visible (widget))
- data->count++;
-}
-
-static void
-end_refilter (EggListBox *list_box,
- gpointer user_data)
-{
- GtkDialog *chooser = user_data;
- CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
- CountChildrenData data = { 0 };
- gboolean visible;
-
- data.ignore = priv->no_results;
-
- gtk_container_foreach (GTK_CONTAINER (list_box),
- count_visible_children, &data);
-
- visible = (data.count == 0);
-
- gtk_widget_set_visible (priv->no_results, visible);
- egg_list_box_set_selection_mode (EGG_LIST_BOX (priv->list),
- visible ? GTK_SELECTION_NONE : GTK_SELECTION_SINGLE);
-}
-
static void
show_more (GtkWidget *chooser)
{
@@ -727,20 +663,23 @@ show_more (GtkWidget *chooser)
priv->showing_extra = TRUE;
- egg_list_box_refilter (EGG_LIST_BOX (priv->list));
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->list));
}
static void
-child_activated (EggListBox *box,
- GtkWidget *child,
- GtkWidget *chooser)
+row_activated (GtkListBox *box,
+ GtkListBoxRow *row,
+ GtkWidget *chooser)
{
CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
gpointer data;
+ GtkWidget *child;
- if (!child)
+ if (!row)
return;
+ child = gtk_bin_get_child (GTK_BIN (row));
+
if (child == priv->more_item)
{
show_more (chooser);
@@ -770,13 +709,12 @@ child_activated (EggListBox *box,
}
static void
-child_selected (EggListBox *box,
- GtkWidget *child,
- GtkWidget *chooser)
+row_selected (GtkListBox *box,
+ GtkListBoxRow *row,
+ GtkWidget *chooser)
{
CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
-
- gtk_widget_set_sensitive (priv->add_button, child != NULL);
+ gtk_widget_set_sensitive (priv->add_button, row != NULL);
}
static void
@@ -1141,12 +1079,10 @@ cc_input_chooser_new (GtkWindow *main_window,
priv->more_item = g_object_ref_sink (more_widget_new ());
priv->no_results = g_object_ref_sink (no_results_widget_new ());
- egg_list_box_set_adjustment (EGG_LIST_BOX (priv->list), priv->adjustment);
- egg_list_box_set_filter_func (EGG_LIST_BOX (priv->list), list_filter, chooser, NULL);
- egg_list_box_set_sort_func (EGG_LIST_BOX (priv->list), list_sort, chooser, NULL);
- g_signal_connect (priv->list, "child-activated", G_CALLBACK (child_activated), chooser);
- g_signal_connect (priv->list, "child-selected", G_CALLBACK (child_selected), chooser);
- g_signal_connect_after (priv->list, "refilter", G_CALLBACK (end_refilter), chooser);
+ gtk_list_box_set_filter_func (GTK_LIST_BOX (priv->list), list_filter, chooser, NULL);
+ gtk_list_box_set_sort_func (GTK_LIST_BOX (priv->list), list_sort, chooser, NULL);
+ g_signal_connect (priv->list, "row-activated", G_CALLBACK (row_activated), chooser);
+ g_signal_connect (priv->list, "row-selected", G_CALLBACK (row_selected), chooser);
g_signal_connect_swapped (priv->filter_entry, "changed", G_CALLBACK (filter_changed), chooser);
@@ -1190,13 +1126,15 @@ cc_input_chooser_get_selected (GtkWidget *chooser,
gchar **name)
{
CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
+ GtkListBoxRow *row;
GtkWidget *selected;
const gchar *t, *i, *n;
- selected = egg_list_box_get_selected_child (EGG_LIST_BOX (priv->list));
- if (!selected)
+ row = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->list));
+ if (!row)
return FALSE;
+ selected = gtk_bin_get_child (GTK_BIN (row));
t = g_object_get_data (G_OBJECT (selected), "type");
i = g_object_get_data (G_OBJECT (selected), "id");
n = g_object_get_data (G_OBJECT (selected), "name");
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
index 25c59e3..08e5090 100644
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
@@ -47,7 +47,6 @@
#include <act/act.h>
#include <unistd.h>
-#include <egg-list-box.h>
#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources"
#define KEY_CURRENT_INPUT_SOURCE "current"
@@ -181,19 +180,22 @@ gis_keyboard_page_class_init (GisKeyboardPageClass * klass)
}
static void
-update_separator_func (GtkWidget **separator,
- GtkWidget *child,
- GtkWidget *before,
- gpointer user_data)
+update_header_func (GtkListBoxRow *row,
+ GtkListBoxRow *before,
+ gpointer user_data)
{
- if (before == NULL)
- return;
-
- if (*separator == NULL) {
- *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- g_object_ref_sink (*separator);
- gtk_widget_show (*separator);
- }
+ GtkWidget *current;
+
+ if (before == NULL)
+ return;
+
+ 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);
+ }
}
@@ -354,6 +356,22 @@ adjust_input_list_scrolling (GisKeyboardPage *self)
}
}
+static void
+remove_no_input_row (GtkContainer *list)
+{
+ GList *l;
+
+ l = gtk_container_get_children (list);
+ if (!l)
+ return;
+ if (l->next != NULL)
+ goto out;
+ if (g_strcmp0 (g_object_get_data (G_OBJECT (l->data), "type"), "none") == 0)
+ gtk_container_remove (list, GTK_WIDGET (l->data));
+out:
+ g_list_free (l);
+}
+
static GtkWidget *
add_input_row (GisKeyboardPage *self,
const gchar *type,
@@ -363,17 +381,22 @@ add_input_row (GisKeyboardPage *self,
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *row;
+ GtkWidget *box;
GtkWidget *label;
GtkWidget *image;
- row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ remove_no_input_row (GTK_CONTAINER (priv->input_list));
+
+ row = gtk_list_box_row_new ();
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_container_add (GTK_CONTAINER (row), box);
label = gtk_label_new (name);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_set_margin_left (label, 20);
gtk_widget_set_margin_right (label, 20);
gtk_widget_set_margin_top (label, 6);
gtk_widget_set_margin_bottom (label, 6);
- gtk_box_pack_start (GTK_BOX (row), label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
if (strcmp (type, INPUT_SOURCE_TYPE_IBUS) == 0) {
image = gtk_image_new_from_icon_name ("system-run-symbolic", GTK_ICON_SIZE_BUTTON);
@@ -382,7 +405,7 @@ add_input_row (GisKeyboardPage *self,
gtk_widget_set_margin_top (image, 6);
gtk_widget_set_margin_bottom (image, 6);
gtk_style_context_add_class (gtk_widget_get_style_context (image), "dim-label");
- gtk_box_pack_start (GTK_BOX (row), image, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), image, FALSE, TRUE, 0);
}
gtk_widget_show_all (row);
@@ -408,11 +431,8 @@ add_input_source (GisKeyboardPage *self,
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
const gchar *name;
- gchar *display_name;
- GDesktopAppInfo *app_info;
-
- display_name = NULL;
- app_info = NULL;
+ gchar *display_name = NULL;
+ GDesktopAppInfo *app_info = NULL;
if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) {
gnome_xkb_info_get_layout_info (priv->xkb_info, id, &name, NULL, NULL, NULL);
@@ -445,6 +465,12 @@ add_input_source (GisKeyboardPage *self,
}
static void
+add_no_input_row (GisKeyboardPage *self)
+{
+ add_input_row (self, "none", "none", _("No input source selected"), NULL);
+}
+
+static void
add_input_sources (GisKeyboardPage *self,
GVariant *sources)
{
@@ -452,6 +478,11 @@ add_input_sources (GisKeyboardPage *self,
const gchar *type;
const gchar *id;
+ if (g_variant_n_children (sources) < 1) {
+ add_no_input_row (self);
+ return;
+ }
+
g_variant_iter_init (&iter, sources);
while (g_variant_iter_next (&iter, "(&s&s)", &type, &id))
add_input_source (self, type, id);
@@ -491,7 +522,7 @@ select_by_id (GtkWidget *row,
row_id = (const gchar *)g_object_get_data (G_OBJECT (row), "id");
if (g_strcmp0 (row_id, id) == 0)
- egg_list_box_select_child (EGG_LIST_BOX (gtk_widget_get_parent (row)), row);
+ gtk_list_box_select_row (GTK_LIST_BOX (gtk_widget_get_parent (row)), GTK_LIST_BOX_ROW (row));
}
static void
@@ -510,10 +541,10 @@ input_sources_changed (GSettings *settings,
GisKeyboardPage *self)
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
- GtkWidget *selected;
+ GtkListBoxRow *selected;
gchar *id = NULL;
- selected = egg_list_box_get_selected_child (EGG_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
if (selected)
id = g_strdup (g_object_get_data (G_OBJECT (selected), "id"));
clear_input_sources (self);
@@ -524,12 +555,11 @@ input_sources_changed (GSettings *settings,
}
}
-
static void
update_buttons (GisKeyboardPage *self)
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
- GtkWidget *selected;
+ GtkListBoxRow *selected;
GList *children;
gboolean multiple_sources;
@@ -537,7 +567,7 @@ update_buttons (GisKeyboardPage *self)
multiple_sources = g_list_next (children) != NULL;
g_list_free (children);
- selected = egg_list_box_get_selected_child (EGG_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
if (selected == NULL) {
gtk_widget_set_visible (priv->show_config, FALSE);
gtk_widget_set_sensitive (priv->remove_input, FALSE);
@@ -766,16 +796,16 @@ static void
do_remove_selected_input (GisKeyboardPage *self)
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
- GtkWidget *selected;
+ GtkListBoxRow *selected;
GtkWidget *sibling;
- selected = egg_list_box_get_selected_child (EGG_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
if (selected == NULL)
return;
- sibling = find_sibling (GTK_CONTAINER (priv->input_list), selected);
- gtk_container_remove (GTK_CONTAINER (priv->input_list), selected);
- egg_list_box_select_child (EGG_LIST_BOX (priv->input_list), sibling);
+ sibling = find_sibling (GTK_CONTAINER (priv->input_list), GTK_WIDGET (selected));
+ gtk_container_remove (GTK_CONTAINER (priv->input_list), GTK_WIDGET (selected));
+ gtk_list_box_select_row (GTK_LIST_BOX (priv->input_list), GTK_LIST_BOX_ROW (sibling));
priv->n_input_rows -= 1;
adjust_input_list_scrolling (self);
@@ -794,13 +824,13 @@ static void
show_selected_settings (GisKeyboardPage *self)
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
- GtkWidget *selected;
+ GtkListBoxRow *selected;
GdkAppLaunchContext *ctx;
GDesktopAppInfo *app_info;
const gchar *id;
GError *error = NULL;
- selected = egg_list_box_get_selected_child (EGG_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
if (selected == NULL)
return;
@@ -827,15 +857,14 @@ static void
show_selected_layout (GisKeyboardPage *self)
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
- GtkWidget *selected;
+ GtkListBoxRow *selected;
const gchar *type;
const gchar *id;
const gchar *layout;
const gchar *variant;
gchar *commandline;
- gchar **argv = NULL;
- selected = egg_list_box_get_selected_child (EGG_LIST_BOX (priv->input_list));
+ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->input_list));
if (selected == NULL)
return;
@@ -878,28 +907,7 @@ show_selected_layout (GisKeyboardPage *self)
commandline = g_strdup_printf ("gkbd-keyboard-display -l %s",
layout);
- if (!g_shell_parse_argv (commandline,
- NULL,
- &argv,
- NULL))
- goto out;
-
- if (priv->gkbd_pid)
- {
- kill (priv->gkbd_pid, 9);
- priv->gkbd_pid = 0;
- }
-
- g_spawn_async (NULL,
- argv,
- NULL,
- G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- &priv->gkbd_pid,
- NULL);
- g_strfreev (argv);
- out:
+ g_spawn_command_line_async (commandline, NULL);
g_free (commandline);
}
@@ -958,18 +966,19 @@ setup_input_section (GisKeyboardPage *self)
g_signal_connect_swapped (priv->show_layout, "clicked",
G_CALLBACK (show_selected_layout), self);
- egg_list_box_set_selection_mode (EGG_LIST_BOX (priv->input_list),
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (priv->input_list),
GTK_SELECTION_SINGLE);
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (priv->input_list),
- update_separator_func,
- NULL, NULL);
- g_signal_connect_swapped (priv->input_list, "child-selected",
+ gtk_list_box_set_header_func (GTK_LIST_BOX (priv->input_list),
+ update_header_func,
+ NULL, NULL);
+ g_signal_connect_swapped (priv->input_list, "row-selected",
G_CALLBACK (update_buttons), self);
g_signal_connect (priv->input_settings, "changed::" KEY_INPUT_SOURCES,
G_CALLBACK (input_sources_changed), self);
add_default_input_source_for_locale (self);
+ update_buttons (self);
}
static void
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.ui
b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.ui
index ab045ef..56aef64 100644
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.ui
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.ui
@@ -56,7 +56,7 @@
<object class="GtkViewport" id="input_viewport">
<property name="visible">True</property>
<child>
- <object class="EggListBox" id="input_list">
+ <object class="GtkListBox" id="input_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
diff --git a/gnome-initial-setup/pages/keyboard/input-chooser.ui
b/gnome-initial-setup/pages/keyboard/input-chooser.ui
index 02496e0..00ed75a 100644
--- a/gnome-initial-setup/pages/keyboard/input-chooser.ui
+++ b/gnome-initial-setup/pages/keyboard/input-chooser.ui
@@ -26,7 +26,7 @@
<object class="GtkViewport" id="viewport">
<property name="visible">True</property>
<child>
- <object class="EggListBox" id="list">
+ <object class="GtkListBox" id="list">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="vexpand">True</property>
diff --git a/gnome-initial-setup/pages/language/cc-language-chooser.c
b/gnome-initial-setup/pages/language/cc-language-chooser.c
index 2dea0dc..4a40cf1 100644
--- a/gnome-initial-setup/pages/language/cc-language-chooser.c
+++ b/gnome-initial-setup/pages/language/cc-language-chooser.c
@@ -39,8 +39,6 @@
#include <glib-object.h>
-#include <egg-list-box.h>
-
G_DEFINE_TYPE (CcLanguageChooser, cc_language_chooser, GTK_TYPE_BIN);
#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_LANGUAGE_CHOOSER,
CcLanguageChooserPrivate))
@@ -147,13 +145,17 @@ language_widget_new (const char *locale_id,
}
static void
-sync_checkmark (GtkWidget *child,
+sync_checkmark (GtkWidget *row,
gpointer user_data)
{
- LanguageWidget *widget = get_language_widget (child);
+ GtkWidget *child;
+ LanguageWidget *widget;
gchar *locale_id;
gboolean should_be_visible;
+ child = gtk_bin_get_child (GTK_BIN (row));
+ widget = get_language_widget (child);
+
if (widget == NULL)
return;
@@ -225,7 +227,7 @@ add_languages (CcLanguageChooser *chooser,
}
gtk_container_add (GTK_CONTAINER (priv->language_list), priv->more_item);
- gtk_container_add (GTK_CONTAINER (priv->language_list), priv->no_results);
+ gtk_list_box_set_placeholder (GTK_LIST_BOX (priv->language_list), priv->no_results);
gtk_widget_show_all (priv->language_list);
}
@@ -257,8 +259,8 @@ match_all (gchar **words,
}
static gboolean
-language_visible (GtkWidget *child,
- gpointer user_data)
+language_visible (GtkListBoxRow *row,
+ gpointer user_data)
{
CcLanguageChooser *chooser = user_data;
CcLanguageChooserPrivate *priv = chooser->priv;
@@ -267,14 +269,12 @@ language_visible (GtkWidget *child,
gchar *locale_untranslated_name = NULL;
LanguageWidget *widget;
gboolean visible;
+ GtkWidget *child;
+ child = gtk_bin_get_child (GTK_BIN (row));
if (child == priv->more_item)
return !priv->showing_extra;
- /* We hide this in the after-refilter handler below. */
- if (child == priv->no_results)
- return TRUE;
-
widget = get_language_widget (child);
if (!priv->showing_extra && widget->is_extra)
@@ -308,14 +308,14 @@ language_visible (GtkWidget *child,
}
static gint
-sort_languages (GtkWidget *a,
- GtkWidget *b,
- gpointer data)
+sort_languages (GtkListBoxRow *a,
+ GtkListBoxRow *b,
+ gpointer data)
{
LanguageWidget *la, *lb;
- la = get_language_widget (a);
- lb = get_language_widget (b);
+ la = get_language_widget (gtk_bin_get_child (GTK_BIN (a)));
+ lb = get_language_widget (gtk_bin_get_child (GTK_BIN (a)));
if (la == NULL)
return 1;
@@ -337,13 +337,11 @@ filter_changed (GtkEntry *entry,
filter_contents =
cc_util_normalize_casefold_and_unaccent (gtk_entry_get_text (GTK_ENTRY
(priv->filter_entry)));
- if (!filter_contents) {
- egg_list_box_refilter (EGG_LIST_BOX (priv->language_list));
+ if (!filter_contents)
return;
- }
priv->filter_words = g_strsplit_set (g_strstrip (filter_contents), " ", 0);
g_free (filter_contents);
- egg_list_box_refilter (EGG_LIST_BOX (priv->language_list));
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->language_list));
}
static void
@@ -355,7 +353,7 @@ show_more (CcLanguageChooser *chooser)
gtk_widget_grab_focus (priv->filter_entry);
priv->showing_extra = TRUE;
- egg_list_box_refilter (EGG_LIST_BOX (priv->language_list));
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->language_list));
g_object_notify_by_pspec (G_OBJECT (chooser), obj_props[PROP_SHOWING_EXTRA]);
}
@@ -377,75 +375,41 @@ set_locale_id (CcLanguageChooser *chooser,
}
static void
-child_activated (EggListBox *box,
- GtkWidget *child,
- CcLanguageChooser *chooser)
+row_activated (GtkListBox *box,
+ GtkListBoxRow *row,
+ CcLanguageChooser *chooser)
{
+ GtkWidget *child;
CcLanguageChooserPrivate *priv = chooser->priv;
LanguageWidget *widget;
- if (child == NULL)
- return;
-
- if (child == priv->no_results)
+ if (row == NULL)
return;
+ child = gtk_bin_get_child (GTK_BIN (row));
if (child == priv->more_item) {
show_more (chooser);
- return;
+ } else {
+ widget = get_language_widget (child);
+ if (widget == NULL)
+ return;
+ set_locale_id (chooser, widget->locale_id);
}
-
- widget = get_language_widget (child);
- set_locale_id (chooser, widget->locale_id);
-}
-
-typedef struct {
- gint count;
- GtkWidget *ignore;
-} CountChildrenData;
-
-static void
-count_visible_children (GtkWidget *widget,
- gpointer user_data)
-{
- CountChildrenData *data = user_data;
- if (widget != data->ignore &&
- gtk_widget_get_child_visible (widget) &&
- gtk_widget_get_visible (widget))
- data->count++;
}
static void
-end_refilter (EggListBox *list_box,
- gpointer user_data)
+update_header_func (GtkListBoxRow *child,
+ GtkListBoxRow *before,
+ gpointer user_data)
{
- CcLanguageChooser *chooser = CC_LANGUAGE_CHOOSER (user_data);
- CcLanguageChooserPrivate *priv = chooser->priv;
+ GtkWidget *header;
- CountChildrenData data = { 0 };
-
- data.ignore = priv->no_results;
-
- gtk_container_foreach (GTK_CONTAINER (list_box),
- count_visible_children, &data);
-
- gtk_widget_set_visible (priv->no_results, (data.count == 0));
-}
-
-static void
-update_separator_func (GtkWidget **separator,
- GtkWidget *child,
- GtkWidget *before,
- gpointer user_data)
-{
if (before == NULL)
return;
- if (*separator == NULL) {
- *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- g_object_ref_sink (*separator);
- gtk_widget_show (*separator);
- }
+ header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_list_box_row_set_header (child, header);
+ gtk_widget_show (header);
}
#define WID(name) ((GtkWidget *) gtk_builder_get_object (builder, name))
@@ -475,16 +439,13 @@ cc_language_chooser_constructed (GObject *object)
priv->more_item = more_widget_new ();
priv->no_results = no_results_widget_new ();
- egg_list_box_set_adjustment (EGG_LIST_BOX (priv->language_list),
- gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (WID
("language-scrolledwindow"))));
-
- egg_list_box_set_sort_func (EGG_LIST_BOX (priv->language_list),
+ gtk_list_box_set_sort_func (GTK_LIST_BOX (priv->language_list),
sort_languages, chooser, NULL);
- egg_list_box_set_filter_func (EGG_LIST_BOX (priv->language_list),
+ gtk_list_box_set_filter_func (GTK_LIST_BOX (priv->language_list),
language_visible, chooser, NULL);
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (priv->language_list),
- update_separator_func, chooser, NULL);
- egg_list_box_set_selection_mode (EGG_LIST_BOX (priv->language_list),
+ gtk_list_box_set_header_func (GTK_LIST_BOX (priv->language_list),
+ update_header_func, chooser, NULL);
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (priv->language_list),
GTK_SELECTION_NONE);
add_all_languages (chooser);
@@ -492,13 +453,8 @@ cc_language_chooser_constructed (GObject *object)
G_CALLBACK (filter_changed),
chooser);
- g_signal_connect (priv->language_list, "child-activated",
- G_CALLBACK (child_activated), chooser);
-
- g_signal_connect_after (priv->language_list, "refilter",
- G_CALLBACK (end_refilter), chooser);
-
- egg_list_box_refilter (EGG_LIST_BOX (priv->language_list));
+ g_signal_connect (priv->language_list, "row-activated",
+ G_CALLBACK (row_activated), chooser);
if (priv->language == NULL)
priv->language = cc_common_language_get_current_language ();
diff --git a/gnome-initial-setup/pages/language/language-chooser.ui
b/gnome-initial-setup/pages/language/language-chooser.ui
index 77cb99d..fbe220e 100644
--- a/gnome-initial-setup/pages/language/language-chooser.ui
+++ b/gnome-initial-setup/pages/language/language-chooser.ui
@@ -16,7 +16,7 @@
<object class="GtkViewport" id="language-viewport">
<property name="visible">True</property>
<child>
- <object class="EggListBox" id="language-list">
+ <object class="GtkListBox" id="language-list">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="vexpand">True</property>
diff --git a/gnome-initial-setup/pages/network/gis-network-page.c
b/gnome-initial-setup/pages/network/gis-network-page.c
index fed3454..2667caa 100644
--- a/gnome-initial-setup/pages/network/gis-network-page.c
+++ b/gnome-initial-setup/pages/network/gis-network-page.c
@@ -34,8 +34,6 @@
#include <gtk/gtk.h>
-#include <egg-list-box.h>
-
#include <nm-client.h>
#include <nm-device-wifi.h>
#include <nm-access-point.h>
@@ -148,33 +146,37 @@ get_access_point_security (NMAccessPoint *ap)
}
static gint
-ap_sort (gconstpointer a, gconstpointer b, gpointer data)
+ap_sort (GtkListBoxRow *a,
+ GtkListBoxRow *b,
+ gpointer data)
{
- guint sa, sb;
+ GtkWidget *wa, *wb;
+ guint sa, sb;
+
+ wa = gtk_bin_get_child (GTK_BIN (a));
+ wb = gtk_bin_get_child (GTK_BIN (b));
- sa = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (a), "strength"));
- sb = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (b), "strength"));
- if (sa > sb) return -1;
- if (sb > sa) return 1;
+ sa = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (wa), "strength"));
+ sb = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (wb), "strength"));
+ if (sa > sb) return -1;
+ if (sb > sa) return 1;
- return 0;
+ return 0;
}
static void
-update_separator (GtkWidget **separator,
- GtkWidget *child,
- GtkWidget *before,
- gpointer user_data)
+update_header_func (GtkListBoxRow *child,
+ GtkListBoxRow *before,
+ gpointer user_data)
{
+ GtkWidget *header;
+
if (before == NULL)
return;
- if (*separator == NULL)
- {
- *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show (*separator);
- g_object_ref_sink (*separator);
- }
+ header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_list_box_row_set_header (child, header);
+ gtk_widget_show (header);
}
static void
@@ -461,7 +463,9 @@ connect_to_hidden_network (GisNetworkPage *page)
}
static void
-child_activated (EggListBox *box, GtkWidget *child, GisNetworkPage *page)
+row_activated (GtkListBox *box,
+ GtkListBoxRow *row,
+ GisNetworkPage *page)
{
GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
gchar *object_path;
@@ -471,10 +475,12 @@ child_activated (EggListBox *box, GtkWidget *child, GisNetworkPage *page)
NMSettingWireless *setting;
const GByteArray *ssid_target;
const GByteArray *ssid;
+ GtkWidget *child;
if (priv->refreshing)
return;
+ child = gtk_bin_get_child (GTK_BIN (row));
object_path = g_object_get_data (G_OBJECT (child), "object-path");
ssid_target = g_object_get_data (G_OBJECT (child), "ssid");
@@ -611,13 +617,12 @@ gis_network_page_constructed (GObject *object)
box = WID ("network-list");
- egg_list_box_set_selection_mode (EGG_LIST_BOX (box), GTK_SELECTION_NONE);
- egg_list_box_set_separator_funcs (EGG_LIST_BOX (box), update_separator, NULL, NULL);
- egg_list_box_set_sort_func (EGG_LIST_BOX (box), ap_sort, NULL, NULL);
- egg_list_box_set_adjustment (EGG_LIST_BOX (box), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW
(WID ("network-scrolledwindow"))));
+ gtk_list_box_set_selection_mode (GTK_LIST_BOX (box), GTK_SELECTION_NONE);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (box), update_header_func, NULL, NULL);
+ gtk_list_box_set_sort_func (GTK_LIST_BOX (box), ap_sort, NULL, NULL);
- g_signal_connect (box, "child-activated",
- G_CALLBACK (child_activated), page);
+ g_signal_connect (box, "row-activated",
+ G_CALLBACK (row_activated), page);
refresh_wireless_list (page);
diff --git a/gnome-initial-setup/pages/network/gis-network-page.ui
b/gnome-initial-setup/pages/network/gis-network-page.ui
index 3bf98f1..848f7d0 100644
--- a/gnome-initial-setup/pages/network/gis-network-page.ui
+++ b/gnome-initial-setup/pages/network/gis-network-page.ui
@@ -38,7 +38,7 @@
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<child>
- <object class="EggListBox" id="network-list">
+ <object class="GtkListBox" id="network-list">
<property name="visible">True</property>
<property name="vexpand">True</property>
<property name="hexpand">True</property>
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 635360d..f975804 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,3 +1,2 @@
data/gnome-initial-setup.desktop.in
data/gnome-initial-setup-first-login.desktop.in
-egg-list-box/egg-flow-box.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]