diff options
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/empathy-debug-dialog.h | 63 | ||||
-rw-r--r-- | src/empathy-debug-window.c (renamed from src/empathy-debug-dialog.c) | 242 | ||||
-rw-r--r-- | src/empathy-debug-window.h | 63 | ||||
-rw-r--r-- | src/empathy-main-window.c | 4 |
5 files changed, 188 insertions, 186 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 6896c03f3..980f0029e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ empathy_handwritten_source = \ empathy-call-window.c empathy-call-window.h \ empathy-call-window-fullscreen.c empathy-call-window-fullscreen.h \ empathy-chatrooms-window.c empathy-chatrooms-window.h \ - empathy-debug-dialog.c empathy-debug-dialog.h \ + empathy-debug-window.c empathy-debug-window.h \ empathy-chat-window.c empathy-chat-window.h \ empathy-event-manager.c empathy-event-manager.h \ empathy-import-mc4-accounts.c empathy-import-mc4-accounts.h \ diff --git a/src/empathy-debug-dialog.h b/src/empathy-debug-dialog.h deleted file mode 100644 index 5d98fa0a4..000000000 --- a/src/empathy-debug-dialog.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -* Copyright (C) 2009 Collabora Ltd. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -* -* Authors: Jonny Lamb <jonny.lamb@collabora.co.uk> -*/ - -#ifndef __EMPATHY_DEBUG_DIALOG_H__ -#define __EMPATHY_DEBUG_DIALOG_H__ - -G_BEGIN_DECLS - -#include <glib-object.h> -#include <gtk/gtk.h> - -#define EMPATHY_TYPE_DEBUG_DIALOG (empathy_debug_dialog_get_type ()) -#define EMPATHY_DEBUG_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST \ - ((object), EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialog)) -#define EMPATHY_DEBUG_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ - EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogClass)) -#define EMPATHY_IS_DEBUG_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE \ - ((object), EMPATHY_TYPE_DEBUG_DIALOG)) -#define EMPATHY_IS_DEBUG_DIALOG_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_DEBUG_DIALOG)) -#define EMPATHY_DEBUG_DIALOG_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS \ - ((object), EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogClass)) - -#define DEBUG_OBJECT_PATH "/org/freedesktop/Telepathy/debug" - -typedef struct _EmpathyDebugDialog EmpathyDebugDialog; -typedef struct _EmpathyDebugDialogClass EmpathyDebugDialogClass; - -struct _EmpathyDebugDialog -{ - GtkDialog parent; - gpointer priv; -}; - -struct _EmpathyDebugDialogClass -{ - GtkDialogClass parent_class; -}; - -GType empathy_debug_dialog_get_type (void) G_GNUC_CONST; - -GtkWidget * empathy_debug_dialog_new (GtkWindow *parent); - -G_END_DECLS - -#endif /* __EMPATHY_DEBUG_DIALOG_H__ */ diff --git a/src/empathy-debug-dialog.c b/src/empathy-debug-window.c index d71542db0..e2f7202e9 100644 --- a/src/empathy-debug-dialog.c +++ b/src/empathy-debug-window.c @@ -36,10 +36,10 @@ #include "extensions/extensions.h" -#include "empathy-debug-dialog.h" +#include "empathy-debug-window.h" -G_DEFINE_TYPE (EmpathyDebugDialog, empathy_debug_dialog, - GTK_TYPE_DIALOG) +G_DEFINE_TYPE (EmpathyDebugWindow, empathy_debug_window, + GTK_TYPE_WINDOW) enum { @@ -66,7 +66,7 @@ enum NUM_COLS_LEVEL }; -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyDebugDialog) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyDebugWindow) typedef struct { /* Toolbar items */ @@ -100,7 +100,7 @@ typedef struct /* Misc. */ gboolean dispose_run; -} EmpathyDebugDialogPriv; +} EmpathyDebugWindowPriv; static const gchar * log_level_to_string (guint level) @@ -132,13 +132,13 @@ log_level_to_string (guint level) } static void -debug_dialog_add_message (EmpathyDebugDialog *debug_dialog, +debug_window_add_message (EmpathyDebugWindow *debug_window, gdouble timestamp, const gchar *domain_category, guint level, const gchar *message) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); gchar *domain, *category; GtkTreeIter iter; gchar *string; @@ -178,7 +178,7 @@ debug_dialog_add_message (EmpathyDebugDialog *debug_dialog, } static void -debug_dialog_new_debug_message_cb (TpProxy *proxy, +debug_window_new_debug_message_cb (TpProxy *proxy, gdouble timestamp, const gchar *domain, guint level, @@ -186,17 +186,17 @@ debug_dialog_new_debug_message_cb (TpProxy *proxy, gpointer user_data, GObject *weak_object) { - EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data; + EmpathyDebugWindow *debug_window = (EmpathyDebugWindow *) user_data; - debug_dialog_add_message (debug_dialog, timestamp, domain, level, + debug_window_add_message (debug_window, timestamp, domain, level, message); } static void -debug_dialog_set_enabled (EmpathyDebugDialog *debug_dialog, +debug_window_set_enabled (EmpathyDebugWindow *debug_window, gboolean enabled) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); GValue *val; val = tp_g_value_slice_new_boolean (enabled); @@ -208,11 +208,11 @@ debug_dialog_set_enabled (EmpathyDebugDialog *debug_dialog, } static void -debug_dialog_set_toolbar_sensitivity (EmpathyDebugDialog *debug_dialog, +debug_window_set_toolbar_sensitivity (EmpathyDebugWindow *debug_window, gboolean sensitive) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); - GtkWidget *vbox = gtk_dialog_get_content_area (GTK_DIALOG (debug_dialog)); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); + GtkWidget *vbox = gtk_bin_get_child (GTK_BIN (debug_window)); gtk_widget_set_sensitive (GTK_WIDGET (priv->save_button), sensitive); gtk_widget_set_sensitive (GTK_WIDGET (priv->copy_button), sensitive); @@ -240,30 +240,30 @@ debug_dialog_set_toolbar_sensitivity (EmpathyDebugDialog *debug_dialog, } static void -debug_dialog_get_messages_cb (TpProxy *proxy, +debug_window_get_messages_cb (TpProxy *proxy, const GPtrArray *messages, const GError *error, gpointer user_data, GObject *weak_object) { - EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data; - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindow *debug_window = (EmpathyDebugWindow *) user_data; + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); gint i; if (error != NULL) { DEBUG ("GetMessages failed: %s", error->message); - debug_dialog_set_toolbar_sensitivity (debug_dialog, FALSE); + debug_window_set_toolbar_sensitivity (debug_window, FALSE); return; } - debug_dialog_set_toolbar_sensitivity (debug_dialog, TRUE); + debug_window_set_toolbar_sensitivity (debug_window, TRUE); for (i = 0; i < messages->len; i++) { GValueArray *values = g_ptr_array_index (messages, i); - debug_dialog_add_message (debug_dialog, + debug_window_add_message (debug_window, g_value_get_double (g_value_array_get_nth (values, 0)), g_value_get_string (g_value_array_get_nth (values, 1)), g_value_get_uint (g_value_array_get_nth (values, 2)), @@ -272,18 +272,18 @@ debug_dialog_get_messages_cb (TpProxy *proxy, /* Connect to NewDebugMessage */ priv->new_debug_message_signal = emp_cli_debug_connect_to_new_debug_message ( - proxy, debug_dialog_new_debug_message_cb, debug_dialog, + proxy, debug_window_new_debug_message_cb, debug_window, NULL, NULL, NULL); /* Set Enabled as appropriate */ - debug_dialog_set_enabled (debug_dialog, !priv->paused); + debug_window_set_enabled (debug_window, !priv->paused); } static void -debug_dialog_cm_chooser_changed_cb (GtkComboBox *cm_chooser, - EmpathyDebugDialog *debug_dialog) +debug_window_cm_chooser_changed_cb (GtkComboBox *cm_chooser, + EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); TpDBusDaemon *dbus; GError *error = NULL; gchar *bus_name; @@ -321,7 +321,7 @@ debug_dialog_cm_chooser_changed_cb (GtkComboBox *cm_chooser, /* Disable debug signalling */ if (priv->proxy != NULL) - debug_dialog_set_enabled (debug_dialog, FALSE); + debug_window_set_enabled (debug_window, FALSE); /* Disconnect from previous NewDebugMessage signal */ if (priv->new_debug_message_signal != NULL) @@ -338,7 +338,7 @@ debug_dialog_cm_chooser_changed_cb (GtkComboBox *cm_chooser, tp_proxy_add_interface_by_id (priv->proxy, emp_iface_quark_debug ()); emp_cli_debug_call_get_messages (priv->proxy, -1, - debug_dialog_get_messages_cb, debug_dialog, NULL, NULL); + debug_window_get_messages_cb, debug_window, NULL, NULL); g_object_unref (dbus); } @@ -350,7 +350,7 @@ typedef struct } CmInModelForeachData; static gboolean -debug_dialog_cms_foreach (GtkTreeModel *model, +debug_window_cms_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) @@ -371,10 +371,10 @@ debug_dialog_cms_foreach (GtkTreeModel *model, } static gboolean -debug_dialog_cm_is_in_model (EmpathyDebugDialog *debug_dialog, +debug_window_cm_is_in_model (EmpathyDebugWindow *debug_window, const gchar *unique_name) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); CmInModelForeachData *data; gboolean found; @@ -383,7 +383,7 @@ debug_dialog_cm_is_in_model (EmpathyDebugDialog *debug_dialog, data->found = FALSE; gtk_tree_model_foreach (GTK_TREE_MODEL (priv->cms), - debug_dialog_cms_foreach, data); + debug_window_cms_foreach, data); found = data->found; @@ -394,19 +394,19 @@ debug_dialog_cm_is_in_model (EmpathyDebugDialog *debug_dialog, typedef struct { - EmpathyDebugDialog *debug_dialog; + EmpathyDebugWindow *debug_window; gchar *cm_name; } FillCmChooserData; static void -debug_dialog_get_name_owner_cb (TpDBusDaemon *proxy, +debug_window_get_name_owner_cb (TpDBusDaemon *proxy, const gchar *out, const GError *error, gpointer user_data, GObject *weak_object) { FillCmChooserData *data = (FillCmChooserData *) user_data; - EmpathyDebugDialogPriv *priv = GET_PRIV (data->debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (data->debug_window); if (error != NULL) { @@ -414,7 +414,7 @@ debug_dialog_get_name_owner_cb (TpDBusDaemon *proxy, goto OUT; } - if (!debug_dialog_cm_is_in_model (data->debug_dialog, out)) + if (!debug_window_cm_is_in_model (data->debug_window, out)) { GtkTreeIter iter; @@ -434,7 +434,7 @@ OUT: } static void -debug_dialog_list_connection_names_cb (const gchar * const *names, +debug_window_list_connection_names_cb (const gchar * const *names, gsize n, const gchar * const *cms, const gchar * const *protocols, @@ -442,7 +442,7 @@ debug_dialog_list_connection_names_cb (const gchar * const *names, gpointer user_data, GObject *weak_object) { - EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data; + EmpathyDebugWindow *debug_window = (EmpathyDebugWindow *) user_data; guint i; TpDBusDaemon *dbus; GError *error2 = NULL; @@ -467,11 +467,11 @@ debug_dialog_list_connection_names_cb (const gchar * const *names, FillCmChooserData *data; data = g_slice_new0 (FillCmChooserData); - data->debug_dialog = debug_dialog; + data->debug_window = debug_window; data->cm_name = g_strdup (cms[i]); tp_cli_dbus_daemon_call_get_name_owner (dbus, -1, - names[i], debug_dialog_get_name_owner_cb, + names[i], debug_window_get_name_owner_cb, data, NULL, NULL); } @@ -479,7 +479,7 @@ debug_dialog_list_connection_names_cb (const gchar * const *names, } static gboolean -debug_dialog_remove_cm_foreach (GtkTreeModel *model, +debug_window_remove_cm_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) @@ -505,14 +505,14 @@ debug_dialog_remove_cm_foreach (GtkTreeModel *model, "org.freedesktop.Telepathy.ConnectionManager." static void -debug_dialog_name_owner_changed_cb (TpDBusDaemon *proxy, +debug_window_name_owner_changed_cb (TpDBusDaemon *proxy, const gchar *arg0, const gchar *arg1, const gchar *arg2, gpointer user_data, GObject *weak_object) { - EmpathyDebugDialogPriv *priv = GET_PRIV (user_data); + EmpathyDebugWindowPriv *priv = GET_PRIV (user_data); /* Wow, I hate all of this code... */ if (!g_str_has_prefix (arg0, CM_WELL_KNOWN_NAME_PREFIX)) @@ -551,16 +551,16 @@ debug_dialog_name_owner_changed_cb (TpDBusDaemon *proxy, DEBUG ("Removing CM from %s.", to_remove); gtk_tree_model_foreach (GTK_TREE_MODEL (priv->cms), - debug_dialog_remove_cm_foreach, to_remove); + debug_window_remove_cm_foreach, to_remove); g_free (to_remove); } } static void -debug_dialog_fill_cm_chooser (EmpathyDebugDialog *debug_dialog) +debug_window_fill_cm_chooser (EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); GError *error = NULL; GtkTreeIter iter; @@ -582,32 +582,32 @@ debug_dialog_fill_cm_chooser (EmpathyDebugDialog *debug_dialog) gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cm_chooser), 0); /* Add CMs to list */ - tp_list_connection_names (priv->dbus, debug_dialog_list_connection_names_cb, - debug_dialog, NULL, NULL); + tp_list_connection_names (priv->dbus, debug_window_list_connection_names_cb, + debug_window, NULL, NULL); priv->name_owner_changed_signal = tp_cli_dbus_daemon_connect_to_name_owner_changed (priv->dbus, - debug_dialog_name_owner_changed_cb, debug_dialog, NULL, NULL, NULL); + debug_window_name_owner_changed_cb, debug_window, NULL, NULL, NULL); } static void -debug_dialog_pause_toggled_cb (GtkToggleToolButton *pause, - EmpathyDebugDialog *debug_dialog) +debug_window_pause_toggled_cb (GtkToggleToolButton *pause, + EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); priv->paused = gtk_toggle_tool_button_get_active (pause); - debug_dialog_set_enabled (debug_dialog, !priv->paused); + debug_window_set_enabled (debug_window, !priv->paused); } static gboolean -debug_dialog_visible_func (GtkTreeModel *model, +debug_window_visible_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) { - EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data; - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindow *debug_window = (EmpathyDebugWindow *) user_data; + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); guint filter_value, level; GtkTreeModel *filter_model; GtkTreeIter filter_iter; @@ -627,29 +627,29 @@ debug_dialog_visible_func (GtkTreeModel *model, } static void -debug_dialog_filter_changed_cb (GtkComboBox *filter, - EmpathyDebugDialog *debug_dialog) +debug_window_filter_changed_cb (GtkComboBox *filter, + EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); gtk_tree_model_filter_refilter ( GTK_TREE_MODEL_FILTER (priv->store_filter)); } static void -debug_dialog_clear_clicked_cb (GtkToolButton *clear_button, - EmpathyDebugDialog *debug_dialog) +debug_window_clear_clicked_cb (GtkToolButton *clear_button, + EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); gtk_list_store_clear (priv->store); } static void -debug_dialog_menu_copy_activate_cb (GtkMenuItem *menu_item, - EmpathyDebugDialog *debug_dialog) +debug_window_menu_copy_activate_cb (GtkMenuItem *menu_item, + EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); GtkTreePath *path; GtkTreeViewColumn *focus_column; GtkTreeIter iter; @@ -688,13 +688,13 @@ debug_dialog_menu_copy_activate_cb (GtkMenuItem *menu_item, typedef struct { - EmpathyDebugDialog *debug_dialog; + EmpathyDebugWindow *debug_window; guint button; guint32 time; } MenuPopupData; static gboolean -debug_dialog_show_menu (gpointer user_data) +debug_window_show_menu (gpointer user_data) { MenuPopupData *data = (MenuPopupData *) user_data; GtkWidget *menu, *item; @@ -706,7 +706,7 @@ debug_dialog_show_menu (gpointer user_data) item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL); g_signal_connect (item, "activate", - G_CALLBACK (debug_dialog_menu_copy_activate_cb), data->debug_dialog); + G_CALLBACK (debug_window_menu_copy_activate_cb), data->debug_window); gtk_menu_shell_append (shell, item); gtk_widget_show (item); @@ -720,7 +720,7 @@ debug_dialog_show_menu (gpointer user_data) } static gboolean -debug_dialog_button_press_event_cb (GtkTreeView *view, +debug_window_button_press_event_cb (GtkTreeView *view, GdkEventButton *event, gpointer user_data) { @@ -731,17 +731,17 @@ debug_dialog_button_press_event_cb (GtkTreeView *view, /* The tree view was right-clicked. (3 == third mouse button) */ MenuPopupData *data; data = g_slice_new0 (MenuPopupData); - data->debug_dialog = user_data; + data->debug_window = user_data; data->button = event->button; data->time = event->time; - g_idle_add (debug_dialog_show_menu, data); + g_idle_add (debug_window_show_menu, data); } return FALSE; } static gboolean -debug_dialog_store_filter_foreach (GtkTreeModel *model, +debug_window_store_filter_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) @@ -788,11 +788,11 @@ debug_dialog_store_filter_foreach (GtkTreeModel *model, } static void -debug_dialog_save_file_chooser_response_cb (GtkDialog *dialog, +debug_window_save_file_chooser_response_cb (GtkDialog *dialog, gint response_id, - EmpathyDebugDialog *debug_dialog) + EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); gchar *filename = NULL; GFile *gfile = NULL; GFileOutputStream *output_stream = NULL; @@ -817,7 +817,7 @@ debug_dialog_save_file_chooser_response_cb (GtkDialog *dialog, } gtk_tree_model_foreach (priv->store_filter, - debug_dialog_store_filter_foreach, output_stream); + debug_window_store_filter_foreach, output_stream); OUT: if (gfile != NULL) @@ -833,13 +833,13 @@ OUT: } static void -debug_dialog_save_clicked_cb (GtkToolButton *tool_button, - EmpathyDebugDialog *debug_dialog) +debug_window_save_clicked_cb (GtkToolButton *tool_button, + EmpathyDebugWindow *debug_window) { GtkWidget *file_chooser; file_chooser = gtk_file_chooser_dialog_new (_("Save"), - GTK_WINDOW (debug_dialog), GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_WINDOW (debug_window), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); @@ -849,14 +849,14 @@ debug_dialog_save_clicked_cb (GtkToolButton *tool_button, GTK_FILE_CHOOSER (file_chooser), TRUE); g_signal_connect (file_chooser, "response", - G_CALLBACK (debug_dialog_save_file_chooser_response_cb), - debug_dialog); + G_CALLBACK (debug_window_save_file_chooser_response_cb), + debug_window); gtk_widget_show (file_chooser); } static gboolean -debug_dialog_copy_model_foreach (GtkTreeModel *model, +debug_window_copy_model_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) @@ -897,17 +897,17 @@ debug_dialog_copy_model_foreach (GtkTreeModel *model, } static void -debug_dialog_copy_clicked_cb (GtkToolButton *tool_button, - EmpathyDebugDialog *debug_dialog) +debug_window_copy_clicked_cb (GtkToolButton *tool_button, + EmpathyDebugWindow *debug_window) { - EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); GtkClipboard *clipboard; gchar *text; text = g_strdup (""); gtk_tree_model_foreach (priv->store_filter, - debug_dialog_copy_model_foreach, &text); + debug_window_copy_model_foreach, &text); clipboard = gtk_clipboard_get_for_display ( gtk_widget_get_display (GTK_WIDGET (tool_button)), @@ -922,12 +922,12 @@ debug_dialog_copy_clicked_cb (GtkToolButton *tool_button, } static GObject * -debug_dialog_constructor (GType type, +debug_window_constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params) { GObject *object; - EmpathyDebugDialogPriv *priv; + EmpathyDebugWindowPriv *priv; GtkWidget *vbox; GtkWidget *toolbar; GtkWidget *image; @@ -937,14 +937,16 @@ debug_dialog_constructor (GType type, GtkListStore *level_store; GtkTreeIter iter; - object = G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->constructor + object = G_OBJECT_CLASS (empathy_debug_window_parent_class)->constructor (type, n_construct_params, construct_params); priv = GET_PRIV (object); gtk_window_set_title (GTK_WINDOW (object), _("Debug Window")); gtk_window_set_default_size (GTK_WINDOW (object), 800, 400); - vbox = gtk_dialog_get_content_area (GTK_DIALOG (object)); + vbox = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (object), vbox); + gtk_widget_show (vbox); toolbar = gtk_toolbar_new (); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ); @@ -967,7 +969,7 @@ debug_dialog_constructor (GType type, gtk_container_add (GTK_CONTAINER (item), priv->cm_chooser); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); g_signal_connect (priv->cm_chooser, "changed", - G_CALLBACK (debug_dialog_cm_chooser_changed_cb), object); + G_CALLBACK (debug_window_cm_chooser_changed_cb), object); gtk_widget_show (GTK_WIDGET (priv->cm_chooser)); item = gtk_separator_tool_item_new (); @@ -977,7 +979,7 @@ debug_dialog_constructor (GType type, /* Save */ priv->save_button = gtk_tool_button_new_from_stock (GTK_STOCK_SAVE); g_signal_connect (priv->save_button, "clicked", - G_CALLBACK (debug_dialog_save_clicked_cb), object); + G_CALLBACK (debug_window_save_clicked_cb), object); gtk_widget_show (GTK_WIDGET (priv->save_button)); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (priv->save_button), TRUE); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), priv->save_button, -1); @@ -985,7 +987,7 @@ debug_dialog_constructor (GType type, /* Copy */ priv->copy_button = gtk_tool_button_new_from_stock (GTK_STOCK_COPY); g_signal_connect (priv->copy_button, "clicked", - G_CALLBACK (debug_dialog_copy_clicked_cb), object); + G_CALLBACK (debug_window_copy_clicked_cb), object); gtk_widget_show (GTK_WIDGET (priv->copy_button)); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (priv->copy_button), TRUE); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), priv->copy_button, -1); @@ -993,7 +995,7 @@ debug_dialog_constructor (GType type, /* Clear */ priv->clear_button = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR); g_signal_connect (priv->clear_button, "clicked", - G_CALLBACK (debug_dialog_clear_clicked_cb), object); + G_CALLBACK (debug_window_clear_clicked_cb), object); gtk_widget_show (GTK_WIDGET (priv->clear_button)); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (priv->clear_button), TRUE); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), priv->clear_button, -1); @@ -1011,7 +1013,7 @@ debug_dialog_constructor (GType type, gtk_toggle_tool_button_set_active ( GTK_TOGGLE_TOOL_BUTTON (priv->pause_button), priv->paused); g_signal_connect (priv->pause_button, "toggled", - G_CALLBACK (debug_dialog_pause_toggled_cb), object); + G_CALLBACK (debug_window_pause_toggled_cb), object); gtk_widget_show (GTK_WIDGET (priv->pause_button)); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (priv->pause_button), TRUE); gtk_tool_button_set_label (GTK_TOOL_BUTTON (priv->pause_button), _("Pause")); @@ -1082,14 +1084,14 @@ debug_dialog_constructor (GType type, gtk_combo_box_set_active (GTK_COMBO_BOX (priv->level_filter), 0); g_signal_connect (priv->level_filter, "changed", - G_CALLBACK (debug_dialog_filter_changed_cb), object); + G_CALLBACK (debug_window_filter_changed_cb), object); /* Debug treeview */ priv->view = gtk_tree_view_new (); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->view), TRUE); g_signal_connect (priv->view, "button-press-event", - G_CALLBACK (debug_dialog_button_press_event_cb), object); + G_CALLBACK (debug_window_button_press_event_cb), object); renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "yalign", 0, NULL); @@ -1117,7 +1119,7 @@ debug_dialog_constructor (GType type, gtk_tree_model_filter_set_visible_func ( GTK_TREE_MODEL_FILTER (priv->store_filter), - debug_dialog_visible_func, object, NULL); + debug_window_visible_func, object, NULL); gtk_tree_view_set_model (GTK_TREE_VIEW (priv->view), priv->store_filter); @@ -1140,27 +1142,27 @@ debug_dialog_constructor (GType type, priv->view_visible = FALSE; - debug_dialog_set_toolbar_sensitivity (EMPATHY_DEBUG_DIALOG (object), FALSE); - debug_dialog_fill_cm_chooser (EMPATHY_DEBUG_DIALOG (object)); + debug_window_set_toolbar_sensitivity (EMPATHY_DEBUG_WINDOW (object), FALSE); + debug_window_fill_cm_chooser (EMPATHY_DEBUG_WINDOW (object)); gtk_widget_show (GTK_WIDGET (object)); return object; } static void -empathy_debug_dialog_init (EmpathyDebugDialog *empathy_debug_dialog) +empathy_debug_window_init (EmpathyDebugWindow *empathy_debug_window) { - EmpathyDebugDialogPriv *priv = - G_TYPE_INSTANCE_GET_PRIVATE (empathy_debug_dialog, - EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogPriv); + EmpathyDebugWindowPriv *priv = + G_TYPE_INSTANCE_GET_PRIVATE (empathy_debug_window, + EMPATHY_TYPE_DEBUG_WINDOW, EmpathyDebugWindowPriv); - empathy_debug_dialog->priv = priv; + empathy_debug_window->priv = priv; priv->dispose_run = FALSE; } static void -debug_dialog_set_property (GObject *object, +debug_window_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) @@ -1174,7 +1176,7 @@ debug_dialog_set_property (GObject *object, } static void -debug_dialog_get_property (GObject *object, +debug_window_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) @@ -1188,10 +1190,10 @@ debug_dialog_get_property (GObject *object, } static void -debug_dialog_dispose (GObject *object) +debug_window_dispose (GObject *object) { - EmpathyDebugDialog *selector = EMPATHY_DEBUG_DIALOG (object); - EmpathyDebugDialogPriv *priv = GET_PRIV (selector); + EmpathyDebugWindow *selector = EMPATHY_DEBUG_WINDOW (object); + EmpathyDebugWindowPriv *priv = GET_PRIV (selector); if (priv->dispose_run) return; @@ -1206,7 +1208,7 @@ debug_dialog_dispose (GObject *object) if (priv->proxy != NULL) { - debug_dialog_set_enabled (EMPATHY_DEBUG_DIALOG (object), FALSE); + debug_window_set_enabled (EMPATHY_DEBUG_WINDOW (object), FALSE); g_object_unref (priv->proxy); } @@ -1219,27 +1221,27 @@ debug_dialog_dispose (GObject *object) if (priv->dbus != NULL) g_object_unref (priv->dbus); - (G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->dispose) (object); + (G_OBJECT_CLASS (empathy_debug_window_parent_class)->dispose) (object); } static void -empathy_debug_dialog_class_init (EmpathyDebugDialogClass *klass) +empathy_debug_window_class_init (EmpathyDebugWindowClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->constructor = debug_dialog_constructor; - object_class->dispose = debug_dialog_dispose; - object_class->set_property = debug_dialog_set_property; - object_class->get_property = debug_dialog_get_property; - g_type_class_add_private (klass, sizeof (EmpathyDebugDialogPriv)); + object_class->constructor = debug_window_constructor; + object_class->dispose = debug_window_dispose; + object_class->set_property = debug_window_set_property; + object_class->get_property = debug_window_get_property; + g_type_class_add_private (klass, sizeof (EmpathyDebugWindowPriv)); } /* public methods */ GtkWidget * -empathy_debug_dialog_new (GtkWindow *parent) +empathy_debug_window_new (GtkWindow *parent) { g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL); - return GTK_WIDGET (g_object_new (EMPATHY_TYPE_DEBUG_DIALOG, + return GTK_WIDGET (g_object_new (EMPATHY_TYPE_DEBUG_WINDOW, "transient-for", parent, NULL)); } diff --git a/src/empathy-debug-window.h b/src/empathy-debug-window.h new file mode 100644 index 000000000..22eec3f6f --- /dev/null +++ b/src/empathy-debug-window.h @@ -0,0 +1,63 @@ +/* +* Copyright (C) 2009 Collabora Ltd. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +* +* Authors: Jonny Lamb <jonny.lamb@collabora.co.uk> +*/ + +#ifndef __EMPATHY_DEBUG_WINDOW_H__ +#define __EMPATHY_DEBUG_WINDOW_H__ + +G_BEGIN_DECLS + +#include <glib-object.h> +#include <gtk/gtk.h> + +#define EMPATHY_TYPE_DEBUG_WINDOW (empathy_debug_window_get_type ()) +#define EMPATHY_DEBUG_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST \ + ((object), EMPATHY_TYPE_DEBUG_WINDOW, EmpathyDebugWindow)) +#define EMPATHY_DEBUG_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + EMPATHY_TYPE_DEBUG_WINDOW, EmpathyDebugWindowClass)) +#define EMPATHY_IS_DEBUG_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE \ + ((object), EMPATHY_TYPE_DEBUG_WINDOW)) +#define EMPATHY_IS_DEBUG_WINDOW_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_DEBUG_WINDOW)) +#define EMPATHY_DEBUG_WINDOW_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS \ + ((object), EMPATHY_TYPE_DEBUG_WINDOW, EmpathyDebugWindowClass)) + +#define DEBUG_OBJECT_PATH "/org/freedesktop/Telepathy/debug" + +typedef struct _EmpathyDebugWindow EmpathyDebugWindow; +typedef struct _EmpathyDebugWindowClass EmpathyDebugWindowClass; + +struct _EmpathyDebugWindow +{ + GtkWindow parent; + gpointer priv; +}; + +struct _EmpathyDebugWindowClass +{ + GtkWindowClass parent_class; +}; + +GType empathy_debug_window_get_type (void) G_GNUC_CONST; + +GtkWidget * empathy_debug_window_new (GtkWindow *parent); + +G_END_DECLS + +#endif /* __EMPATHY_DEBUG_WINDOW_H__ */ diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index d61a05c27..8fb127b90 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -54,7 +54,7 @@ #include "ephy-spinner.h" #include "empathy-preferences.h" #include "empathy-about-dialog.h" -#include "empathy-debug-dialog.h" +#include "empathy-debug-window.h" #include "empathy-new-chatroom-dialog.h" #include "empathy-map-view.h" #include "empathy-chatrooms-window.h" @@ -1064,7 +1064,7 @@ static void main_window_help_debug_cb (GtkAction *action, EmpathyMainWindow *window) { - empathy_debug_dialog_new (GTK_WINDOW (window->window)); + empathy_debug_window_new (GTK_WINDOW (window->window)); } static void |