aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-04-16 23:57:08 +0800
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-04-18 04:24:16 +0800
commite57f5cfac0d04a01dd94bf4404cd17d5f4706c8a (patch)
treea265d82b969c768841e9dca77f4763849dd5c945
parente5771050285335cb81784ef6a27ccba49026c79a (diff)
downloadgsoc2013-empathy-e57f5cfac0d04a01dd94bf4404cd17d5f4706c8a.tar
gsoc2013-empathy-e57f5cfac0d04a01dd94bf4404cd17d5f4706c8a.tar.gz
gsoc2013-empathy-e57f5cfac0d04a01dd94bf4404cd17d5f4706c8a.tar.bz2
gsoc2013-empathy-e57f5cfac0d04a01dd94bf4404cd17d5f4706c8a.tar.lz
gsoc2013-empathy-e57f5cfac0d04a01dd94bf4404cd17d5f4706c8a.tar.xz
gsoc2013-empathy-e57f5cfac0d04a01dd94bf4404cd17d5f4706c8a.tar.zst
gsoc2013-empathy-e57f5cfac0d04a01dd94bf4404cd17d5f4706c8a.zip
Modify deeply the join chatroom dialog.
The rationale is that the room list is now loaded when the expander is open. It will refresh it if is open and the server is changed.
-rw-r--r--src/empathy-new-chatroom-dialog.c83
-rw-r--r--src/empathy-new-chatroom-dialog.ui112
2 files changed, 70 insertions, 125 deletions
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index 75ab742c3..9993d7522 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -59,13 +59,9 @@ typedef struct {
GtkWidget *account_chooser;
GtkWidget *label_server;
GtkWidget *entry_server;
- GtkWidget *togglebutton_refresh;
GtkWidget *label_room;
GtkWidget *entry_room;
- GtkWidget *vbox_browse;
- GtkWidget *image_status;
- GtkWidget *label_status;
- GtkWidget *hbox_status;
+ GtkWidget *expander_browse;
GtkWidget *throbber;
GtkWidget *treeview;
GtkTreeModel *model;
@@ -111,7 +107,10 @@ static void new_chatroom_dialog_browse_start (EmpathyNewC
static void new_chatroom_dialog_browse_stop (EmpathyNewChatroomDialog *dialog);
static void new_chatroom_dialog_entry_server_activate_cb (GtkWidget *widget,
EmpathyNewChatroomDialog *dialog);
-static void new_chatroom_dialog_togglebutton_refresh_toggled_cb (GtkWidget *widget,
+static void new_chatroom_dialog_expander_browse_activate_cb (GtkWidget *widget,
+ EmpathyNewChatroomDialog *dialog);
+static gboolean new_chatroom_dialog_entry_server_focus_out_cb (GtkWidget *widget,
+ GdkEventFocus *event,
EmpathyNewChatroomDialog *dialog);
static EmpathyNewChatroomDialog *dialog_p = NULL;
@@ -140,13 +139,9 @@ empathy_new_chatroom_dialog_show (GtkWindow *parent)
"label_room", &dialog->label_room,
"entry_server", &dialog->entry_server,
"entry_room", &dialog->entry_room,
- "togglebutton_refresh", &dialog->togglebutton_refresh,
- "vbox_browse", &dialog->vbox_browse,
- "image_status", &dialog->image_status,
- "label_status", &dialog->label_status,
- "hbox_status", &dialog->hbox_status,
"treeview", &dialog->treeview,
"button_join", &dialog->button_join,
+ "expander_browse", &dialog->expander_browse,
NULL);
g_free (filename);
@@ -155,8 +150,9 @@ empathy_new_chatroom_dialog_show (GtkWindow *parent)
"new_chatroom_dialog", "destroy", new_chatroom_dialog_destroy_cb,
"entry_server", "changed", new_chatroom_dialog_entry_changed_cb,
"entry_server", "activate", new_chatroom_dialog_entry_server_activate_cb,
+ "entry_server", "focus-out-event", new_chatroom_dialog_entry_server_focus_out_cb,
"entry_room", "changed", new_chatroom_dialog_entry_changed_cb,
- "togglebutton_refresh", "toggled", new_chatroom_dialog_togglebutton_refresh_toggled_cb,
+ "expander_browse", "activate", new_chatroom_dialog_expander_browse_activate_cb,
NULL);
g_object_unref (gui);
@@ -179,9 +175,10 @@ empathy_new_chatroom_dialog_show (GtkWindow *parent)
dialog->throbber = ephy_spinner_new ();
ephy_spinner_set_size (EPHY_SPINNER (dialog->throbber), GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_widget_show (dialog->throbber);
-
- gtk_box_pack_start (GTK_BOX (dialog->hbox_status), dialog->throbber,
- FALSE, FALSE, 0);
+ gtk_table_attach (GTK_TABLE (dialog->table_info),
+ dialog->throbber,
+ 2, 3, 0, 1,
+ 0, 0, 0, 0);
/* Account chooser for custom */
dialog->account_chooser = empathy_account_chooser_new ();
@@ -190,7 +187,7 @@ empathy_new_chatroom_dialog_show (GtkWindow *parent)
NULL);
gtk_table_attach_defaults (GTK_TABLE (dialog->table_info),
dialog->account_chooser,
- 1, 3, 0, 1);
+ 1, 2, 0, 1);
gtk_widget_show (dialog->account_chooser);
g_signal_connect (GTK_COMBO_BOX (dialog->account_chooser), "changed",
@@ -275,7 +272,6 @@ new_chatroom_dialog_model_add_columns (EmpathyNewChatroomDialog *dialog)
GtkCellRenderer *cell;
view = GTK_TREE_VIEW (dialog->treeview);
- gtk_tree_view_set_headers_visible (view, FALSE);
cell = gtk_cell_renderer_text_new ();
g_object_set (cell,
@@ -312,19 +308,15 @@ new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
/* hardcode here known protocols */
if (strcmp (protocol, "jabber") == 0) {
gtk_widget_set_sensitive (dialog->entry_server, TRUE);
- gtk_widget_show (dialog->vbox_browse);
-
}
else if (strcmp (protocol, "local-xmpp") == 0) {
gtk_widget_set_sensitive (dialog->entry_server, FALSE);
- gtk_widget_show (dialog->vbox_browse);
}
else if (strcmp (protocol, "irc") == 0) {
gtk_widget_set_sensitive (dialog->entry_server, FALSE);
- gtk_widget_show (dialog->vbox_browse);
- } else {
+ }
+ else {
gtk_widget_set_sensitive (dialog->entry_server, TRUE);
- gtk_widget_show (dialog->vbox_browse);
}
room = gtk_entry_get_text (GTK_ENTRY (dialog->entry_room));
@@ -356,7 +348,7 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox *combobox,
account = empathy_account_chooser_get_account (account_chooser);
dialog->room_list = empathy_tp_roomlist_new (account);
- if (dialog->room_list) {
+ if (dialog->room_list) {
g_signal_connect (dialog->room_list, "destroy",
G_CALLBACK (new_chatroom_dialog_roomlist_destroy_cb),
dialog);
@@ -425,16 +417,6 @@ new_chatroom_dialog_listing_cb (EmpathyTpRoomlist *room_list,
} else {
ephy_spinner_stop (EPHY_SPINNER (dialog->throbber));
}
-
- /* Update the refresh toggle button */
- g_signal_handlers_block_by_func (dialog->togglebutton_refresh,
- new_chatroom_dialog_togglebutton_refresh_toggled_cb,
- dialog);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->togglebutton_refresh),
- listing);
- g_signal_handlers_unblock_by_func (dialog->togglebutton_refresh,
- new_chatroom_dialog_togglebutton_refresh_toggled_cb,
- dialog);
}
static void
@@ -542,22 +524,35 @@ static void
new_chatroom_dialog_entry_server_activate_cb (GtkWidget *widget,
EmpathyNewChatroomDialog *dialog)
{
- new_chatroom_dialog_togglebutton_refresh_toggled_cb (dialog->togglebutton_refresh,
- dialog);
+ new_chatroom_dialog_browse_start (dialog);
}
static void
-new_chatroom_dialog_togglebutton_refresh_toggled_cb (GtkWidget *widget,
- EmpathyNewChatroomDialog *dialog)
+new_chatroom_dialog_expander_browse_activate_cb (GtkWidget *widget,
+ EmpathyNewChatroomDialog *dialog)
{
- gboolean toggled;
+ gboolean expanded;
- toggled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
-
- if (toggled) {
- new_chatroom_dialog_browse_start (dialog);
- } else {
+ expanded = gtk_expander_get_expanded (GTK_EXPANDER (widget));
+ if (expanded) {
new_chatroom_dialog_browse_stop (dialog);
+ gtk_window_set_resizable (GTK_WINDOW (dialog->window), FALSE);
+ } else {
+ new_chatroom_dialog_browse_start (dialog);
+ gtk_window_set_resizable (GTK_WINDOW (dialog->window), TRUE);
}
}
+static gboolean
+new_chatroom_dialog_entry_server_focus_out_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ EmpathyNewChatroomDialog *dialog)
+{
+ gboolean expanded;
+
+ expanded = gtk_expander_get_expanded (GTK_EXPANDER (dialog->expander_browse));
+ if (expanded) {
+ new_chatroom_dialog_browse_start (dialog);
+ }
+ return FALSE;
+}
diff --git a/src/empathy-new-chatroom-dialog.ui b/src/empathy-new-chatroom-dialog.ui
index 04927be2c..ba7a326ef 100644
--- a/src/empathy-new-chatroom-dialog.ui
+++ b/src/empathy-new-chatroom-dialog.ui
@@ -4,28 +4,26 @@
<object class="GtkDialog" id="new_chatroom_dialog">
<property name="visible">True</property>
<property name="border_width">5</property>
- <property name="title" translatable="yes">Join New</property>
+ <property name="title" translatable="yes">Join Room</property>
<property name="role">join_new_chatroom</property>
- <property name="resizable">False</property>
<property name="default_width">350</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
- <property name="spacing">6</property>
<child>
<object class="GtkVBox" id="vbox_widgets">
<property name="visible">True</property>
<property name="border_width">5</property>
- <property name="spacing">18</property>
+ <property name="spacing">5</property>
<child>
<object class="GtkTable" id="table_info">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
<child>
<placeholder/>
</child>
@@ -38,30 +36,28 @@
<property name="can_focus">True</property>
<property name="tooltip-text" translatable="yes">Enter the room name to join here or click on one or more rooms in the list.</property>
<property name="activates_default">True</property>
- <property name="width_chars">32</property>
+ <property name="width_chars">25</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
- <property name="y_options"/>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkToggleButton" id="togglebutton_refresh">
+ <object class="GtkLabel" id="label_room">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Re_fresh</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Room:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_room</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -73,23 +69,9 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_room">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Room:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">entry_room</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -121,50 +103,18 @@
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
<child>
- <object class="GtkVBox" id="vbox_browse">
+ <object class="GtkExpander" id="expander_browse">
<property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox_status">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox35">
- <property name="visible">True</property>
- <property name="spacing">3</property>
- <child>
- <object class="GtkImage" id="image_status">
- <property name="visible">True</property>
- <property name="icon_size">2</property>
- <property name="icon_name">gtk-find</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_status">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Browse:</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
+ <property name="can_focus">True</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="width_request">350</property>
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -175,14 +125,17 @@
<object class="GtkTreeView" id="treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="tooltip-text" translatable="yes">This list represents all chat rooms hosted on the server you have entered.</property>
- <property name="headers_visible">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
</object>
</child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Room List</property>
+ </object>
</child>
</object>
<packing>
@@ -191,8 +144,6 @@
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -205,7 +156,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="label">gtk-close</property>
+ <property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
</object>
</child>
@@ -228,7 +179,7 @@
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
- <property name="stock">gtk-execute</property>
+ <property name="stock">gtk-jump-to</property>
</object>
<packing>
<property name="expand">False</property>
@@ -238,7 +189,7 @@
<child>
<object class="GtkLabel" id="label79">
<property name="visible">True</property>
- <property name="label" translatable="yes">Join</property>
+ <property name="label" translatable="yes">_Join</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -265,7 +216,6 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">togglebutton_refresh</action-widget>
<action-widget response="-7">button_cancel</action-widget>
<action-widget response="-5">button_join</action-widget>
</action-widgets>