enum {
NEW_ROOM,
DESTROY,
+ ERROR,
LAST_SIGNAL
};
static void
call_list_rooms_cb (TpChannel *proxy,
const GError *error,
- gpointer user_data,
+ gpointer list,
GObject *weak_object)
{
if (error != NULL) {
DEBUG ("Error listing rooms: %s", error->message);
+ g_signal_emit_by_name (list, "error::start", error);
}
}
static void
stop_listing_cb (TpChannel *proxy,
const GError *error,
- gpointer user_data,
+ gpointer list,
GObject *weak_object)
{
if (error != NULL) {
DEBUG ("Error on stop listing: %s", error->message);
+ g_signal_emit_by_name (list, "error::stop", error);
}
}
if (priv->start_requested == TRUE) {
tp_cli_channel_type_room_list_call_list_rooms (priv->channel, -1,
- call_list_rooms_cb, NULL, NULL, NULL);
+ call_list_rooms_cb, list, NULL, NULL);
priv->start_requested = FALSE;
}
}
G_TYPE_NONE,
0);
+ signals[ERROR] =
+ g_signal_new ("error",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1, G_TYPE_POINTER);
+
g_type_class_add_private (object_class, sizeof (EmpathyTpRoomlistPriv));
}
g_return_if_fail (EMPATHY_IS_TP_ROOMLIST (list));
if (priv->channel != NULL) {
tp_cli_channel_type_room_list_call_list_rooms (priv->channel, -1,
- call_list_rooms_cb, NULL, NULL, NULL);
+ call_list_rooms_cb, list, NULL, NULL);
} else {
priv->start_requested = TRUE;
}
g_return_if_fail (TP_IS_CHANNEL (priv->channel));
tp_cli_channel_type_room_list_call_stop_listing (priv->channel, -1,
- stop_listing_cb, NULL, NULL, NULL);
+ stop_listing_cb, list, NULL, NULL);
}
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n.h>
+#include <glib/gprintf.h>
#include <libmissioncontrol/mission-control.h>
#include <libmissioncontrol/mc-account.h>
GtkWidget *treeview;
GtkTreeModel *model;
GtkWidget *button_join;
- GtkWidget *button_close;
+ GtkWidget *label_error_message;
+ GtkWidget *viewport_error;
} EmpathyNewChatroomDialog;
enum {
static void new_chatroom_dialog_listing_cb (EmpathyTpRoomlist *room_list,
gpointer unused,
EmpathyNewChatroomDialog *dialog);
+static void start_listing_error_cb (EmpathyTpRoomlist *room_list,
+ GError *error,
+ EmpathyNewChatroomDialog *dialog);
+static void stop_listing_error_cb (EmpathyTpRoomlist *room_list,
+ GError *error,
+ EmpathyNewChatroomDialog *dialog);
static void new_chatroom_dialog_model_clear (EmpathyNewChatroomDialog *dialog);
static void new_chatroom_dialog_model_row_activated_cb (GtkTreeView *tree_view,
GtkTreePath *path,
static gboolean new_chatroom_dialog_entry_server_focus_out_cb (GtkWidget *widget,
GdkEventFocus *event,
EmpathyNewChatroomDialog *dialog);
+static void new_chatroom_dialog_button_close_error_clicked_cb (GtkButton *button,
+ EmpathyNewChatroomDialog *dialog);
static EmpathyNewChatroomDialog *dialog_p = NULL;
"treeview", &dialog->treeview,
"button_join", &dialog->button_join,
"expander_browse", &dialog->expander_browse,
+ "label_error_message", &dialog->label_error_message,
+ "viewport_error", &dialog->viewport_error,
NULL);
g_free (filename);
"entry_server", "focus-out-event", new_chatroom_dialog_entry_server_focus_out_cb,
"entry_room", "changed", new_chatroom_dialog_entry_changed_cb,
"expander_browse", "activate", new_chatroom_dialog_expander_browse_activate_cb,
+ "button_close_error", "clicked", new_chatroom_dialog_button_close_error_clicked_cb,
NULL);
g_object_unref (gui);
g_signal_connect (dialog->room_list, "notify::is-listing",
G_CALLBACK (new_chatroom_dialog_listing_cb),
dialog);
+ g_signal_connect (dialog->room_list, "error::start",
+ G_CALLBACK (start_listing_error_cb),
+ dialog);
+ g_signal_connect (dialog->room_list, "error::stop",
+ G_CALLBACK (stop_listing_error_cb),
+ dialog);
expanded = gtk_expander_get_expanded (GTK_EXPANDER (dialog->expander_browse));
if (expanded) {
+ gtk_widget_hide (dialog->viewport_error);
+ gtk_widget_set_sensitive (dialog->treeview, TRUE);
new_chatroom_dialog_browse_start (dialog);
}
g_object_unref (account);
}
+static void
+new_chatroom_dialog_button_close_error_clicked_cb (GtkButton *button,
+ EmpathyNewChatroomDialog *dialog)
+{
+ gtk_widget_hide (dialog->viewport_error);
+}
+
static void
new_chatroom_dialog_roomlist_destroy_cb (EmpathyTpRoomlist *room_list,
EmpathyNewChatroomDialog *dialog)
g_free (tooltip);
}
+static void
+start_listing_error_cb (EmpathyTpRoomlist *room_list,
+ GError *error,
+ EmpathyNewChatroomDialog *dialog)
+{
+ gtk_label_set_text (GTK_LABEL (dialog->label_error_message), _("Could not start room listing"));
+ gtk_widget_show_all (dialog->viewport_error);
+ gtk_widget_set_sensitive (dialog->treeview, FALSE);
+}
+
+static void
+stop_listing_error_cb (EmpathyTpRoomlist *room_list,
+ GError *error,
+ EmpathyNewChatroomDialog *dialog)
+{
+ gtk_label_set_text (GTK_LABEL (dialog->label_error_message), _("Could not stop room listing"));
+ gtk_widget_show_all (dialog->viewport_error);
+ gtk_widget_set_sensitive (dialog->treeview, FALSE);
+}
+
static void
new_chatroom_dialog_listing_cb (EmpathyTpRoomlist *room_list,
gpointer unused,
new_chatroom_dialog_browse_stop (dialog);
gtk_window_set_resizable (GTK_WINDOW (dialog->window), FALSE);
} else {
+ gtk_widget_hide (dialog->viewport_error);
+ gtk_widget_set_sensitive (dialog->treeview, TRUE);
new_chatroom_dialog_browse_start (dialog);
gtk_window_set_resizable (GTK_WINDOW (dialog->window), TRUE);
}
<?xml version="1.0"?>
-<!--*- mode: xml -*-->
<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="new_chatroom_dialog">
<property name="visible">True</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Join Room</property>
<property name="role">join_new_chatroom</property>
<property name="default_width">350</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="n_columns">3</property>
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
<child>
<object class="GtkEntry" id="entry_room">
<property name="visible">True</property>
<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="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">25</property>
</object>
<object class="GtkEntry" id="entry_server">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="tooltip-text" translatable="yes">Enter the server which hosts the room, or leave it empty if the room is on the current account's server</property>
+ <property name="tooltip_text" translatable="yes">Enter the server which hosts the room, or leave it empty if the room is on the current account's server</property>
<property name="width_chars">25</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="y_options"></property>
</packing>
</child>
<child>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="y_options"></property>
</packing>
</child>
<child>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="y_options"></property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="width_request">350</property>
- <property name="height_request">150</property>
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkViewport" id="viewport_error">
+ <property name="resize_mode">queue</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-error</property>
+ <property name="icon-size">1</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_error_message">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">10</property>
+ <property name="label" translatable="yes">Couldn't load room list</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_close_error">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-close</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkTreeView" id="treeview">
+ <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>
- <property name="search_column">0</property>
- <property name="show_expanders">False</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button_cancel">
+ <property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="label">gtk-cancel</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkButton" id="button_join">
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
+ <property name="receives_default">False</property>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</object>