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 (
336 GTK_COMBO_BOX (priv->cm_chooser), debug_dialog);
340 debug_dialog_fill_cm_chooser (EmpathyDebugDialog *debug_dialog)
343 GError *error = NULL;
345 dbus = tp_dbus_daemon_dup (&error);
349 DEBUG ("Failed to dup dbus daemon: %s", error->message);
350 g_error_free (error);
354 tp_list_connection_names (dbus, debug_dialog_list_connection_names_cb,
355 debug_dialog, NULL, NULL);
357 g_object_unref (dbus);
361 debug_dialog_pause_toggled_cb (GtkToggleToolButton *pause,
362 EmpathyDebugDialog *debug_dialog)
364 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
366 priv->paused = gtk_toggle_tool_button_get_active (pause);
368 debug_dialog_set_enabled (debug_dialog, !priv->paused);
372 debug_dialog_visible_func (GtkTreeModel *model,
376 EmpathyDebugDialog *debug_dialog = (EmpathyDebugDialog *) user_data;
377 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
378 guint filter_value, level;
379 GtkTreeModel *filter_model;
380 GtkTreeIter filter_iter;
382 filter_model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->filter));
383 gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->filter),
386 gtk_tree_model_get (model, iter, COL_DEBUG_LEVEL_VALUE, &level, -1);
387 gtk_tree_model_get (filter_model, &filter_iter,
388 COL_LEVEL_VALUE, &filter_value, -1);
390 if (level <= filter_value)
397 debug_dialog_filter_changed_cb (GtkComboBox *filter,
398 EmpathyDebugDialog *debug_dialog)
400 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
402 gtk_tree_model_filter_refilter (
403 GTK_TREE_MODEL_FILTER (priv->store_filter));
407 debug_dialog_clear_clicked_cb (GtkToolButton *clear_button,
408 EmpathyDebugDialog *debug_dialog)
410 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
412 gtk_list_store_clear (priv->store);
416 debug_dialog_menu_copy_activate_cb (GtkMenuItem *menu_item,
417 EmpathyDebugDialog *debug_dialog)
419 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
421 GtkTreeViewColumn *focus_column;
424 GtkClipboard *clipboard;
426 gtk_tree_view_get_cursor (GTK_TREE_VIEW (priv->view),
427 &path, &focus_column);
431 DEBUG ("No row is in focus");
435 gtk_tree_model_get_iter (priv->store_filter, &iter, path);
437 gtk_tree_model_get (priv->store_filter, &iter,
438 COL_DEBUG_MESSAGE, &message,
441 if (EMP_STR_EMPTY (message))
443 DEBUG ("Log message is empty");
447 clipboard = gtk_clipboard_get_for_display (
448 gtk_widget_get_display (GTK_WIDGET (menu_item)),
449 GDK_SELECTION_CLIPBOARD);
451 gtk_clipboard_set_text (clipboard, message, -1);
458 EmpathyDebugDialog *debug_dialog;
464 debug_dialog_show_menu (gpointer user_data)
466 MenuPopupData *data = (MenuPopupData *) user_data;
467 GtkWidget *menu, *item;
470 menu = gtk_menu_new ();
471 shell = GTK_MENU_SHELL (menu);
473 item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
475 g_signal_connect (item, "activate",
476 G_CALLBACK (debug_dialog_menu_copy_activate_cb), data->debug_dialog);
478 gtk_menu_shell_append (shell, item);
479 gtk_widget_show (item);
481 gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
482 data->button, data->time);
484 g_slice_free (MenuPopupData, user_data);
490 debug_dialog_button_press_event_cb (GtkTreeView *view,
491 GdkEventButton *event,
494 /* A mouse button was pressed on the tree view. */
496 if (event->button == 3)
498 /* The tree view was right-clicked. (3 == third mouse button) */
500 data = g_slice_new0 (MenuPopupData);
501 data->debug_dialog = user_data;
502 data->button = event->button;
503 data->time = event->time;
504 g_idle_add (debug_dialog_show_menu, data);
511 debug_dialog_store_filter_foreach (GtkTreeModel *model,
516 FILE *file = (FILE *) user_data;
517 gchar *domain, *category, *message, *level_str, *level_upper;
520 gtk_tree_model_get (model, iter,
521 COL_DEBUG_TIMESTAMP, ×tamp,
522 COL_DEBUG_DOMAIN, &domain,
523 COL_DEBUG_CATEGORY, &category,
524 COL_DEBUG_LEVEL_STRING, &level_str,
525 COL_DEBUG_MESSAGE, &message,
528 level_upper = g_ascii_strup (level_str, -1);
530 g_fprintf (file, "%s%s%s-%s: %e: %s\n",
531 domain, EMP_STR_EMPTY (category) ? "" : "/",
532 category, level_upper, timestamp, message);
534 g_free (level_upper);
544 debug_dialog_save_file_chooser_response_cb (GtkDialog *dialog,
546 EmpathyDebugDialog *debug_dialog)
548 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
549 gchar *filename = NULL;
552 if (response_id != GTK_RESPONSE_ACCEPT)
555 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
557 DEBUG ("Saving log as %s", filename);
559 file = g_fopen (filename, "w");
562 DEBUG ("Failed to open file: %s", g_strerror (errno));
566 gtk_tree_model_foreach (priv->store_filter,
567 debug_dialog_store_filter_foreach, file);
572 if (filename != NULL)
575 gtk_widget_destroy (GTK_WIDGET (dialog));
579 debug_dialog_save_clicked_cb (GtkToolButton *tool_button,
580 EmpathyDebugDialog *debug_dialog)
582 GtkWidget *file_chooser;
584 file_chooser = gtk_file_chooser_dialog_new (_("Save"),
585 GTK_WINDOW (debug_dialog), GTK_FILE_CHOOSER_ACTION_SAVE,
586 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
587 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
590 gtk_window_set_modal (GTK_WINDOW (file_chooser), TRUE);
591 gtk_file_chooser_set_do_overwrite_confirmation (
592 GTK_FILE_CHOOSER (file_chooser), TRUE);
594 g_signal_connect (file_chooser, "response",
595 G_CALLBACK (debug_dialog_save_file_chooser_response_cb),
598 gtk_widget_show (file_chooser);
602 debug_dialog_constructor (GType type,
603 guint n_construct_params,
604 GObjectConstructParam *construct_params)
607 EmpathyDebugDialogPriv *priv;
613 GtkCellRenderer *renderer;
614 GtkWidget *scrolled_win;
615 GtkListStore *level_store;
618 object = G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->constructor
619 (type, n_construct_params, construct_params);
620 priv = GET_PRIV (object);
622 gtk_window_set_title (GTK_WINDOW (object), _("Debug Window"));
623 gtk_window_set_default_size (GTK_WINDOW (object), 800, 400);
624 gtk_window_set_transient_for (GTK_WINDOW (object), priv->parent);
626 vbox = GTK_DIALOG (object)->vbox;
628 toolbar = gtk_toolbar_new ();
629 gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
630 gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
631 gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar),
632 GTK_ICON_SIZE_SMALL_TOOLBAR);
633 gtk_widget_show (toolbar);
635 gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
638 priv->cm_chooser = gtk_combo_box_new_text ();
639 priv->cms = gtk_list_store_new (NUM_COLS_CM, G_TYPE_STRING, G_TYPE_STRING);
640 gtk_combo_box_set_model (GTK_COMBO_BOX (priv->cm_chooser),
641 GTK_TREE_MODEL (priv->cms));
642 gtk_widget_show (priv->cm_chooser);
644 item = gtk_tool_item_new ();
645 gtk_widget_show (GTK_WIDGET (item));
646 gtk_container_add (GTK_CONTAINER (item), priv->cm_chooser);
647 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
648 debug_dialog_fill_cm_chooser (EMPATHY_DEBUG_DIALOG (object));
649 g_signal_connect (priv->cm_chooser, "changed",
650 G_CALLBACK (debug_dialog_cm_chooser_changed_cb), object);
651 gtk_widget_show (GTK_WIDGET (priv->cm_chooser));
653 item = gtk_separator_tool_item_new ();
654 gtk_widget_show (GTK_WIDGET (item));
655 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
658 item = gtk_tool_button_new_from_stock (GTK_STOCK_SAVE);
659 g_signal_connect (item, "clicked",
660 G_CALLBACK (debug_dialog_save_clicked_cb), object);
661 gtk_widget_show (GTK_WIDGET (item));
662 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
663 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
666 item = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR);
667 g_signal_connect (item, "clicked",
668 G_CALLBACK (debug_dialog_clear_clicked_cb), object);
669 gtk_widget_show (GTK_WIDGET (item));
670 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
671 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
673 item = gtk_separator_tool_item_new ();
674 gtk_widget_show (GTK_WIDGET (item));
675 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
678 priv->paused = FALSE;
679 image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PAUSE,
681 gtk_widget_show (image);
682 item = gtk_toggle_tool_button_new ();
683 gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (item),
685 g_signal_connect (item, "toggled",
686 G_CALLBACK (debug_dialog_pause_toggled_cb), object);
687 gtk_widget_show (GTK_WIDGET (item));
688 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
689 gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), _("Pause"));
690 gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image);
691 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
693 item = gtk_separator_tool_item_new ();
694 gtk_widget_show (GTK_WIDGET (item));
695 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
698 item = gtk_tool_item_new ();
699 gtk_widget_show (GTK_WIDGET (item));
700 label = gtk_label_new (_("Level "));
701 gtk_widget_show (label);
702 gtk_container_add (GTK_CONTAINER (item), label);
703 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
705 priv->filter = gtk_combo_box_new_text ();
706 gtk_widget_show (priv->filter);
708 item = gtk_tool_item_new ();
709 gtk_widget_show (GTK_WIDGET (item));
710 gtk_container_add (GTK_CONTAINER (item), priv->filter);
711 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
713 level_store = gtk_list_store_new (NUM_COLS_LEVEL,
714 G_TYPE_STRING, G_TYPE_UINT);
715 gtk_combo_box_set_model (GTK_COMBO_BOX (priv->filter),
716 GTK_TREE_MODEL (level_store));
718 gtk_list_store_append (level_store, &iter);
719 gtk_list_store_set (level_store, &iter,
720 COL_LEVEL_NAME, _("Debug"),
721 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_DEBUG,
724 gtk_list_store_append (level_store, &iter);
725 gtk_list_store_set (level_store, &iter,
726 COL_LEVEL_NAME, _("Info"),
727 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_INFO,
730 gtk_list_store_append (level_store, &iter);
731 gtk_list_store_set (level_store, &iter,
732 COL_LEVEL_NAME, _("Message"),
733 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_MESSAGE,
736 gtk_list_store_append (level_store, &iter);
737 gtk_list_store_set (level_store, &iter,
738 COL_LEVEL_NAME, _("Warning"),
739 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_WARNING,
742 gtk_list_store_append (level_store, &iter);
743 gtk_list_store_set (level_store, &iter,
744 COL_LEVEL_NAME, _("Critical"),
745 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_CRITICAL,
748 gtk_list_store_append (level_store, &iter);
749 gtk_list_store_set (level_store, &iter,
750 COL_LEVEL_NAME, _("Error"),
751 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_ERROR,
754 gtk_combo_box_set_active (GTK_COMBO_BOX (priv->filter), 0);
755 g_signal_connect (priv->filter, "changed",
756 G_CALLBACK (debug_dialog_filter_changed_cb), object);
759 priv->view = gtk_tree_view_new ();
760 gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->view), TRUE);
762 g_signal_connect (priv->view, "button-press-event",
763 G_CALLBACK (debug_dialog_button_press_event_cb), object);
765 renderer = gtk_cell_renderer_text_new ();
766 g_object_set (renderer, "yalign", 0, NULL);
768 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
769 -1, _("Time"), renderer, "text", COL_DEBUG_TIMESTAMP, NULL);
770 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
771 -1, _("Domain"), renderer, "text", COL_DEBUG_DOMAIN, NULL);
772 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
773 -1, _("Category"), renderer, "text", COL_DEBUG_CATEGORY, NULL);
774 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
775 -1, _("Level"), renderer, "text", COL_DEBUG_LEVEL_STRING, NULL);
777 renderer = gtk_cell_renderer_text_new ();
778 g_object_set (renderer, "family", "Monospace", NULL);
779 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
780 -1, _("Message"), renderer, "text", COL_DEBUG_MESSAGE, NULL);
782 priv->store = gtk_list_store_new (NUM_DEBUG_COLS, G_TYPE_DOUBLE,
783 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
786 priv->store_filter = gtk_tree_model_filter_new (
787 GTK_TREE_MODEL (priv->store), NULL);
789 gtk_tree_model_filter_set_visible_func (
790 GTK_TREE_MODEL_FILTER (priv->store_filter),
791 debug_dialog_visible_func, object, NULL);
793 gtk_tree_view_set_model (GTK_TREE_VIEW (priv->view), priv->store_filter);
795 /* Scrolled window */
796 scrolled_win = gtk_scrolled_window_new (NULL, NULL);
797 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
798 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
800 gtk_widget_show (priv->view);
801 gtk_container_add (GTK_CONTAINER (scrolled_win), priv->view);
803 gtk_widget_show (scrolled_win);
804 gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
806 gtk_widget_show (GTK_WIDGET (object));
812 empathy_debug_dialog_init (EmpathyDebugDialog *empathy_debug_dialog)
814 EmpathyDebugDialogPriv *priv =
815 G_TYPE_INSTANCE_GET_PRIVATE (empathy_debug_dialog,
816 EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogPriv);
818 empathy_debug_dialog->priv = priv;
820 priv->dispose_run = FALSE;
824 debug_dialog_set_property (GObject *object,
829 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
834 priv->parent = GTK_WINDOW (g_value_dup_object (value));
837 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
843 debug_dialog_get_property (GObject *object,
848 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
853 g_value_set_object (value, priv->parent);
856 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
862 debug_dialog_dispose (GObject *object)
864 EmpathyDebugDialog *selector = EMPATHY_DEBUG_DIALOG (object);
865 EmpathyDebugDialogPriv *priv = GET_PRIV (selector);
867 if (priv->dispose_run)
870 priv->dispose_run = TRUE;
873 g_object_unref (priv->parent);
876 g_object_unref (priv->store);
880 debug_dialog_set_enabled (EMPATHY_DEBUG_DIALOG (object), FALSE);
881 g_object_unref (priv->proxy);
884 if (priv->signal_connection)
885 tp_proxy_signal_connection_disconnect (priv->signal_connection);
888 g_object_unref (priv->cms);
890 (G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->dispose) (object);
894 empathy_debug_dialog_class_init (EmpathyDebugDialogClass *klass)
896 GObjectClass *object_class = G_OBJECT_CLASS (klass);
897 object_class->constructor = debug_dialog_constructor;
898 object_class->dispose = debug_dialog_dispose;
899 object_class->set_property = debug_dialog_set_property;
900 object_class->get_property = debug_dialog_get_property;
901 g_type_class_add_private (klass, sizeof (EmpathyDebugDialogPriv));
903 g_object_class_install_property (object_class, PROP_PARENT,
904 g_param_spec_object ("parent", "parent", "parent",
905 GTK_TYPE_WINDOW, G_PARAM_CONSTRUCT_ONLY |
906 G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
912 empathy_debug_dialog_new (GtkWindow *parent)
914 g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
916 return GTK_WIDGET (g_object_new (EMPATHY_TYPE_DEBUG_DIALOG,
917 "parent", parent, NULL));