2 * Copyright (C) 2009 Collabora Ltd.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk>
25 #include <glib/gi18n.h>
27 #include <glib/gstdio.h>
29 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
30 #include <libempathy/empathy-debug.h>
31 #include <libempathy/empathy-utils.h>
33 #include <libempathy-gtk/empathy-account-chooser.h>
35 #include <telepathy-glib/dbus.h>
36 #include <telepathy-glib/util.h>
37 #include <telepathy-glib/proxy-subclass.h>
39 #include "extensions/extensions.h"
41 #include "empathy-debug-dialog.h"
43 G_DEFINE_TYPE (EmpathyDebugDialog, empathy_debug_dialog,
54 COL_DEBUG_TIMESTAMP = 0,
57 COL_DEBUG_LEVEL_STRING,
59 COL_DEBUG_LEVEL_VALUE,
77 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyDebugDialog)
83 GtkWidget *cm_chooser;
85 GtkTreeModel *store_filter;
87 TpProxySignalConnection *signal_connection;
91 } EmpathyDebugDialogPriv;
94 log_level_to_string (guint level)
98 case EMP_DEBUG_LEVEL_ERROR:
101 case EMP_DEBUG_LEVEL_CRITICAL:
102 return _("Critical");
104 case EMP_DEBUG_LEVEL_WARNING:
107 case EMP_DEBUG_LEVEL_MESSAGE:
110 case EMP_DEBUG_LEVEL_INFO:
113 case EMP_DEBUG_LEVEL_DEBUG:
117 g_assert_not_reached ();
123 debug_dialog_add_message (EmpathyDebugDialog *debug_dialog,
125 const gchar *domain_category,
127 const gchar *message)
129 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
130 gchar *domain, *category;
134 if (g_strrstr (domain_category, "/"))
136 gchar **parts = g_strsplit (domain_category, "/", 2);
137 domain = g_strdup (parts[0]);
138 category = g_strdup (parts[1]);
143 domain = g_strdup (domain_category);
144 category = g_strdup ("");
147 if (g_str_has_suffix (message, "\n"))
148 string = g_strchomp (g_strdup (message));
150 string = g_strdup (message);
153 gtk_list_store_append (priv->store, &iter);
154 gtk_list_store_set (priv->store, &iter,
155 COL_DEBUG_TIMESTAMP, timestamp,
156 COL_DEBUG_DOMAIN, domain,
157 COL_DEBUG_CATEGORY, category,
158 COL_DEBUG_LEVEL_STRING, log_level_to_string (level),
159 COL_DEBUG_MESSAGE, string,
160 COL_DEBUG_LEVEL_VALUE, level,
169 debug_dialog_new_debug_message_cb (TpProxy *proxy,
173 const gchar *message,
175 GObject *weak_object)
177 EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data;
179 debug_dialog_add_message (debug_dialog, timestamp, domain, level,
184 debug_dialog_set_enabled (EmpathyDebugDialog *debug_dialog,
187 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
190 val = tp_g_value_slice_new_boolean (enabled);
192 tp_cli_dbus_properties_call_set (priv->proxy, -1, EMP_IFACE_DEBUG,
193 "Enabled", val, NULL, NULL, NULL, NULL);
195 tp_g_value_slice_free (val);
199 debug_dialog_get_messages_cb (TpProxy *proxy,
200 const GPtrArray *messages,
203 GObject *weak_object)
205 EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data;
206 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
211 DEBUG ("GetMessages failed: %s", error->message);
215 for (i = 0; i < messages->len; i++)
217 GValueArray *values = g_ptr_array_index (messages, i);
219 debug_dialog_add_message (debug_dialog,
220 g_value_get_double (g_value_array_get_nth (values, 0)),
221 g_value_get_string (g_value_array_get_nth (values, 1)),
222 g_value_get_uint (g_value_array_get_nth (values, 2)),
223 g_value_get_string (g_value_array_get_nth (values, 3)));
226 /* Connect to NewDebugMessage */
227 priv->signal_connection = emp_cli_debug_connect_to_new_debug_message (
228 proxy, debug_dialog_new_debug_message_cb, debug_dialog,
231 /* Set Enabled as appropriate */
232 debug_dialog_set_enabled (debug_dialog, !priv->paused);
236 debug_dialog_cm_chooser_changed_cb (GtkComboBox *cm_chooser,
237 EmpathyDebugDialog *debug_dialog)
239 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
242 GError *error = NULL;
244 TpConnection *connection;
247 if (!gtk_combo_box_get_active_iter (cm_chooser, &iter))
249 DEBUG ("No CM is selected");
253 mc = empathy_mission_control_dup_singleton ();
254 dbus = tp_dbus_daemon_dup (&error);
258 DEBUG ("Failed at duping the dbus daemon: %s", error->message);
262 gtk_tree_model_get (GTK_TREE_MODEL (priv->cms), &iter,
263 COL_CM_BUS, &bus_name, -1);
264 connection = tp_connection_new (dbus, bus_name, DEBUG_OBJECT_PATH, &error);
269 DEBUG ("Getting a new TpConnection failed: %s", error->message);
270 g_error_free (error);
271 g_object_unref (dbus);
276 gtk_list_store_clear (priv->store);
278 /* Disable debug signalling */
279 if (priv->proxy != NULL)
280 debug_dialog_set_enabled (debug_dialog, FALSE);
282 /* Disconnect from previous NewDebugMessage signal */
283 if (priv->signal_connection)
285 tp_proxy_signal_connection_disconnect (priv->signal_connection);
286 priv->signal_connection = NULL;
290 g_object_unref (priv->proxy);
292 priv->proxy = TP_PROXY (connection);
294 tp_proxy_add_interface_by_id (priv->proxy, emp_iface_quark_debug ());
296 emp_cli_debug_call_get_messages (priv->proxy, -1,
297 debug_dialog_get_messages_cb, debug_dialog, NULL, NULL);
299 g_object_unref (dbus);
304 debug_dialog_list_connection_names_cb (const gchar * const *names,
306 const gchar * const *cms,
307 const gchar * const *protocols,
310 GObject *weak_object)
312 EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data;
313 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
318 DEBUG ("list_connection_names failed: %s", error->message);
322 for (i = 0; cms[i] != NULL; i++)
325 gtk_list_store_append (priv->cms, &iter);
326 gtk_list_store_set (priv->cms, &iter,
328 COL_CM_BUS, names[i],
332 gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cm_chooser), 0);
335 debug_dialog_cm_chooser_changed_cb (GTK_COMBO_BOX (priv->cm_chooser), debug_dialog);
339 debug_dialog_fill_cm_chooser (EmpathyDebugDialog *debug_dialog)
342 GError *error = NULL;
344 dbus = tp_dbus_daemon_dup (&error);
348 DEBUG ("Failed to dup dbus daemon: %s", error->message);
349 g_error_free (error);
353 tp_list_connection_names (dbus, debug_dialog_list_connection_names_cb,
354 debug_dialog, NULL, NULL);
356 g_object_unref (dbus);
360 debug_dialog_pause_toggled_cb (GtkToggleToolButton *pause,
361 EmpathyDebugDialog *debug_dialog)
363 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
365 priv->paused = gtk_toggle_tool_button_get_active (pause);
367 debug_dialog_set_enabled (debug_dialog, !priv->paused);
371 debug_dialog_visible_func (GtkTreeModel *model,
375 EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data;
376 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
377 guint filter_value, level;
378 GtkTreeModel *filter_model;
379 GtkTreeIter filter_iter;
381 filter_model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->filter));
382 gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->filter),
385 gtk_tree_model_get (model, iter, COL_DEBUG_LEVEL_VALUE, &level, -1);
386 gtk_tree_model_get (filter_model, &filter_iter,
387 COL_LEVEL_VALUE, &filter_value, -1);
389 if (level <= filter_value)
396 debug_dialog_filter_changed_cb (GtkComboBox *filter,
397 EmpathyDebugDialog *debug_dialog)
399 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
401 gtk_tree_model_filter_refilter (
402 GTK_TREE_MODEL_FILTER (priv->store_filter));
406 debug_dialog_clear_clicked_cb (GtkToolButton *clear_button,
407 EmpathyDebugDialog *debug_dialog)
409 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
411 gtk_list_store_clear (priv->store);
415 debug_dialog_menu_copy_activate_cb (GtkMenuItem *menu_item,
416 EmpathyDebugDialog *debug_dialog)
418 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
420 GtkTreeViewColumn *focus_column;
423 GtkClipboard *clipboard;
425 gtk_tree_view_get_cursor (GTK_TREE_VIEW (priv->view),
426 &path, &focus_column);
430 DEBUG ("No row is in focus");
434 gtk_tree_model_get_iter (priv->store_filter, &iter, path);
436 gtk_tree_model_get (priv->store_filter, &iter,
437 COL_DEBUG_MESSAGE, &message,
440 if (EMP_STR_EMPTY (message))
442 DEBUG ("Log message is empty");
446 clipboard = gtk_clipboard_get_for_display (
447 gtk_widget_get_display (GTK_WIDGET (menu_item)),
448 GDK_SELECTION_CLIPBOARD);
450 gtk_clipboard_set_text (clipboard, message, -1);
457 EmpathyDebugDialog *debug_dialog;
463 debug_dialog_show_menu (gpointer user_data)
465 MenuPopupData *data = (MenuPopupData *) user_data;
466 GtkWidget *menu, *item;
469 menu = gtk_menu_new ();
470 shell = GTK_MENU_SHELL (menu);
472 item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
474 g_signal_connect (item, "activate",
475 G_CALLBACK (debug_dialog_menu_copy_activate_cb), data->debug_dialog);
477 gtk_menu_shell_append (shell, item);
478 gtk_widget_show (item);
480 gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
481 data->button, data->time);
483 g_slice_free (MenuPopupData, user_data);
489 debug_dialog_button_press_event_cb (GtkTreeView *view,
490 GdkEventButton *event,
493 if (event->button == 3)
496 data = g_slice_new0 (MenuPopupData);
497 data->debug_dialog = user_data;
498 data->button = event->button;
499 data->time = event->time;
500 g_idle_add (debug_dialog_show_menu, data);
507 debug_dialog_store_filter_foreach (GtkTreeModel *model,
512 FILE *file = (FILE *) user_data;
513 gchar *domain, *category, *message, *level_str, *level_upper;
516 gtk_tree_model_get (model, iter,
517 COL_DEBUG_TIMESTAMP, ×tamp,
518 COL_DEBUG_DOMAIN, &domain,
519 COL_DEBUG_CATEGORY, &category,
520 COL_DEBUG_LEVEL_STRING, &level_str,
521 COL_DEBUG_MESSAGE, &message,
524 level_upper = g_ascii_strup (level_str, -1);
526 g_fprintf (file, "%s%s%s-%s: %e: %s\n",
527 domain, EMP_STR_EMPTY (category) ? "" : "/",
528 category, level_upper, timestamp, message);
530 g_free (level_upper);
540 debug_dialog_save_file_chooser_response_cb (GtkDialog *dialog,
542 EmpathyDebugDialog *debug_dialog)
544 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
545 gchar *filename = NULL;
548 if (response_id != GTK_RESPONSE_ACCEPT)
551 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
553 DEBUG ("Saving log as %s", filename);
555 file = g_fopen (filename, "w");
558 DEBUG ("Failed to open file: %s", g_strerror (errno));
562 gtk_tree_model_foreach (priv->store_filter,
563 debug_dialog_store_filter_foreach, file);
568 if (filename != NULL)
571 gtk_widget_destroy (GTK_WIDGET (dialog));
575 debug_dialog_save_clicked_cb (GtkToolButton *tool_button,
576 EmpathyDebugDialog *debug_dialog)
578 GtkWidget *file_chooser;
580 file_chooser = gtk_file_chooser_dialog_new (_("Save"),
581 GTK_WINDOW (debug_dialog), GTK_FILE_CHOOSER_ACTION_SAVE,
582 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
583 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
586 gtk_window_set_modal (GTK_WINDOW (file_chooser), TRUE);
587 gtk_file_chooser_set_do_overwrite_confirmation (
588 GTK_FILE_CHOOSER (file_chooser), TRUE);
590 g_signal_connect (file_chooser, "response",
591 G_CALLBACK (debug_dialog_save_file_chooser_response_cb),
594 gtk_widget_show (file_chooser);
598 debug_dialog_constructor (GType type,
599 guint n_construct_params,
600 GObjectConstructParam *construct_params)
603 EmpathyDebugDialogPriv *priv;
609 GtkCellRenderer *renderer;
610 GtkWidget *scrolled_win;
611 GtkListStore *level_store;
614 object = G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->constructor
615 (type, n_construct_params, construct_params);
616 priv = GET_PRIV (object);
618 gtk_window_set_title (GTK_WINDOW (object), _("Debug Window"));
619 gtk_window_set_default_size (GTK_WINDOW (object), 800, 400);
620 gtk_window_set_transient_for (GTK_WINDOW (object), priv->parent);
622 vbox = GTK_DIALOG (object)->vbox;
624 toolbar = gtk_toolbar_new ();
625 gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
626 gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
627 gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR);
628 gtk_widget_show (toolbar);
630 gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
633 priv->cm_chooser = gtk_combo_box_new_text ();
634 priv->cms = gtk_list_store_new (NUM_COLS_CM, G_TYPE_STRING, G_TYPE_STRING);
635 gtk_combo_box_set_model (GTK_COMBO_BOX (priv->cm_chooser),
636 GTK_TREE_MODEL (priv->cms));
637 gtk_widget_show (priv->cm_chooser);
639 item = gtk_tool_item_new ();
640 gtk_widget_show (GTK_WIDGET (item));
641 gtk_container_add (GTK_CONTAINER (item), priv->cm_chooser);
642 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
643 debug_dialog_fill_cm_chooser (EMPATHY_DEBUG_DIALOG (object));
644 g_signal_connect (priv->cm_chooser, "changed",
645 G_CALLBACK (debug_dialog_cm_chooser_changed_cb), object);
646 gtk_widget_show (GTK_WIDGET (priv->cm_chooser));
648 item = gtk_separator_tool_item_new ();
649 gtk_widget_show (GTK_WIDGET (item));
650 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
653 item = gtk_tool_button_new_from_stock (GTK_STOCK_SAVE);
654 g_signal_connect (item, "clicked",
655 G_CALLBACK (debug_dialog_save_clicked_cb), object);
656 gtk_widget_show (GTK_WIDGET (item));
657 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
658 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
661 item = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR);
662 g_signal_connect (item, "clicked",
663 G_CALLBACK (debug_dialog_clear_clicked_cb), object);
664 gtk_widget_show (GTK_WIDGET (item));
665 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
666 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
668 item = gtk_separator_tool_item_new ();
669 gtk_widget_show (GTK_WIDGET (item));
670 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
673 priv->paused = FALSE;
674 image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_MENU);
675 gtk_widget_show (image);
676 item = gtk_toggle_tool_button_new ();
677 gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (item), priv->paused);
678 g_signal_connect (item, "toggled", G_CALLBACK (debug_dialog_pause_toggled_cb),
680 gtk_widget_show (GTK_WIDGET (item));
681 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
682 gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), _("Pause"));
683 gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image);
684 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
686 item = gtk_separator_tool_item_new ();
687 gtk_widget_show (GTK_WIDGET (item));
688 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
691 item = gtk_tool_item_new ();
692 gtk_widget_show (GTK_WIDGET (item));
693 label = gtk_label_new (_("Level "));
694 gtk_widget_show (label);
695 gtk_container_add (GTK_CONTAINER (item), label);
696 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
698 priv->filter = gtk_combo_box_new_text ();
699 gtk_widget_show (priv->filter);
701 item = gtk_tool_item_new ();
702 gtk_widget_show (GTK_WIDGET (item));
703 gtk_container_add (GTK_CONTAINER (item), priv->filter);
704 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
706 level_store = gtk_list_store_new (NUM_COLS_LEVEL,
707 G_TYPE_STRING, G_TYPE_UINT);
708 gtk_combo_box_set_model (GTK_COMBO_BOX (priv->filter),
709 GTK_TREE_MODEL (level_store));
711 gtk_list_store_append (level_store, &iter);
712 gtk_list_store_set (level_store, &iter,
713 COL_LEVEL_NAME, _("Debug"),
714 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_DEBUG,
717 gtk_list_store_append (level_store, &iter);
718 gtk_list_store_set (level_store, &iter,
719 COL_LEVEL_NAME, _("Info"),
720 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_INFO,
723 gtk_list_store_append (level_store, &iter);
724 gtk_list_store_set (level_store, &iter,
725 COL_LEVEL_NAME, _("Message"),
726 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_MESSAGE,
729 gtk_list_store_append (level_store, &iter);
730 gtk_list_store_set (level_store, &iter,
731 COL_LEVEL_NAME, _("Warning"),
732 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_WARNING,
735 gtk_list_store_append (level_store, &iter);
736 gtk_list_store_set (level_store, &iter,
737 COL_LEVEL_NAME, _("Critical"),
738 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_CRITICAL,
741 gtk_list_store_append (level_store, &iter);
742 gtk_list_store_set (level_store, &iter,
743 COL_LEVEL_NAME, _("Error"),
744 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_ERROR,
747 gtk_combo_box_set_active (GTK_COMBO_BOX (priv->filter), 0);
748 g_signal_connect (priv->filter, "changed",
749 G_CALLBACK (debug_dialog_filter_changed_cb), object);
752 priv->view = gtk_tree_view_new ();
753 gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->view), TRUE);
755 g_signal_connect (priv->view, "button-press-event",
756 G_CALLBACK (debug_dialog_button_press_event_cb), object);
758 renderer = gtk_cell_renderer_text_new ();
759 g_object_set (renderer, "yalign", 0, NULL);
761 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
762 -1, _("Time"), renderer, "text", COL_DEBUG_TIMESTAMP, NULL);
763 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
764 -1, _("Domain"), renderer, "text", COL_DEBUG_DOMAIN, NULL);
765 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
766 -1, _("Category"), renderer, "text", COL_DEBUG_CATEGORY, NULL);
767 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
768 -1, _("Level"), renderer, "text", COL_DEBUG_LEVEL_STRING, NULL);
770 renderer = gtk_cell_renderer_text_new ();
771 g_object_set (renderer, "family", "Monospace", NULL);
772 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
773 -1, _("Message"), renderer, "text", COL_DEBUG_MESSAGE, NULL);
775 priv->store = gtk_list_store_new (NUM_DEBUG_COLS, G_TYPE_DOUBLE,
776 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
779 priv->store_filter = gtk_tree_model_filter_new (
780 GTK_TREE_MODEL (priv->store), NULL);
782 gtk_tree_model_filter_set_visible_func (
783 GTK_TREE_MODEL_FILTER (priv->store_filter),
784 debug_dialog_visible_func, object, NULL);
786 gtk_tree_view_set_model (GTK_TREE_VIEW (priv->view), priv->store_filter);
788 /* Scrolled window */
789 scrolled_win = gtk_scrolled_window_new (NULL, NULL);
790 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
791 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
793 gtk_widget_show (priv->view);
794 gtk_container_add (GTK_CONTAINER (scrolled_win), priv->view);
796 gtk_widget_show (scrolled_win);
797 gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
799 gtk_widget_show (GTK_WIDGET (object));
805 empathy_debug_dialog_init (EmpathyDebugDialog *empathy_debug_dialog)
807 EmpathyDebugDialogPriv *priv =
808 G_TYPE_INSTANCE_GET_PRIVATE (empathy_debug_dialog,
809 EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogPriv);
811 empathy_debug_dialog->priv = priv;
813 priv->dispose_run = FALSE;
817 debug_dialog_set_property (GObject *object,
822 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
827 priv->parent = GTK_WINDOW (g_value_dup_object (value));
830 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
836 debug_dialog_get_property (GObject *object,
841 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
846 g_value_set_object (value, priv->parent);
849 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
855 debug_dialog_dispose (GObject *object)
857 EmpathyDebugDialog *selector = EMPATHY_DEBUG_DIALOG (object);
858 EmpathyDebugDialogPriv *priv = GET_PRIV (selector);
860 if (priv->dispose_run)
863 priv->dispose_run = TRUE;
866 g_object_unref (priv->parent);
869 g_object_unref (priv->store);
873 debug_dialog_set_enabled (EMPATHY_DEBUG_DIALOG (object), FALSE);
874 g_object_unref (priv->proxy);
877 if (priv->signal_connection)
878 tp_proxy_signal_connection_disconnect (priv->signal_connection);
881 g_object_unref (priv->cms);
883 (G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->dispose) (object);
887 empathy_debug_dialog_class_init (EmpathyDebugDialogClass *klass)
889 GObjectClass *object_class = G_OBJECT_CLASS (klass);
890 object_class->constructor = debug_dialog_constructor;
891 object_class->dispose = debug_dialog_dispose;
892 object_class->set_property = debug_dialog_set_property;
893 object_class->get_property = debug_dialog_get_property;
894 g_type_class_add_private (klass, sizeof (EmpathyDebugDialogPriv));
896 g_object_class_install_property (object_class, PROP_PARENT,
897 g_param_spec_object ("parent", "parent", "parent",
898 GTK_TYPE_WINDOW, G_PARAM_CONSTRUCT_ONLY |
899 G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
905 empathy_debug_dialog_new (GtkWindow *parent)
907 g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
909 return GTK_WIDGET (g_object_new (EMPATHY_TYPE_DEBUG_DIALOG,
910 "parent", parent, NULL));