nautilus-sendto r381 - in trunk: . src/plugins/bluetooth
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus-sendto r381 - in trunk: . src/plugins/bluetooth
- Date: Wed, 7 Jan 2009 14:11:50 +0000 (UTC)
Author: hadess
Date: Wed Jan 7 14:11:50 2009
New Revision: 381
URL: http://svn.gnome.org/viewvc/nautilus-sendto?rev=381&view=rev
Log:
2009-01-07 Bastien Nocera <hadess hadess net>
* src/plugins/bluetooth/bluetooth.c (add_phone_to_list),
(add_device_to_list), (add_last_used_device_to_list),
(device_found), (get_contacts_widget): Use the Icon device
property to show a nice icon when sending to Bluetooth devices
(Closes: #553497)
Modified:
trunk/ChangeLog
trunk/src/plugins/bluetooth/bluetooth.c
Modified: trunk/src/plugins/bluetooth/bluetooth.c
==============================================================================
--- trunk/src/plugins/bluetooth/bluetooth.c (original)
+++ trunk/src/plugins/bluetooth/bluetooth.c Wed Jan 7 14:11:50 2009
@@ -43,6 +43,7 @@
DBusGProxy *object;
enum {
+ ICON_COL,
NAME_COL,
BDADDR_COL,
NUM_COLS
@@ -163,7 +164,10 @@
}
static void
-add_phone_to_list (GtkListStore *store, const char *name, const char *bdaddr)
+add_phone_to_list (GtkListStore *store,
+ const char *name,
+ const char *bdaddr,
+ const char *icon)
{
GtkTreeIter iter;
gboolean found = FALSE;
@@ -174,9 +178,10 @@
}
gtk_list_store_set (store, &iter,
- NAME_COL, name,
- BDADDR_COL, bdaddr,
- -1);
+ ICON_COL, icon,
+ NAME_COL, name,
+ BDADDR_COL, bdaddr,
+ -1);
if (discovered == 0) {
gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
@@ -198,15 +203,17 @@
G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
&props, G_TYPE_INVALID) != FALSE) {
GValue *value;
- const char *name, *address;
+ const char *name, *address, *icon;
value = g_hash_table_lookup (props, "Address");
address = g_value_get_string (value);
value = g_hash_table_lookup (props, "Alias");
name = g_value_get_string (value);
+ value = g_hash_table_lookup (props, "Icon");
+ icon = value ? g_value_get_string (value) : NULL;
//FIXME double check the obexftp support?
- add_phone_to_list (store, name, address);
+ add_phone_to_list (store, name, address, icon);
}
g_object_unref (device);
}
@@ -223,7 +230,7 @@
if (bdaddr != NULL && *bdaddr != '\0') {
name = get_device_name_from_address (bdaddr);
- add_phone_to_list (store, name, bdaddr);
+ add_phone_to_list (store, name, bdaddr, NULL);
}
g_free (bdaddr);
@@ -250,12 +257,14 @@
GtkListStore *store)
{
GValue *value;
- const char *name;
+ const char *name, *icon;
value = g_hash_table_lookup (props, "Alias");
name = value ? g_value_get_string (value) : NULL;
+ value = g_hash_table_lookup (props, "Icon");
+ icon = value ? g_value_get_string (value) : NULL;
- add_phone_to_list (store, name, address);
+ add_phone_to_list (store, name, address, icon);
}
static void
@@ -287,19 +296,27 @@
GtkListStore *store;
/* The model */
- store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+ store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
model = GTK_TREE_MODEL (store);
/* The widget itself */
combobox = gtk_combo_box_new_with_model (model);
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
+ renderer,
+ FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox),
+ renderer,
+ "icon-name", ICON_COL,
+ NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
- renderer,
- TRUE);
+ renderer,
+ TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox),
- renderer,
- "text", NAME_COL,
- NULL);
+ renderer,
+ "text", NAME_COL,
+ NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
gtk_widget_set_sensitive (combobox, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]