summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rcm-client-hardware-list.c28
-rw-r--r--rcm-client-hardware-list.h1
-rw-r--r--rcm-client-main.c2
-rw-r--r--rcm-client-receive.c2
-rw-r--r--rcm-client.ui45
5 files changed, 44 insertions, 34 deletions
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c
index a7dceb6..0f9fecb 100644
--- a/rcm-client-hardware-list.c
+++ b/rcm-client-hardware-list.c
@@ -10,8 +10,6 @@
#include "rcm-client-hardware-list.h"
#include "rcm-client-receive.h"
-static GtkWidget *status_msg;
-static GtkWidget *hw_list_box;
static GList *hw_list = NULL;
struct hwentry {
@@ -44,7 +42,7 @@ void rcng_client_hardware_list_remove(GDBusObject *hw)
g_free(hwe);
if (!hw_list)
- gtk_stack_set_visible_child(global->stack, status_msg);
+ gtk_stack_set_visible_child_name(global->stack, "status_page");
}
static void
@@ -68,6 +66,7 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
GtkWidget *button;
struct hwentry *hwe;
gchar *labeltxt;
+ GtkListBox *hw_list_box;
g_print(" - Object at %s\n", g_dbus_object_get_object_path(hw));
@@ -78,9 +77,6 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
}
g_list_free_full (interfaces, g_object_unref);
- if (!hw_list)
- gtk_stack_set_visible_child(global->stack, hw_list_box);
-
row = gtk_list_box_row_new();
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
icon = gtk_image_new_from_icon_name("gtk-harddisk", GTK_ICON_SIZE_DIALOG);
@@ -102,7 +98,10 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
gtk_container_add(GTK_CONTAINER(row), box);
gtk_widget_show_all(row);
- gtk_list_box_insert(GTK_LIST_BOX(hw_list_box), row, -1);
+ hw_list_box = GTK_LIST_BOX(gtk_stack_get_child_by_name(global->stack, "hardware_page"));
+ gtk_list_box_insert(hw_list_box, row, -1);
+ if (!hw_list)
+ gtk_stack_set_visible_child(global->stack, GTK_WIDGET(hw_list_box));
hwe = g_malloc(sizeof(*hwe));
hwe->hw = hw;
@@ -112,18 +111,9 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
void rcng_client_hardware_list_update_status(gchar *status)
{
- gtk_label_set_text(GTK_LABEL(status_msg), status);
-}
+ GtkLabel *status_msg;
-void rcng_client_hardware_list_init_ui()
-{
- status_msg = gtk_label_new("Connecting to server...");
- gtk_stack_add_named(global->stack, status_msg, "nohw");
- gtk_stack_set_visible_child(global->stack, status_msg);
-
- hw_list_box = gtk_list_box_new();
- gtk_stack_add_named(global->stack, hw_list_box, "yeshw");
- gtk_list_box_set_selection_mode(GTK_LIST_BOX(hw_list_box), GTK_SELECTION_NONE);
+ status_msg = GTK_LABEL(gtk_stack_get_child_by_name(global->stack, "status_page"));
+ gtk_label_set_text(status_msg, status);
}
-
diff --git a/rcm-client-hardware-list.h b/rcm-client-hardware-list.h
index 47314e0..1b61bef 100644
--- a/rcm-client-hardware-list.h
+++ b/rcm-client-hardware-list.h
@@ -1,6 +1,5 @@
void rcng_client_hardware_list_remove(GDBusObject *);
void rcng_client_hardware_list_add(GDBusObject *);
-void rcng_client_hardware_list_init_ui();
void rcng_client_hardware_list_update_status(gchar *);
diff --git a/rcm-client-main.c b/rcm-client-main.c
index 54bf490..f6d8e70 100644
--- a/rcm-client-main.c
+++ b/rcm-client-main.c
@@ -182,8 +182,6 @@ int main (int argc, char *argv[])
global->stack = GTK_STACK(gtk_builder_get_object(global->builder, "main_stack"));
- rcng_client_hardware_list_init_ui();
-
gtk_widget_show_all(win);
gtk_main();
diff --git a/rcm-client-receive.c b/rcm-client-receive.c
index 6f64f6f..a1a3536 100644
--- a/rcm-client-receive.c
+++ b/rcm-client-receive.c
@@ -723,7 +723,7 @@ show_hardware_list(GtkButton *button, gpointer user_data)
{
remove_header_buttons();
gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), NULL);
- gtk_stack_set_visible_child_name(global->stack, "yeshw");
+ gtk_stack_set_visible_child_name(global->stack, "hardware_page");
if (state.stack_switch)
gtk_widget_destroy(state.stack_switch);
diff --git a/rcm-client.ui b/rcm-client.ui
index c7bfd51..927e84d 100644
--- a/rcm-client.ui
+++ b/rcm-client.ui
@@ -6,17 +6,6 @@
<property name="name">RemoteControlClientWindow</property>
<property name="can_focus">False</property>
<property name="icon_name">gnome-multimedia</property>
- <child type="titlebar">
- <object class="GtkHeaderBar" id="headerbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="title">Remote Control Configuration</property>
- <property name="has_subtitle">False</property>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
@@ -27,6 +16,40 @@
<property name="margin_bottom">12</property>
<property name="transition_type">crossfade</property>
<child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Connecting to server...</property>
+ </object>
+ <packing>
+ <property name="name">status_page</property>
+ <property name="title" translatable="yes">page0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkListBox" id="listbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="selection_mode">none</property>
+ </object>
+ <packing>
+ <property name="name">hardware_page</property>
+ <property name="title" translatable="yes">page1</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child type="titlebar">
+ <object class="GtkHeaderBar" id="headerbar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="title">Remote Control Configuration</property>
+ <property name="has_subtitle">False</property>
+ <child>
<placeholder/>
</child>
</object>