summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rcm-client-hardware-list.c18
-rw-r--r--rcm-client-main.c37
-rw-r--r--rcm-client.ui65
3 files changed, 85 insertions, 35 deletions
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c
index 0f9fecb..597e26c 100644
--- a/rcm-client-hardware-list.c
+++ b/rcm-client-hardware-list.c
@@ -66,7 +66,8 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
GtkWidget *button;
struct hwentry *hwe;
gchar *labeltxt;
- GtkListBox *hw_list_box;
+ GtkWidget *hw_list_swin;
+ GtkWidget *hw_list_box;
g_print(" - Object at %s\n", g_dbus_object_get_object_path(hw));
@@ -98,10 +99,19 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
gtk_container_add(GTK_CONTAINER(row), box);
gtk_widget_show_all(row);
- 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);
+ hw_list_swin = GTK_WIDGET(gtk_builder_get_object(global->builder, "hardware_page_swin"));
+ hw_list_box = gtk_bin_get_child(GTK_BIN(hw_list_swin));
+
+ if (!hw_list_box) {
+ hw_list_box = gtk_list_box_new();
+ gtk_list_box_set_selection_mode(GTK_LIST_BOX(hw_list_box), GTK_SELECTION_NONE);
+ gtk_container_add(GTK_CONTAINER(hw_list_swin), hw_list_box);
+ gtk_widget_show_all(hw_list_swin);
+ }
+
+ gtk_list_box_insert(GTK_LIST_BOX(hw_list_box), row, -1);
if (!hw_list)
- gtk_stack_set_visible_child(global->stack, GTK_WIDGET(hw_list_box));
+ gtk_stack_set_visible_child_name(global->stack, "hardware_page");
hwe = g_malloc(sizeof(*hwe));
hwe->hw = hw;
diff --git a/rcm-client-main.c b/rcm-client-main.c
index f6d8e70..1467f16 100644
--- a/rcm-client-main.c
+++ b/rcm-client-main.c
@@ -138,51 +138,38 @@ manager_ready_cb(GObject *source, GAsyncResult *res, gpointer user_data)
}
-int main (int argc, char *argv[])
+int main(int argc, char *argv[])
{
- GdkDisplay *display;
- GdkScreen *screen;
- GtkWidget *win;
- gint monitor;
- GdkRectangle rect;
GtkCssProvider *css;
+ GdkScreen *screen;
global = g_malloc(sizeof(*global));
gtk_init (&argc, &argv);
- display = gdk_display_get_default();
- screen = gdk_display_get_default_screen(display);
-
css = gtk_css_provider_new();
gtk_css_provider_load_from_path(css, "rcm.css", NULL);
+ screen = gdk_display_get_default_screen(gdk_display_get_default());
gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(css), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref(css);
global->builder = gtk_builder_new_from_file("rcm-client.ui");
- object_manager_client_new_for_bus(G_BUS_TYPE_SESSION,
- G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
- "org.gnome.RemoteControlManager",
- "/org/gnome/RemoteControlManager",
- NULL, manager_ready_cb, NULL);
-
- win = GTK_WIDGET(gtk_builder_get_object(global->builder, "main_window"));
- global->window = GTK_WINDOW(win);
- g_signal_connect(win, "destroy", G_CALLBACK (gtk_main_quit), NULL);
-
- monitor = gdk_screen_get_monitor_at_point(screen, 0, 0);
- gdk_screen_get_monitor_geometry(screen, monitor, &rect);
- gtk_window_set_default_size(global->window,
- rect.width * 4 / 5,
- rect.height * 1 / 2);
+ global->window = GTK_WINDOW(gtk_builder_get_object(global->builder, "main_window"));
+ g_signal_connect(global->window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
global->header = GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "headerbar"));
gtk_header_bar_set_show_close_button(global->header, TRUE);
global->stack = GTK_STACK(gtk_builder_get_object(global->builder, "main_stack"));
- gtk_widget_show_all(win);
+ gtk_widget_show_all(GTK_WIDGET(global->window));
+
+ object_manager_client_new_for_bus(G_BUS_TYPE_SESSION,
+ G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
+ "org.gnome.RemoteControlManager",
+ "/org/gnome/RemoteControlManager",
+ NULL, manager_ready_cb, NULL);
gtk_main();
diff --git a/rcm-client.ui b/rcm-client.ui
index 1a47d26..a3ed161 100644
--- a/rcm-client.ui
+++ b/rcm-client.ui
@@ -17,15 +17,13 @@
<object class="GtkWindow" id="main_window">
<property name="name">RemoteControlClientWindow</property>
<property name="can_focus">False</property>
+ <property name="default_width">600</property>
+ <property name="default_height">400</property>
<property name="icon_name">gnome-multimedia</property>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
<property name="transition_type">crossfade</property>
<child>
<object class="GtkLabel" id="status_label">
@@ -39,10 +37,65 @@
</packing>
</child>
<child>
- <object class="GtkListBox" id="hardware_listbox">
+ <object class="GtkGrid" id="hardware_page_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="selection_mode">none</property>
+ <property name="margin_left">18</property>
+ <property name="margin_right">18</property>
+ <property name="margin_top">18</property>
+ <property name="margin_bottom">18</property>
+ <property name="row_spacing">12</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkImage" id="hardware_page_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="icon_name">input-keyboard</property>
+ <property name="icon_size">6</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_page_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">&lt;big&gt;&lt;b&gt;Remote Control Hardware&lt;/b&gt;&lt;/big&gt;
+Currently connected receivers/transmitters</property>
+ <property name="use_markup">True</property>
+ <property name="ellipsize">middle</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="hardware_page_swin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="name">hardware_page</property>