gpointing-device-settings r139 - in trunk: data modules src



Author: hiikezoe
Date: Fri Mar  6 14:48:26 2009
New Revision: 139
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=139&view=rev

Log:
Create GpdsUI from the result of gpds_xinput_utils_collect_pointer_infos().
Set device name on tab label.

Modified:
   trunk/data/mouse.ui.in
   trunk/data/touchpad.ui.in
   trunk/modules/gpds-mouse-ui.c
   trunk/modules/gpds-touchpad-ui.c
   trunk/src/gpointing-device-settings.c

Modified: trunk/data/mouse.ui.in
==============================================================================
--- trunk/data/mouse.ui.in	(original)
+++ trunk/data/mouse.ui.in	Fri Mar  6 14:48:26 2009
@@ -11,7 +11,6 @@
     <child>
       <object class="GtkLabel" id ="main-widget-label-text">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">TrackPoint</property>
       </object>
     </child>
   </object>

Modified: trunk/data/touchpad.ui.in
==============================================================================
--- trunk/data/touchpad.ui.in	(original)
+++ trunk/data/touchpad.ui.in	Fri Mar  6 14:48:26 2009
@@ -76,7 +76,6 @@
     <child>
       <object class="GtkLabel" id ="main-widget-label-text">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">Touchpad</property>
       </object>
     </child>
   </object>

Modified: trunk/modules/gpds-mouse-ui.c
==============================================================================
--- trunk/modules/gpds-mouse-ui.c	(original)
+++ trunk/modules/gpds-mouse-ui.c	Fri Mar  6 14:48:26 2009
@@ -673,6 +673,7 @@
                     GPDS_UI_ERROR_NO_WIDGET,
                     _("There is no widget(%s)."),
                     "main-widget");
+        return NULL;
     }
 
     return GTK_WIDGET(widget);
@@ -682,7 +683,7 @@
 get_label_widget (GpdsUI *ui, GError **error)
 {
     GtkBuilder *builder;
-    GObject *widget;
+    GObject *widget, *label;
 
     builder = gpds_ui_get_builder(ui);
 
@@ -693,8 +694,13 @@
                     GPDS_UI_ERROR_NO_WIDGET,
                     _("There is no widget(%s)."),
                     "main-widget-label");
+        return NULL;
     }
 
+    label = gtk_builder_get_object(builder, "main-widget-label-text");
+    if (label)
+        gtk_label_set_text(GTK_LABEL(label), gpds_ui_get_device_name(ui));
+
     return GTK_WIDGET(widget);
 }
 

Modified: trunk/modules/gpds-touchpad-ui.c
==============================================================================
--- trunk/modules/gpds-touchpad-ui.c	(original)
+++ trunk/modules/gpds-touchpad-ui.c	Fri Mar  6 14:48:26 2009
@@ -862,6 +862,7 @@
                     GPDS_UI_ERROR_NO_WIDGET,
                     _("There is no widget(%s)."),
                     "main-widget");
+        return NULL;
     }
 
     return GTK_WIDGET(widget);
@@ -871,7 +872,7 @@
 get_label_widget (GpdsUI *ui, GError **error)
 {
     GtkBuilder *builder;
-    GObject *widget;
+    GObject *widget, *label;
 
     builder = gpds_ui_get_builder(ui);
 
@@ -882,7 +883,11 @@
                     GPDS_UI_ERROR_NO_WIDGET,
                     _("There is no widget(%s)."),
                     "main-widget-label");
+        return NULL;
     }
+    label = gtk_builder_get_object(builder, "main-widget-label-text");
+    if (label)
+        gtk_label_set_text(GTK_LABEL(label), gpds_ui_get_device_name(ui));
 
     return GTK_WIDGET(widget);
 }

Modified: trunk/src/gpointing-device-settings.c
==============================================================================
--- trunk/src/gpointing-device-settings.c	(original)
+++ trunk/src/gpointing-device-settings.c	Fri Mar  6 14:48:26 2009
@@ -23,7 +23,7 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include "gpds-xinput.h"
+#include "gpds-xinput-pointer-info.h"
 #include "gpds-module.h"
 #include "gpds-ui.h"
 
@@ -55,17 +55,23 @@
 static void
 append_uis (GtkNotebook *notebook)
 {
-    GList *ui_names, *name;
+    GList *node, *pointer_infos;;
 
-    ui_names = gpds_uis_get_names();
+    pointer_infos = gpds_xinput_utils_collect_pointer_infos();
     
-    for (name = ui_names; name; name = g_list_next(name)) {
+    for (node = pointer_infos; node; node = g_list_next(node)) {
         GpdsUI *ui;
+        GpdsXInputPointerInfo *info = node->data;
+        gchar *type_name;
         GtkWidget *widget = NULL;
         GtkWidget *label = NULL;
         GError *error = NULL;
 
-        ui = gpds_ui_new(name->data, NULL);
+        type_name = g_ascii_strdown(gpds_xinput_pointer_info_get_type_name(info), -1);
+        ui = gpds_ui_new(g_ascii_strdown(type_name, -1),
+                         "device-name", gpds_xinput_pointer_info_get_name(info),
+                         NULL);
+        g_free(type_name);
         uis = g_list_prepend(uis, ui);
 
         if (!gpds_ui_is_available(ui, &error)) {
@@ -100,7 +106,8 @@
 
     }
 
-    g_list_free(ui_names);
+    g_list_foreach(pointer_infos, (GFunc)gpds_xinput_pointer_info_free, NULL);
+    g_list_free(pointer_infos);
 }
 
 int



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]