#include "config.h"
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
#include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-irc-network-manager.h>
+#include "libempathy/empathy-utils.h"
+#include "libempathy/empathy-irc-network-manager.h"
#include "empathy-irc-network-dialog.h"
-#include "empathy-ui-utils.h"
#include "empathy-live-search.h"
#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
-#include <libempathy/empathy-debug.h>
+#include "libempathy/empathy-debug.h"
#include "empathy-irc-network-chooser-dialog.h"
gint response,
EmpathyIrcNetworkChooserDialog *self)
{
- if (response == GTK_RESPONSE_OK)
- add_network (self);
- else if (response == GTK_RESPONSE_APPLY)
- edit_network (self);
- else if (response == GTK_RESPONSE_REJECT)
- remove_network (self);
- else if (response == RESPONSE_RESET)
+ if (response == RESPONSE_RESET)
reset_networks (self);
}
}
static void
-dialog_destroy_cb (GtkWidget *widget,
+add_clicked_cb (GtkToolButton *button,
EmpathyIrcNetworkChooserDialog *self)
{
- EmpathyIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+ add_network (self);
+}
+
+static void
+remove_clicked_cb (GtkToolButton *button,
+ EmpathyIrcNetworkChooserDialog *self)
+{
+ remove_network (self);
+}
- g_signal_handler_disconnect (priv->search, priv->search_sig);
- g_signal_handler_disconnect (priv->search, priv->activate_sig);
+static void
+edit_clicked_cb (GtkToolButton *button,
+ EmpathyIrcNetworkChooserDialog *self)
+{
+ edit_network (self);
}
static void
GtkWidget *vbox;
GtkTreeViewColumn *column;
GtkWidget *scroll;
+ GtkWidget *toolbar;
+ GtkToolItem *item;
+ GtkStyleContext *context;
g_assert (priv->settings != NULL);
gtk_container_add (GTK_CONTAINER (scroll), priv->treeview);
gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 6);
+ /* Treeview toolbar */
+ toolbar = gtk_toolbar_new ();
+ gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
+ gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
+
+ item = gtk_tool_button_new (NULL, "");
+ gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-add-symbolic");
+ g_signal_connect (item, "clicked", G_CALLBACK (add_clicked_cb), self);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
+ item = gtk_tool_button_new (NULL, "");
+ gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
+ "list-remove-symbolic");
+ g_signal_connect (item, "clicked", G_CALLBACK (remove_clicked_cb), self);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
+ item = gtk_tool_button_new (NULL, "");
+ gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
+ "preferences-system-symbolic");
+ g_signal_connect (item, "clicked", G_CALLBACK (edit_clicked_cb), self);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
+ context = gtk_widget_get_style_context (scroll);
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+
+ context = gtk_widget_get_style_context (toolbar);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
/* Live search */
priv->search = empathy_live_search_new (priv->treeview);
/* Add buttons */
gtk_dialog_add_buttons (dialog,
- GTK_STOCK_ADD, GTK_RESPONSE_OK,
- GTK_STOCK_EDIT, GTK_RESPONSE_APPLY,
- GTK_STOCK_REMOVE, GTK_RESPONSE_REJECT,
_("Reset _Networks List"), RESPONSE_RESET,
NULL);
g_signal_connect (self, "response",
G_CALLBACK (dialog_response_cb), self);
- g_signal_connect (self, "destroy",
- G_CALLBACK (dialog_destroy_cb), self);
/* Request a side ensuring to display at least some networks */
gtk_widget_set_size_request (GTK_WIDGET (self), -1, 300);
EmpathyIrcNetworkManager *self = (EmpathyIrcNetworkManager *) object;
EmpathyIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+ if (priv->search_sig != 0)
+ {
+ g_signal_handler_disconnect (priv->search, priv->search_sig);
+ priv->search_sig = 0;
+ }
+
+ if (priv->activate_sig != 0)
+ {
+ g_signal_handler_disconnect (priv->search, priv->activate_sig);
+ priv->activate_sig = 0;
+ }
+
+ if (priv->search != NULL)
+ {
+ empathy_live_search_set_hook_widget (EMPATHY_LIVE_SEARCH (priv->search),
+ NULL);
+
+ priv->search = NULL;
+ }
+
tp_clear_object (&priv->settings);
tp_clear_object (&priv->network);
tp_clear_object (&priv->network_manager);