From 51f94376be27d8d919190d4cd4489833877cee7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?= Date: Thu, 26 Apr 2012 00:30:34 +0700 Subject: [PATCH 1/1] Add account name to distinguish multiple instances of service. --- configure.ac | 2 +- debian/changelog | 6 ++++++ src/plugin.c | 26 ++++++++++++++++++-------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 13b262a..88c338b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([sharing-cli], [0.4]) +AC_INIT([sharing-cli], [0.4.1]) AM_INIT_AUTOMAKE([foreign]) AM_MAINTAINER_MODE diff --git a/debian/changelog b/debian/changelog index 36ce3e8..6c59616 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sharing-cli (0.4.1) unstable; urgency=low + + * Add entry for account name. + + -- Nguyễn Hồng Quân Tue, 25 Apr 2012 18:52:10 +0700 + sharing-cli (0.4) unstable; urgency=low * Fixed build dependencies. diff --git a/src/plugin.c b/src/plugin.c index 5e2f5f7..fdd2047 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -275,7 +275,10 @@ gui_read_item (GHashTable* h, const gchar* id, SharingAccount* a) sharing_account_set_param (a, id, new); changed = TRUE; } - + /* Make the account name shown under service name */ + if (changed && id == "name") { + sharing_account_set_username(a, new); + } g_free (old); return changed; } @@ -283,11 +286,13 @@ gui_read_item (GHashTable* h, const gchar* id, SharingAccount* a) static gboolean gui_read(GHashTable* h, SharingAccount* a) { - gboolean changed = FALSE; - - if (gui_read_item (h, "command_line", a)) changed = TRUE; - - return changed; + gboolean command_updated = FALSE; + gboolean name_updated = FALSE; + command_updated = gui_read_item (h, "command_line", a); + name_updated = gui_read_item (h, "name", a); + /* Must separate the evaluation of two gui_read_item, or 1 of 2 params + * won't be saved */ + return command_updated || name_updated; } @@ -338,9 +343,13 @@ edit_account(SharingAccount* account, GtkWindow* parent, gboolean setup) gtk_box_pack_end(GTK_BOX(vbox), table, TRUE, TRUE, 0); - gui_add_item(table, 0, + gui_add_item(table, 1, "command_line", "CLI command", - "Command line command to execute", + "Command to execute", + FALSE, account, h); + gui_add_item(table, 0, + "name", "Name", + "Account name", FALSE, account, h); gtk_widget_show_all (GTK_WIDGET (dlg)); @@ -352,6 +361,7 @@ edit_account(SharingAccount* account, GtkWindow* parent, gboolean setup) gtk_widget_destroy (dlg); g_hash_table_unref (h); + g_hash_table_unref (h); if (result == GTK_RESPONSE_YES && (changed || setup)) return SHARING_EDIT_ACCOUNT_SUCCESS; -- 1.7.9.5