1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Copyright (C) 2002-2007 Imendio AB
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
21
#include <glib/gi18n.h>
24
#include <libgossip/gossip-conf.h>
26
#include "gossip-hint.h"
29
hint_dialog_response_cb (GtkWidget *widget,
31
GtkWidget *checkbutton)
35
const gchar *conf_path;
38
conf_path = g_object_get_data (G_OBJECT (widget), "conf_path");
39
func = g_object_get_data (G_OBJECT (widget), "func");
40
user_data = g_object_get_data (G_OBJECT (widget), "user_data");
42
hide_hint = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton));
43
gossip_conf_set_bool (gossip_conf_get (), conf_path, !hide_hint);
45
gtk_widget_destroy (widget);
48
(func) ((gpointer) conf_path, user_data);
54
gossip_hint_dialog_show (const gchar *conf_path,
55
const gchar *message1,
56
const gchar *message2,
62
GtkWidget *checkbutton;
65
gboolean show_hint = TRUE;
67
g_return_val_if_fail (conf_path != NULL, FALSE);
68
g_return_val_if_fail (message1 != NULL, FALSE);
70
ok = gossip_conf_get_bool (gossip_conf_get (),
74
if (ok && !show_hint) {
78
dialog = gtk_message_dialog_new_with_markup (parent,
79
GTK_DIALOG_DESTROY_WITH_PARENT,
85
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
87
checkbutton = gtk_check_button_new_with_label (_("Do not show this again"));
88
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), TRUE);
90
vbox = gtk_vbox_new (FALSE, 6);
91
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
92
gtk_box_pack_start (GTK_BOX (vbox), checkbutton, FALSE, FALSE, 0);
93
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0);
95
g_object_set_data_full (G_OBJECT (dialog), "conf_path", g_strdup (conf_path), g_free);
96
g_object_set_data (G_OBJECT (dialog), "user_data", user_data);
97
g_object_set_data (G_OBJECT (dialog), "func", func);
99
g_signal_connect (dialog, "response",
100
G_CALLBACK (hint_dialog_response_cb),
103
gtk_widget_show_all (dialog);
109
gossip_hint_show (const gchar *conf_path,
110
const gchar *message1,
111
const gchar *message2,
116
#ifdef HAVE_LIBNOTIFY
117
return gossip_notify_hint_show (conf_path,
121
return gossip_hint_dialog_show (conf_path,