inspector: simplify some code

This commit is contained in:
Matthias Clasen 2016-04-09 15:47:56 -04:00
parent 9044f78751
commit abff6e23c0

View File

@ -411,37 +411,18 @@ add_device (GtkInspectorGeneral *gen,
"Rotation", "Rotation",
"Slider" "Slider"
}; };
const char *source_name[] = {
"Mouse",
"Pen",
"Eraser",
"Cursor",
"Keyboard",
"Touchscreen",
"Touchpad"
};
name = gdk_device_get_name (device); name = gdk_device_get_name (device);
value = source_name[gdk_device_get_source (device)];
switch (gdk_device_get_source (device))
{
case GDK_SOURCE_MOUSE:
value = "Mouse";
break;
case GDK_SOURCE_PEN:
value = "Pen";
break;
case GDK_SOURCE_ERASER:
value = "Eraser";
break;
case GDK_SOURCE_CURSOR:
value = "Cursor";
break;
case GDK_SOURCE_KEYBOARD:
value = "Keyboard";
break;
case GDK_SOURCE_TOUCHSCREEN:
value = "Touchscreen";
break;
case GDK_SOURCE_TOUCHPAD:
value = "Touchpad";
break;
default:
value = "Unknown";
break;
}
add_label_row (GTK_LIST_BOX (gen->priv->device_box), name, value, 10); add_label_row (GTK_LIST_BOX (gen->priv->device_box), name, value, 10);
str = g_string_new (""); str = g_string_new ("");