diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2007-08-03 03:25:13 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2007-08-03 03:25:13 +0800 |
commit | f19b149157d3fffd1b26685861509dab1fd94814 (patch) | |
tree | a02146992a34c0efdcfa1da01ef7fa0dfc037fcf | |
parent | 85789199a1c6f455f632605b48caec13dbe0828d (diff) | |
download | gsoc2013-empathy-f19b149157d3fffd1b26685861509dab1fd94814.tar gsoc2013-empathy-f19b149157d3fffd1b26685861509dab1fd94814.tar.gz gsoc2013-empathy-f19b149157d3fffd1b26685861509dab1fd94814.tar.bz2 gsoc2013-empathy-f19b149157d3fffd1b26685861509dab1fd94814.tar.lz gsoc2013-empathy-f19b149157d3fffd1b26685861509dab1fd94814.tar.xz gsoc2013-empathy-f19b149157d3fffd1b26685861509dab1fd94814.tar.zst gsoc2013-empathy-f19b149157d3fffd1b26685861509dab1fd94814.zip |
Click on the treeview to edit the name of an account. Fixes bug #459166.
2007-08-02 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/empathy-accounts-dialog.glade:
* libempathy-gtk/empathy-accounts-dialog.c: Click on the treeview to
edit the name of an account. Fixes bug #459166.
svn path=/trunk/; revision=229
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-accounts-dialog.c | 65 | ||||
-rw-r--r-- | libempathy-gtk/empathy-accounts-dialog.glade | 74 |
3 files changed, 56 insertions, 89 deletions
@@ -1,5 +1,11 @@ 2007-08-02 Xavier Claessens <xclaesse@gmail.com> + * libempathy-gtk/empathy-accounts-dialog.glade: + * libempathy-gtk/empathy-accounts-dialog.c: Click on the treeview to + edit the name of an account. Fixes bug #459166. + +2007-08-02 Xavier Claessens <xclaesse@gmail.com> + * libempathy-gtk/empathy-account-widget-jabber.c: Do not try to guess the Jabber server from the jid, gabble does that for us. diff --git a/libempathy-gtk/empathy-accounts-dialog.c b/libempathy-gtk/empathy-accounts-dialog.c index 151922e27..ca637651c 100644 --- a/libempathy-gtk/empathy-accounts-dialog.c +++ b/libempathy-gtk/empathy-accounts-dialog.c @@ -70,8 +70,7 @@ typedef struct { GtkWidget *frame_new_account; GtkWidget *combobox_profile; - GtkWidget *entry_name; - GtkWidget *table_new_account; + GtkWidget *hbox_type; GtkWidget *button_create; GtkWidget *button_back; @@ -131,8 +130,6 @@ static void accounts_dialog_status_changed_cb (MissionControl TelepathyConnectionStatusReason reason, const gchar *unique_name, EmpathyAccountsDialog *dialog); -static void accounts_dialog_entry_name_changed_cb (GtkWidget *widget, - EmpathyAccountsDialog *dialog); static void accounts_dialog_button_create_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog); static void accounts_dialog_button_back_clicked_cb (GtkWidget *button, @@ -351,6 +348,32 @@ accounts_dialog_model_setup (EmpathyAccountsDialog *dialog) } static void +accounts_dialog_name_edited_cb (GtkCellRendererText *renderer, + gchar *path, + gchar *new_text, + EmpathyAccountsDialog *dialog) +{ + McAccount *account; + GtkTreeModel *model; + GtkTreePath *treepath; + GtkTreeIter iter; + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview)); + treepath = gtk_tree_path_new_from_string (path); + gtk_tree_model_get_iter (model, &iter, treepath); + gtk_tree_model_get (model, &iter, + COL_ACCOUNT_POINTER, &account, + -1); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + COL_NAME, new_text, + -1); + gtk_tree_path_free (treepath); + + mc_account_set_display_name (account, new_text); + g_object_unref (account); +} + +static void accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog) { GtkTreeView *view; @@ -373,11 +396,17 @@ accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog) NULL); cell = gtk_cell_renderer_text_new (); - g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL); + g_object_set (cell, + "ellipsize", PANGO_ELLIPSIZE_END, + "editable", TRUE, + NULL); gtk_tree_view_column_pack_start (column, cell, TRUE); gtk_tree_view_column_add_attribute (column, cell, "text", COL_NAME); + g_signal_connect (cell, "edited", + G_CALLBACK (accounts_dialog_name_edited_cb), + dialog); gtk_tree_view_column_set_expand (column, TRUE); gtk_tree_view_append_column (view, column); @@ -750,16 +779,6 @@ accounts_dialog_status_changed_cb (MissionControl *mc, gtk_widget_show (dialog->window); } -static void -accounts_dialog_entry_name_changed_cb (GtkWidget *widget, - EmpathyAccountsDialog *dialog) -{ - const gchar *str; - - str = gtk_entry_get_text (GTK_ENTRY (widget)); - gtk_widget_set_sensitive (dialog->button_create, !G_STR_EMPTY (str)); -} - static void accounts_dialog_button_create_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog) @@ -778,7 +797,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button, /* Create account */ account = mc_account_create (profile); - str = gtk_entry_get_text (GTK_ENTRY (dialog->entry_name)); + str = mc_account_get_unique_name (account); mc_account_set_display_name (account, str); accounts_dialog_add_account (dialog, account); @@ -826,8 +845,7 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, gtk_widget_show (dialog->frame_new_account); gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->combobox_profile), 0); - gtk_entry_set_text (GTK_ENTRY (dialog->entry_name), ""); - gtk_widget_grab_focus (dialog->entry_name); + gtk_widget_grab_focus (dialog->combobox_profile); } static void @@ -976,8 +994,7 @@ empathy_accounts_dialog_show (GtkWindow *parent) "dialog-action_area", &bbox, "treeview", &dialog->treeview, "frame_new_account", &dialog->frame_new_account, - "entry_name", &dialog->entry_name, - "table_new_account", &dialog->table_new_account, + "hbox_type", &dialog->hbox_type, "button_create", &dialog->button_create, "button_back", &dialog->button_back, "image_type", &dialog->image_type, @@ -993,7 +1010,6 @@ empathy_accounts_dialog_show (GtkWindow *parent) "accounts_dialog", "response", accounts_dialog_response_cb, "button_create", "clicked", accounts_dialog_button_create_clicked_cb, "button_back", "clicked", accounts_dialog_button_back_clicked_cb, - "entry_name", "changed", accounts_dialog_entry_name_changed_cb, "treeview", "row-activated", accounts_dialog_treeview_row_activated_cb, "button_connect", "clicked", accounts_dialog_button_connect_clicked_cb, "button_add", "clicked", accounts_dialog_button_add_clicked_cb, @@ -1006,10 +1022,9 @@ empathy_accounts_dialog_show (GtkWindow *parent) /* Create profile chooser */ dialog->combobox_profile = empathy_profile_chooser_new (); - gtk_table_attach_defaults (GTK_TABLE (dialog->table_new_account), - dialog->combobox_profile, - 1, 2, - 0, 1); + gtk_box_pack_end (GTK_BOX (dialog->hbox_type), + dialog->combobox_profile, + TRUE, TRUE, 0); gtk_widget_show (dialog->combobox_profile); /* Set up signalling */ diff --git a/libempathy-gtk/empathy-accounts-dialog.glade b/libempathy-gtk/empathy-accounts-dialog.glade index a61b57bd7..e2a8493e5 100644 --- a/libempathy-gtk/empathy-accounts-dialog.glade +++ b/libempathy-gtk/empathy-accounts-dialog.glade @@ -395,91 +395,38 @@ <property name="spacing">12</property> <child> - <widget class="GtkTable" id="table_new_account"> + <widget class="GtkHBox" id="hbox_type"> <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label640"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Type:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options"></property> - <property name="y_options"></property> - </packing> - </child> + <property name="spacing">6</property> <child> - <widget class="GtkLabel" id="label638"> + <widget class="GtkLabel" id="label645"> <property name="visible">True</property> - <property name="label" translatable="yes">_Name:</property> - <property name="use_underline">True</property> + <property name="label" translatable="yes">Type:</property> + <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> - <property name="xalign">0</property> + <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="mnemonic_widget">entry_name</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options"></property> - <property name="y_options"></property> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> </packing> </child> <child> - <widget class="GtkEntry" id="entry_name"> - <property name="visible">True</property> - <property name="tooltip" translatable="yes">A unique name for this account to identify it personally to you.</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> + <placeholder/> </child> </widget> <packing> @@ -498,7 +445,6 @@ <child> <widget class="GtkButton" id="button_create"> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> |