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 if (event->button == 3)
497 data = g_slice_new0 (MenuPopupData);
498 data->debug_dialog = user_data;
499 data->button = event->button;
500 data->time = event->time;
501 g_idle_add (debug_dialog_show_menu, data);
508 debug_dialog_store_filter_foreach (GtkTreeModel *model,
513 FILE *file = (FILE *) user_data;
514 gchar *domain, *category, *message, *level_str, *level_upper;
517 gtk_tree_model_get (model, iter,
518 COL_DEBUG_TIMESTAMP, ×tamp,
519 COL_DEBUG_DOMAIN, &domain,
520 COL_DEBUG_CATEGORY, &category,
521 COL_DEBUG_LEVEL_STRING, &level_str,
522 COL_DEBUG_MESSAGE, &message,
525 level_upper = g_ascii_strup (level_str, -1);
527 g_fprintf (file, "%s%s%s-%s: %e: %s\n",
528 domain, EMP_STR_EMPTY (category) ? "" : "/",
529 category, level_upper, timestamp, message);
531 g_free (level_upper);
541 debug_dialog_save_file_chooser_response_cb (GtkDialog *dialog,
543 EmpathyDebugDialog *debug_dialog)
545 EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog);
546 gchar *filename = NULL;
549 if (response_id != GTK_RESPONSE_ACCEPT)
552 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
554 DEBUG ("Saving log as %s", filename);
556 file = g_fopen (filename, "w");
559 DEBUG ("Failed to open file: %s", g_strerror (errno));
563 gtk_tree_model_foreach (priv->store_filter,
564 debug_dialog_store_filter_foreach, file);
569 if (filename != NULL)
572 gtk_widget_destroy (GTK_WIDGET (dialog));
576 debug_dialog_save_clicked_cb (GtkToolButton *tool_button,
577 EmpathyDebugDialog *debug_dialog)
579 GtkWidget *file_chooser;
581 file_chooser = gtk_file_chooser_dialog_new (_("Save"),
582 GTK_WINDOW (debug_dialog), GTK_FILE_CHOOSER_ACTION_SAVE,
583 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
584 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
587 gtk_window_set_modal (GTK_WINDOW (file_chooser), TRUE);
588 gtk_file_chooser_set_do_overwrite_confirmation (
589 GTK_FILE_CHOOSER (file_chooser), TRUE);
591 g_signal_connect (file_chooser, "response",
592 G_CALLBACK (debug_dialog_save_file_chooser_response_cb),
595 gtk_widget_show (file_chooser);
599 debug_dialog_constructor (GType type,
600 guint n_construct_params,
601 GObjectConstructParam *construct_params)
604 EmpathyDebugDialogPriv *priv;
610 GtkCellRenderer *renderer;
611 GtkWidget *scrolled_win;
612 GtkListStore *level_store;
615 object = G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->constructor
616 (type, n_construct_params, construct_params);
617 priv = GET_PRIV (object);
619 gtk_window_set_title (GTK_WINDOW (object), _("Debug Window"));
620 gtk_window_set_default_size (GTK_WINDOW (object), 800, 400);
621 gtk_window_set_transient_for (GTK_WINDOW (object), priv->parent);
623 vbox = GTK_DIALOG (object)->vbox;
625 toolbar = gtk_toolbar_new ();
626 gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
627 gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
628 gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar),
629 GTK_ICON_SIZE_SMALL_TOOLBAR);
630 gtk_widget_show (toolbar);
632 gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
635 priv->cm_chooser = gtk_combo_box_new_text ();
636 priv->cms = gtk_list_store_new (NUM_COLS_CM, G_TYPE_STRING, G_TYPE_STRING);
637 gtk_combo_box_set_model (GTK_COMBO_BOX (priv->cm_chooser),
638 GTK_TREE_MODEL (priv->cms));
639 gtk_widget_show (priv->cm_chooser);
641 item = gtk_tool_item_new ();
642 gtk_widget_show (GTK_WIDGET (item));
643 gtk_container_add (GTK_CONTAINER (item), priv->cm_chooser);
644 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
645 debug_dialog_fill_cm_chooser (EMPATHY_DEBUG_DIALOG (object));
646 g_signal_connect (priv->cm_chooser, "changed",
647 G_CALLBACK (debug_dialog_cm_chooser_changed_cb), object);
648 gtk_widget_show (GTK_WIDGET (priv->cm_chooser));
650 item = gtk_separator_tool_item_new ();
651 gtk_widget_show (GTK_WIDGET (item));
652 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
655 item = gtk_tool_button_new_from_stock (GTK_STOCK_SAVE);
656 g_signal_connect (item, "clicked",
657 G_CALLBACK (debug_dialog_save_clicked_cb), object);
658 gtk_widget_show (GTK_WIDGET (item));
659 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
660 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
663 item = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR);
664 g_signal_connect (item, "clicked",
665 G_CALLBACK (debug_dialog_clear_clicked_cb), object);
666 gtk_widget_show (GTK_WIDGET (item));
667 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
668 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
670 item = gtk_separator_tool_item_new ();
671 gtk_widget_show (GTK_WIDGET (item));
672 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
675 priv->paused = FALSE;
676 image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PAUSE,
678 gtk_widget_show (image);
679 item = gtk_toggle_tool_button_new ();
680 gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (item),
682 g_signal_connect (item, "toggled",
683 G_CALLBACK (debug_dialog_pause_toggled_cb), object);
684 gtk_widget_show (GTK_WIDGET (item));
685 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
686 gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), _("Pause"));
687 gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image);
688 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
690 item = gtk_separator_tool_item_new ();
691 gtk_widget_show (GTK_WIDGET (item));
692 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
695 item = gtk_tool_item_new ();
696 gtk_widget_show (GTK_WIDGET (item));
697 label = gtk_label_new (_("Level "));
698 gtk_widget_show (label);
699 gtk_container_add (GTK_CONTAINER (item), label);
700 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
702 priv->filter = gtk_combo_box_new_text ();
703 gtk_widget_show (priv->filter);
705 item = gtk_tool_item_new ();
706 gtk_widget_show (GTK_WIDGET (item));
707 gtk_container_add (GTK_CONTAINER (item), priv->filter);
708 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
710 level_store = gtk_list_store_new (NUM_COLS_LEVEL,
711 G_TYPE_STRING, G_TYPE_UINT);
712 gtk_combo_box_set_model (GTK_COMBO_BOX (priv->filter),
713 GTK_TREE_MODEL (level_store));
715 gtk_list_store_append (level_store, &iter);
716 gtk_list_store_set (level_store, &iter,
717 COL_LEVEL_NAME, _("Debug"),
718 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_DEBUG,
721 gtk_list_store_append (level_store, &iter);
722 gtk_list_store_set (level_store, &iter,
723 COL_LEVEL_NAME, _("Info"),
724 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_INFO,
727 gtk_list_store_append (level_store, &iter);
728 gtk_list_store_set (level_store, &iter,
729 COL_LEVEL_NAME, _("Message"),
730 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_MESSAGE,
733 gtk_list_store_append (level_store, &iter);
734 gtk_list_store_set (level_store, &iter,
735 COL_LEVEL_NAME, _("Warning"),
736 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_WARNING,
739 gtk_list_store_append (level_store, &iter);
740 gtk_list_store_set (level_store, &iter,
741 COL_LEVEL_NAME, _("Critical"),
742 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_CRITICAL,
745 gtk_list_store_append (level_store, &iter);
746 gtk_list_store_set (level_store, &iter,
747 COL_LEVEL_NAME, _("Error"),
748 COL_LEVEL_VALUE, EMP_DEBUG_LEVEL_ERROR,
751 gtk_combo_box_set_active (GTK_COMBO_BOX (priv->filter), 0);
752 g_signal_connect (priv->filter, "changed",
753 G_CALLBACK (debug_dialog_filter_changed_cb), object);
756 priv->view = gtk_tree_view_new ();
757 gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->view), TRUE);
759 g_signal_connect (priv->view, "button-press-event",
760 G_CALLBACK (debug_dialog_button_press_event_cb), object);
762 renderer = gtk_cell_renderer_text_new ();
763 g_object_set (renderer, "yalign", 0, NULL);
765 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
766 -1, _("Time"), renderer, "text", COL_DEBUG_TIMESTAMP, NULL);
767 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
768 -1, _("Domain"), renderer, "text", COL_DEBUG_DOMAIN, NULL);
769 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
770 -1, _("Category"), renderer, "text", COL_DEBUG_CATEGORY, NULL);
771 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
772 -1, _("Level"), renderer, "text", COL_DEBUG_LEVEL_STRING, NULL);
774 renderer = gtk_cell_renderer_text_new ();
775 g_object_set (renderer, "family", "Monospace", NULL);
776 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (priv->view),
777 -1, _("Message"), renderer, "text", COL_DEBUG_MESSAGE, NULL);
779 priv->store = gtk_list_store_new (NUM_DEBUG_COLS, G_TYPE_DOUBLE,
780 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
783 priv->store_filter = gtk_tree_model_filter_new (
784 GTK_TREE_MODEL (priv->store), NULL);
786 gtk_tree_model_filter_set_visible_func (
787 GTK_TREE_MODEL_FILTER (priv->store_filter),
788 debug_dialog_visible_func, object, NULL);
790 gtk_tree_view_set_model (GTK_TREE_VIEW (priv->view), priv->store_filter);
792 /* Scrolled window */
793 scrolled_win = gtk_scrolled_window_new (NULL, NULL);
794 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
795 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
797 gtk_widget_show (priv->view);
798 gtk_container_add (GTK_CONTAINER (scrolled_win), priv->view);
800 gtk_widget_show (scrolled_win);
801 gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
803 gtk_widget_show (GTK_WIDGET (object));
809 empathy_debug_dialog_init (EmpathyDebugDialog *empathy_debug_dialog)
811 EmpathyDebugDialogPriv *priv =
812 G_TYPE_INSTANCE_GET_PRIVATE (empathy_debug_dialog,
813 EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogPriv);
815 empathy_debug_dialog->priv = priv;
817 priv->dispose_run = FALSE;
821 debug_dialog_set_property (GObject *object,
826 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
831 priv->parent = GTK_WINDOW (g_value_dup_object (value));
834 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
840 debug_dialog_get_property (GObject *object,
845 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
850 g_value_set_object (value, priv->parent);
853 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
859 debug_dialog_dispose (GObject *object)
861 EmpathyDebugDialog *selector = EMPATHY_DEBUG_DIALOG (object);
862 EmpathyDebugDialogPriv *priv = GET_PRIV (selector);
864 if (priv->dispose_run)
867 priv->dispose_run = TRUE;
870 g_object_unref (priv->parent);
873 g_object_unref (priv->store);
877 debug_dialog_set_enabled (EMPATHY_DEBUG_DIALOG (object), FALSE);
878 g_object_unref (priv->proxy);
881 if (priv->signal_connection)
882 tp_proxy_signal_connection_disconnect (priv->signal_connection);
885 g_object_unref (priv->cms);
887 (G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->dispose) (object);
891 empathy_debug_dialog_class_init (EmpathyDebugDialogClass *klass)
893 GObjectClass *object_class = G_OBJECT_CLASS (klass);
894 object_class->constructor = debug_dialog_constructor;
895 object_class->dispose = debug_dialog_dispose;
896 object_class->set_property = debug_dialog_set_property;
897 object_class->get_property = debug_dialog_get_property;
898 g_type_class_add_private (klass, sizeof (EmpathyDebugDialogPriv));
900 g_object_class_install_property (object_class, PROP_PARENT,
901 g_param_spec_object ("parent", "parent", "parent",
902 GTK_TYPE_WINDOW, G_PARAM_CONSTRUCT_ONLY |
903 G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
909 empathy_debug_dialog_new (GtkWindow *parent)
911 g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
913 return GTK_WIDGET (g_object_new (EMPATHY_TYPE_DEBUG_DIALOG,
914 "parent", parent, NULL));