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>
23 #include <glib/gi18n.h>
26 #include <libempathy/empathy-utils.h>
28 #include "empathy-debug-dialog.h"
30 G_DEFINE_TYPE (EmpathyDebugDialog, empathy_debug_dialog,
39 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyDebugDialog)
45 } EmpathyDebugDialogPriv;
48 debug_dialog_constructor (GType type,
49 guint n_construct_params,
50 GObjectConstructParam *construct_params)
53 EmpathyDebugDialogPriv *priv;
60 object = G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->constructor
61 (type, n_construct_params, construct_params);
62 priv = GET_PRIV (object);
64 gtk_window_set_title (GTK_WINDOW (object), _("Debug Window"));
65 gtk_window_set_default_size (GTK_WINDOW (object), 800, 400);
66 gtk_window_set_transient_for (GTK_WINDOW (object), priv->parent);
68 vbox = GTK_DIALOG (object)->vbox;
70 toolbar = gtk_toolbar_new ();
71 gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
72 gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
73 gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR);
74 gtk_widget_show (toolbar);
76 gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
79 item = gtk_tool_button_new_from_stock (GTK_STOCK_SAVE);
80 gtk_widget_show (GTK_WIDGET (item));
81 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
82 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
85 item = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR);
86 gtk_widget_show (GTK_WIDGET (item));
87 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
88 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
90 item = gtk_separator_tool_item_new ();
91 gtk_widget_show (GTK_WIDGET (item));
92 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
95 image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_MENU);
96 gtk_widget_show (image);
97 item = gtk_toggle_tool_button_new ();
98 gtk_widget_show (GTK_WIDGET (item));
99 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
100 gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), _("Pause"));
101 gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image);
102 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
104 item = gtk_separator_tool_item_new ();
105 gtk_widget_show (GTK_WIDGET (item));
106 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
109 item = gtk_tool_item_new ();
110 gtk_widget_show (GTK_WIDGET (item));
111 gtk_container_add (GTK_CONTAINER (item), gtk_label_new (_("Level ")));
112 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
114 priv->filter = gtk_combo_box_new_text ();
115 gtk_widget_show (priv->filter);
117 item = gtk_tool_item_new ();
118 gtk_widget_show (GTK_WIDGET (item));
119 gtk_container_add (GTK_CONTAINER (item), priv->filter);
120 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
122 gtk_combo_box_append_text (GTK_COMBO_BOX (priv->filter), _("All"));
123 gtk_combo_box_append_text (GTK_COMBO_BOX (priv->filter), _("Debug"));
124 gtk_combo_box_append_text (GTK_COMBO_BOX (priv->filter), _("Info"));
125 gtk_combo_box_append_text (GTK_COMBO_BOX (priv->filter), _("Message"));
126 gtk_combo_box_append_text (GTK_COMBO_BOX (priv->filter), _("Warning"));
127 gtk_combo_box_append_text (GTK_COMBO_BOX (priv->filter), _("Critical"));
128 gtk_combo_box_append_text (GTK_COMBO_BOX (priv->filter), _("Error"));
130 gtk_combo_box_set_active (GTK_COMBO_BOX (priv->filter), 0);
131 gtk_widget_show (GTK_WIDGET (priv->filter));
134 button = gtk_button_new_with_label ("Foo");
135 gtk_widget_show (button);
137 gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
139 gtk_widget_show (GTK_WIDGET (object));
145 empathy_debug_dialog_init (EmpathyDebugDialog *empathy_debug_dialog)
147 EmpathyDebugDialogPriv *priv =
148 G_TYPE_INSTANCE_GET_PRIVATE (empathy_debug_dialog,
149 EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogPriv);
151 empathy_debug_dialog->priv = priv;
153 priv->dispose_run = FALSE;
157 debug_dialog_set_property (GObject *object,
162 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
167 priv->parent = GTK_WINDOW (g_value_dup_object (value));
170 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
176 debug_dialog_get_property (GObject *object,
181 EmpathyDebugDialogPriv *priv = GET_PRIV (object);
186 g_value_set_object (value, priv->parent);
189 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
195 debug_dialog_dispose (GObject *object)
197 EmpathyDebugDialog *selector = EMPATHY_DEBUG_DIALOG (object);
198 EmpathyDebugDialogPriv *priv = GET_PRIV (selector);
200 if (priv->dispose_run)
203 priv->dispose_run = TRUE;
205 g_object_unref (priv->parent);
207 (G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->dispose) (object);
211 empathy_debug_dialog_class_init (EmpathyDebugDialogClass *klass)
213 GObjectClass *object_class = G_OBJECT_CLASS (klass);
214 object_class->constructor = debug_dialog_constructor;
215 object_class->dispose = debug_dialog_dispose;
216 object_class->set_property = debug_dialog_set_property;
217 object_class->get_property = debug_dialog_get_property;
218 g_type_class_add_private (klass, sizeof (EmpathyDebugDialogPriv));
220 g_object_class_install_property (object_class, PROP_PARENT,
221 g_param_spec_object ("parent", "parent", "parent",
222 GTK_TYPE_WINDOW, G_PARAM_CONSTRUCT_ONLY |
223 G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
229 empathy_debug_dialog_new (GtkWindow *parent)
231 return GTK_WIDGET (g_object_new (EMPATHY_TYPE_DEBUG_DIALOG,
232 "parent", parent, NULL));