[gnome-control-center/wip/gbsneto/new-keyboard-panel: 1/19] shell: update sidelist when active panel is set externally
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/gbsneto/new-keyboard-panel: 1/19] shell: update sidelist when active panel is set externally
- Date: Thu, 21 Jul 2016 22:53:50 +0000 (UTC)
commit 0671e91f2bd8bd3c91f98b57bcefefddc2d7b937
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Jul 15 00:12:49 2016 -0300
shell: update sidelist when active panel is set externally
When the active panel is set by external agents, e.g. calling
the Control Center through command line and asking to open a
specific panel, the panel is correctly opened but the sidelist
is not updated to reflect that.
Fix that by selecting the externally set panel row, and eventually
moving to the correct list.
https://bugzilla.gnome.org/show_bug.cgi?id=769063
shell/alt/cc-panel-list.c | 38 ++++++++++++++++++++++++++++++++++++++
shell/alt/cc-panel-list.h | 3 +++
shell/alt/cc-window.c | 2 ++
3 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/shell/alt/cc-panel-list.c b/shell/alt/cc-panel-list.c
index 1c26dd2..1c83a3c 100644
--- a/shell/alt/cc-panel-list.c
+++ b/shell/alt/cc-panel-list.c
@@ -49,6 +49,7 @@ struct _CcPanelList
CcPanelListView previous_view;
CcPanelListView view;
+ GList *panels;
};
G_DEFINE_TYPE (CcPanelList, cc_panel_list, GTK_TYPE_STACK)
@@ -503,6 +504,7 @@ cc_panel_list_finalize (GObject *object)
CcPanelList *self = (CcPanelList *)object;
g_clear_pointer (&self->search_query, g_free);
+ g_clear_pointer (&self->panels, g_list_free);
G_OBJECT_CLASS (cc_panel_list_parent_class)->finalize (object);
}
@@ -805,4 +807,40 @@ cc_panel_list_add_panel (CcPanelList *self,
/* And add to the search listbox too */
search_data = row_data_new (category, id, title, description, icon);
gtk_container_add (GTK_CONTAINER (self->search_listbox), search_data->row);
+
+ self->panels = g_list_prepend (self->panels, data);
+}
+
+/**
+ * cc_panel_list_set_active_panel:
+ * @self: a #CcPanelList
+ * @id: the id of the panel to be activated
+ *
+ * Sets the current active panel.
+ */
+void
+cc_panel_list_set_active_panel (CcPanelList *self,
+ const gchar *id)
+{
+ GList *l;
+
+ g_return_if_fail (CC_IS_PANEL_LIST (self));
+
+ for (l = self->panels; l != NULL; l = l->next)
+ {
+ RowData *data = l->data;
+
+ if (g_strcmp0 (data->id, id) == 0)
+ {
+ GtkWidget *listbox;
+
+ listbox = gtk_widget_get_parent (data->row);
+
+ gtk_list_box_select_row (GTK_LIST_BOX (listbox), GTK_LIST_BOX_ROW (data->row));
+ gtk_widget_grab_focus (data->row);
+
+ g_signal_emit_by_name (data->row, "activate");
+ break;
+ }
+ }
}
diff --git a/shell/alt/cc-panel-list.h b/shell/alt/cc-panel-list.h
index 0cd1880..bf50a8c 100644
--- a/shell/alt/cc-panel-list.h
+++ b/shell/alt/cc-panel-list.h
@@ -61,6 +61,9 @@ void cc_panel_list_add_panel (CcPanelList
const gchar *description,
const gchar *icon);
+void cc_panel_list_set_active_panel (CcPanelList *self,
+ const gchar *id);
+
G_END_DECLS
#endif /* CC_PANEL_LIST_H */
diff --git a/shell/alt/cc-window.c b/shell/alt/cc-window.c
index dbc6e5a..2fd20dd 100644
--- a/shell/alt/cc-window.c
+++ b/shell/alt/cc-window.c
@@ -475,6 +475,8 @@ cc_window_set_active_panel_from_id (CcShell *shell,
if (old_panel)
gtk_container_remove (GTK_CONTAINER (self->stack), old_panel);
+
+ cc_panel_list_set_active_panel (CC_PANEL_LIST (self->panel_list), start_id);
}
g_free (name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]