~ubuntu-branches/ubuntu/utopic/granite/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/Widgets/widgets-utils.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-08-18 09:44:44 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140818094444-3zhkk29jh74553m5
Tags: 2014.2~b2-0ubuntu1
Initial release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* GTK - The GIMP Toolkit
2
 
 * Copyright (C) 2001 CodeFactory AB
3
 
 * Copyright (C) 2001, 2002 Anders Carlsson
4
 
 * Copyright (C) 2003, 2004 Matthias Clasen <mclasen@redhat.com>
5
 
 *
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU Library General Public
8
 
 * License as published by the Free Software Foundation; either
9
 
 * version 2 of the License, or (at your option) any later version.
10
 
 *
11
 
 * This library is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * Library General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Library General Public
17
 
 * License along with this library; if not, write to the
18
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
 
 * Boston, MA 02111-1307, USA.
20
 
 */
21
 
 
22
 
/*
23
 
 * Author: Anders Carlsson <andersca@gnome.org>
24
 
 *
25
 
 * Modified by the GTK+ Team and others 1997-2004.  See the AUTHORS
26
 
 * file for a list of people on the GTK+ Team.  See the ChangeLog
27
 
 * files for a list of changes.  These files are distributed with
28
 
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29
 
 */
30
 
 
31
 
#include "widgets-utils.h"
32
 
 
33
 
static void
34
 
close_cb (GtkWidget *about)
35
 
{
36
 
    GtkAboutDialogPrivate *priv = about->priv;
37
 
 
38
 
    gtk_widget_hide (about);
39
 
}
40
 
 
41
 
/**
42
 
 * gtk_show_about_dialog:
43
 
 * @parent: (allow-none): transient parent, or %NULL for none
44
 
 * @first_property_name: the name of the first property
45
 
 * @Varargs: value of first property, followed by more properties, %NULL-terminated
46
 
 *
47
 
 * This is a convenience function for showing an application's about box.
48
 
 * The constructed dialog is associated with the parent window and
49
 
 * reused for future invocations of this function.
50
 
 *
51
 
 * Since: 2.6
52
 
 */
53
 
void
54
 
    granite_widgets_show_about_dialog (GtkWindow   *parent,
55
 
                                       const gchar *first_property_name,
56
 
                                       ...)
57
 
{
58
 
    static GtkWidget *global_about_dialog = NULL;
59
 
    GtkWidget *dialog = NULL;
60
 
    va_list var_args;
61
 
 
62
 
    if (parent)
63
 
        dialog = g_object_get_data (G_OBJECT (parent), "gtk-about-dialog");
64
 
    else
65
 
        dialog = global_about_dialog;
66
 
 
67
 
    if (!dialog)
68
 
    {
69
 
        //dialog = gtk_about_dialog_new ();
70
 
        dialog = granite_widgets_about_dialog_new ();
71
 
        g_object_ref_sink (dialog);
72
 
 
73
 
        g_signal_connect (dialog, "delete-event",
74
 
                          G_CALLBACK (gtk_widget_hide_on_delete), NULL);
75
 
 
76
 
        /* Close dialog on user response */
77
 
        g_signal_connect (dialog, "response",
78
 
                          G_CALLBACK (close_cb), NULL);
79
 
 
80
 
        va_start (var_args, first_property_name);
81
 
        g_object_set_valist (G_OBJECT (dialog), first_property_name, var_args);
82
 
        va_end (var_args);
83
 
 
84
 
        if (parent)
85
 
        {
86
 
            gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
87
 
            gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
88
 
            gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
89
 
            g_object_set_data_full (G_OBJECT (parent),
90
 
                                    "gtk-about-dialog",
91
 
                                    dialog, g_object_unref);
92
 
        }
93
 
        else
94
 
            global_about_dialog = dialog;
95
 
 
96
 
    }
97
 
 
98
 
    gtk_window_present (GTK_WINDOW (dialog));
99
 
}
100
 
 
101