elementaryart team mailing list archive
-
elementaryart team
-
Mailing list archive
-
Message #01833
[Merge] lp:~elementary-pantheon/granite/aboutdialog_enhancements into lp:granite
ammonkey has proposed merging lp:~elementary-pantheon/granite/aboutdialog_enhancements into lp:granite.
Requested reviews:
elementary Pantheon team (elementary-pantheon)
For more details, see:
https://code.launchpad.net/~elementary-pantheon/granite/aboutdialog_enhancements/+merge/79115
--
https://code.launchpad.net/~elementary-pantheon/granite/aboutdialog_enhancements/+merge/79115
Your team elementaryart (old) is subscribed to branch lp:granite.
=== modified file 'lib/Application.vala'
--- lib/Application.vala 2011-09-20 19:36:37 +0000
+++ lib/Application.vala 2011-10-12 12:34:23 +0000
@@ -21,172 +21,159 @@
using Granite.Widgets;
namespace Granite {
-
- public struct utsname {
-
- char sysname [65];
- char nodename [65];
- char release [65];
- char version [65];
- char machine [65];
- char domainname [65];
- }
+
+ public struct utsname {
+
+ char sysname [65];
+ char nodename [65];
+ char release [65];
+ char version [65];
+ char machine [65];
+ char domainname [65];
+ }
/**
* Global deprecated object..
*
* @deprecated 0.1
- **/
- public static Granite.Application app;
-
- public abstract class Application : Gtk.Application {
-
- public string build_data_dir;
- public string build_pkg_data_dir;
- public string build_release_name;
- public string build_version;
- public string build_version_info;
-
- public string program_name;
- public string exec_name;
-
- public string app_copyright;
- public string app_years;
- public string app_icon;
- public string app_launcher;
-
- public string main_url;
- public string bug_url;
- public string help_url;
- public string translate_url;
-
- public string[] about_authors;
- public string[] about_documenters;
- public string[] about_artists;
- public string about_comments;
- public string about_translators;
- public string about_license;
- public License about_license_type;
-
- public Application () {
-
- // set program name
- prctl (15, exec_name, 0, 0, 0);
- Environment.set_prgname (exec_name);
-
- Posix.signal (Posix.SIGINT, sig_handler);
- Posix.signal (Posix.SIGTERM, sig_handler);
-
- Logger.initialize (program_name);
- Logger.DisplayLevel = LogLevel.INFO;
- message ("%s version: %s", program_name, build_version);
- var un = utsname ();
- uname (un);
- message ("Kernel version: %s", (string) un.release);
- Logger.DisplayLevel = LogLevel.WARN;
-
- Intl.bindtextdomain (exec_name, build_data_dir + "/locale");
-
- if (!Thread.supported ())
- error ("Problem initializing thread support.");
- Gdk.threads_init ();
-
- // Deprecated
- Granite.app = this;
-
- }
-
- [CCode (cheader_filename = "sys/prctl.h", cname = "prctl")]
- protected extern static int prctl (int option, string arg2, ulong arg3, ulong arg4, ulong arg5);
-
- [CCode (cheader_filename = "sys/utsname.h", cname = "uname")]
- protected extern static int uname (utsname buf);
-
- public new int run (string[] args) {
-
- // parse commandline options
- var context = new OptionContext ("");
-
- context.add_main_entries (options, null);
- context.add_group (Gtk.get_option_group (false));
-
- try {
- context.parse (ref args);
- } catch { }
-
- set_options ();
-
- return base.run (args);
- }
-
- protected static bool DEBUG = false;
-
- protected const OptionEntry[] options = {
- { "debug", 'd', 0, OptionArg.NONE, out DEBUG, "Enable debug logging", null },
- { null }
- };
-
- protected static void sig_handler (int sig) {
- warning ("Caught signal (%d), exiting", sig);
- Granite.app.quit_mainloop ();
- }
-
- protected virtual void set_options () {
-
- if (DEBUG)
- Logger.DisplayLevel = LogLevel.DEBUG;
- }
-
- public AppMenu create_appmenu (Menu menu) {
-
- AppMenu app_menu = new AppMenu.with_app (this, menu);
- app_menu.show_about.connect (show_about);
-
- return app_menu;
- }
-
- protected Granite.Widgets.AboutDialog about_dlg;
-
- public virtual void show_about (Gtk.Widget parent) {
-
+ **/
+ public static Granite.Application app;
+
+ public abstract class Application : Gtk.Application {
+
+ public string build_data_dir;
+ public string build_pkg_data_dir;
+ public string build_release_name;
+ public string build_version;
+ public string build_version_info;
+
+ public string program_name;
+ public string exec_name;
+
+ public string app_copyright;
+ public string app_years;
+ public string app_icon;
+ public string app_launcher;
+
+ public string main_url;
+ public string bug_url;
+ public string help_url;
+ public string translate_url;
+
+ public string[] about_authors;
+ public string[] about_documenters;
+ public string[] about_artists;
+ public string about_comments;
+ public string about_translators;
+ public string about_license;
+ public License about_license_type;
+
+ public Application () {
+
+ // set program name
+ prctl (15, exec_name, 0, 0, 0);
+ Environment.set_prgname (exec_name);
+
+ Posix.signal (Posix.SIGINT, sig_handler);
+ Posix.signal (Posix.SIGTERM, sig_handler);
+
+ Logger.initialize (program_name);
+ Logger.DisplayLevel = LogLevel.INFO;
+ message ("%s version: %s", program_name, build_version);
+ var un = utsname ();
+ uname (un);
+ message ("Kernel version: %s", (string) un.release);
+ Logger.DisplayLevel = LogLevel.WARN;
+
+ Intl.bindtextdomain (exec_name, build_data_dir + "/locale");
+
+ if (!Thread.supported ())
+ error ("Problem initializing thread support.");
+ Gdk.threads_init ();
+
+ // Deprecated
+ Granite.app = this;
+
+ }
+
+ [CCode (cheader_filename = "sys/prctl.h", cname = "prctl")]
+ protected extern static int prctl (int option, string arg2, ulong arg3, ulong arg4, ulong arg5);
+
+ [CCode (cheader_filename = "sys/utsname.h", cname = "uname")]
+ protected extern static int uname (utsname buf);
+
+ public new int run (string[] args) {
+
+ // parse commandline options
+ var context = new OptionContext ("");
+
+ context.add_main_entries (options, null);
+ context.add_group (Gtk.get_option_group (false));
+
+ try {
+ context.parse (ref args);
+ } catch { }
+
+ set_options ();
+
+ return base.run (args);
+ }
+
+ protected static bool DEBUG = false;
+
+ protected const OptionEntry[] options = {
+ { "debug", 'd', 0, OptionArg.NONE, out DEBUG, "Enable debug logging", null },
+ { null }
+ };
+
+ protected static void sig_handler (int sig) {
+ warning ("Caught signal (%d), exiting", sig);
+ Granite.app.quit_mainloop ();
+ }
+
+ protected virtual void set_options () {
+
+ if (DEBUG)
+ Logger.DisplayLevel = LogLevel.DEBUG;
+ }
+
+ public AppMenu create_appmenu (Menu menu) {
+
+ AppMenu app_menu = new AppMenu.with_app (this, menu);
+ app_menu.show_about.connect (show_about);
+
+ return app_menu;
+ }
+
+ protected Granite.Widgets.AboutDialog about_dlg;
+
+ public virtual void show_about (Gtk.Widget parent) {
+
assert(parent is Gtk.Window);
- about_dlg = new Granite.Widgets.AboutDialog ();
-
- about_dlg.modal = true;
- about_dlg.set_transient_for((Gtk.Window) parent);
-
- about_dlg.program_name = program_name;
- about_dlg.version = build_version;
- about_dlg.logo_icon_name = app_icon;
-
- about_dlg.comments = about_comments;
- about_dlg.copyright = "%s %s Developers".printf (app_years, program_name);
- about_dlg.website = main_url;
- about_dlg.website_label = "Website";
-
- about_dlg.authors = about_authors;
- about_dlg.documenters = about_documenters;
- about_dlg.artists = about_artists;
- about_dlg.translator_credits = about_translators;
- about_dlg.license = about_license;
- about_dlg.license_type = about_license_type;
-
- about_dlg.help = help_url;
- about_dlg.translate = translate_url;
- about_dlg.bug = bug_url;
-
- about_dlg.response.connect (() => {
- about_dlg.hide ();
- });
- about_dlg.hide.connect (() => {
- about_dlg.destroy ();
- about_dlg = null;
- });
-
- about_dlg.show ();
- }
-
- }
-
+ Granite.Widgets.show_about_dialog ((Gtk.Window) parent,
+ "program_name", program_name,
+ "version", build_version,
+ "logo_icon_name", app_icon,
+
+ "comments", about_comments,
+ "copyright", "%s %s Developers".printf (app_years, program_name),
+ "website", main_url,
+ "website_label", "Website",
+
+ "authors", about_authors,
+ "documenters", about_documenters,
+ "artists", about_artists,
+ "translator_credits", about_translators,
+ "license ", about_license,
+ "license_type ", about_license_type,
+
+ "help", help_url,
+ "translate", translate_url,
+ "bug", bug_url);
+
+ }
+
+ }
+
}
=== modified file 'lib/CMakeLists.txt'
--- lib/CMakeLists.txt 2011-10-09 22:29:22 +0000
+++ lib/CMakeLists.txt 2011-10-12 12:34:23 +0000
@@ -39,6 +39,7 @@
link_directories(${LIB_PATHS})
#VALA stuff
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Widgets/)
find_package(Vala REQUIRED)
include(ValaVersion)
ensure_vala_version("0.12.0" MINIMUM)
@@ -66,6 +67,8 @@
Widgets/Welcome.vala
Widgets/ToolButtonWithMenu.vala
config.vapi
+CUSTOM_VAPIS
+ ${CMAKE_CURRENT_SOURCE_DIR}/GtkPatch/gtkpatch-utils.vapi
PACKAGES
${PKG_DEPS}
posix
@@ -79,7 +82,10 @@
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/granite.vapi DESTINATION ${CMAKE_INSTALL_PREFIX}/share/vala/vapi/)
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/granite.deps DESTINATION ${CMAKE_INSTALL_PREFIX}/share/vala/vapi/)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/granite.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/granite/)
+install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/Widgets/widgets-utils.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/granite/)
add_library (${PKGNAME} SHARED
+ GtkPatch/gtkpatch-utils.c
+ Widgets/widgets-utils.c
${VALA_C}
)
if(BUILD_STATIC MATCHES "Yes")
=== modified file 'lib/GtkPatch/AboutDialog.vala'
--- lib/GtkPatch/AboutDialog.vala 2011-10-10 16:03:53 +0000
+++ lib/GtkPatch/AboutDialog.vala 2011-10-12 12:34:23 +0000
@@ -41,7 +41,7 @@
artists_label.set_text("");
}
else {
- artists_label.set_text(set_string_from_string_array("Designed by" + ":\n", _artists));
+ artists_label.set_markup(set_string_from_string_array("<span size=\"small\">Designed by" + ":</span>\n", _artists));
artists_label.show();
}
}
@@ -60,7 +60,7 @@
authors_label.set_text("");
}
else {
- authors_label.set_text(set_string_from_string_array("Written by" + ":\n", _authors));
+ authors_label.set_markup(set_string_from_string_array("<span size=\"small\">Written by" + ":</span>\n", _authors));
authors_label.show();
}
}
@@ -98,7 +98,7 @@
copyright_label.set_text("");
}
else {
- copyright_label.set_text("Copyright © " + _copyright + "\n");
+ copyright_label.set_markup("<span size=\"small\">Copyright © " + _copyright + "</span>\n");
copyright_label.show();
}
}
@@ -116,7 +116,7 @@
documenters_label.hide();
else {
documenters_label.show();
- documenters_label.set_text(set_string_from_string_array("Documented by:\n", documenters));
+ documenters_label.set_markup(set_string_from_string_array("<span size=\"small\">Documented by:</span>\n", documenters));
}
}
get { return _documenters; }
@@ -176,7 +176,7 @@
translators_label.set_text("");
}
else {
- translators_label.set_text("Translated by: " + _translator_credits + "\n");
+ translators_label.set_markup("<span size=\"small\">Translated by " + _translator_credits + "</span>\n");
translators_label.show();
}
}
@@ -281,7 +281,6 @@
name_label.xalign = 0;
name_label.set_line_wrap(true);
name_label.set_selectable(true);
- name_label.use_markup = true;
copyright_label = new Label("");
copyright_label.set_selectable(true);
@@ -350,11 +349,11 @@
close_button.grab_focus();
}
- private string set_string_from_string_array(string title, string[] list)
+ private string set_string_from_string_array(string title, string[] peoples)
{
string text = title;
- foreach (string i in list)
- text += i + "\n";
+ text += add_credits_section (title, peoples);
+
return text;
}
@@ -380,25 +379,25 @@
{
switch (license_type) {
case License.GPL_2_0:
- set_generic_license("http://www.gnu.org/licenses/old-licenses/gpl-2.0.html");
+ set_generic_license("http://www.gnu.org/licenses/old-licenses/gpl-2.0.html", "gpl-2.0");
break;
case License.GPL_3_0:
- set_generic_license("http://www.gnu.org/licenses/gpl.html");
+ set_generic_license("http://www.gnu.org/licenses/gpl.html", "gpl");
break;
case License.LGPL_2_1:
- set_generic_license("http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html");
+ set_generic_license("http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html", "lgpl-2.1");
break;
case License.LGPL_3_0:
- set_generic_license("http://www.gnu.org/licenses/lgpl.html");
+ set_generic_license("http://www.gnu.org/licenses/lgpl.html", "lgpl");
break;
case License.BSD:
- set_generic_license("http://opensource.org/licenses/bsd-license.php");
+ set_generic_license("http://opensource.org/licenses/bsd-license.php", "bsd");
break;
case License.MIT_X11:
- set_generic_license("http://opensource.org/licenses/mit-license.php");
+ set_generic_license("http://opensource.org/licenses/mit-license.php", "mit");
break;
case License.ARTISTIC:
- set_generic_license("http://opensource.org/licenses/artistic-license-2.0.php");
+ set_generic_license("http://opensource.org/licenses/artistic-license-2.0.php", "artistic");
break;
default:
if (license != null && license != "") {
@@ -411,9 +410,9 @@
}
}
- private void set_generic_license(string url)
+ private void set_generic_license(string url, string license_type)
{
- license_label.set_markup("This program comes with ABSOLUTELY NO WARRANTY; for details, visit <a href=\"" + url + "\">" + url + "</a>\n");
+ license_label.set_markup("<span size=\"small\">This program is published under the terms of the " + license_type + " license, it comes with ABSOLUTELY NO WARRANTY; for details, visit <a href=\"" + url + "\">" + url + "</a></span>\n");
license_label.show();
}
@@ -445,3 +444,4 @@
website_url_label.hide();
}
}
+
=== added file 'lib/GtkPatch/gtkpatch-utils.c'
--- lib/GtkPatch/gtkpatch-utils.c 1970-01-01 00:00:00 +0000
+++ lib/GtkPatch/gtkpatch-utils.c 2011-10-12 12:34:23 +0000
@@ -0,0 +1,129 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2001 CodeFactory AB
+ * Copyright (C) 2001, 2002 Anders Carlsson
+ * Copyright (C) 2003, 2004 Matthias Clasen <mclasen@xxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Author: Anders Carlsson <andersca@xxxxxxxxx>
+ *
+ * Modified by the GTK+ Team and others 1997-2004. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "gtkpatch-utils.h"
+
+gchar *
+add_credits_section (gchar *title, gchar **people)
+{
+ gchar **p;
+ gchar *q0, *q1, *q2, *r1, *r2;
+
+ if (people == NULL)
+ return;
+
+ GString *str;
+ str = g_string_new ("<span size=\"small\">");
+ for (p = people; *p; p++)
+ {
+ q0 = *p;
+ while (*q0)
+ {
+ q1 = strchr (q0, '<');
+ q2 = q1 ? strchr (q1, '>') : NULL;
+ r1 = strstr (q0, "http://");
+ if (r1)
+ {
+ r2 = strpbrk (r1, " \n\t");
+ if (!r2)
+ r2 = strchr (r1, '\0');
+ }
+ else
+ r2 = NULL;
+
+ if (r1 && r2 && (!q1 || !q2 || (r1 < q1)))
+ {
+ q1 = r1;
+ q2 = r2;
+ }
+ else if (q1 && (q1[1] == 'a' || q1[1] == 'A') && q1[2] == ' ')
+ {
+ /* if it is a <a> link leave it for the label to parse */
+ q1 = NULL;
+ }
+
+ if (q1 && q2)
+ {
+ gchar *link;
+ gchar *text;
+ gchar *name;
+
+ if (*q1 == '<')
+ {
+ /* email */
+ gchar *escaped;
+
+ text = g_strstrip (g_strndup (q0, q1 - q0));
+ name = g_markup_escape_text (text, -1);
+ q1++;
+ link = g_strndup (q1, q2 - q1);
+ q2++;
+ escaped = g_uri_escape_string (link, NULL, FALSE);
+ g_string_append_printf (str,
+ "<a href=\"mailto:%s\">%s</a>",
+ escaped,
+ name[0] ? name : link);
+ g_free (escaped);
+ g_free (link);
+ g_free (text);
+ g_free (name);
+ }
+ else
+ {
+ /* uri */
+ text = g_strstrip (g_strndup (q0, q1 - q0));
+ name = g_markup_escape_text (text, -1);
+ link = g_strndup (q1, q2 - q1);
+ g_string_append_printf (str,
+ "<a href=\"%s\">%s</a>",
+ link,
+ name[0] ? name : link);
+ g_free (link);
+ g_free (text);
+ g_free (name);
+ }
+
+ q0 = q2;
+ }
+ else
+ {
+ g_string_append (str, q0);
+ break;
+ }
+ }
+ g_string_append (str, "\n");
+ }
+ g_string_append (str, "</span>");
+ gchar *result = strdup (str->str);
+ g_string_free (str, TRUE);
+
+ return result;
+}
+
=== added file 'lib/GtkPatch/gtkpatch-utils.h'
--- lib/GtkPatch/gtkpatch-utils.h 1970-01-01 00:00:00 +0000
+++ lib/GtkPatch/gtkpatch-utils.h 2011-10-12 12:34:23 +0000
@@ -0,0 +1,4 @@
+#include <glib.h>
+#include <string.h>
+
+gchar *add_credits_section (gchar *title, gchar **people);
=== added file 'lib/GtkPatch/gtkpatch-utils.vapi'
--- lib/GtkPatch/gtkpatch-utils.vapi 1970-01-01 00:00:00 +0000
+++ lib/GtkPatch/gtkpatch-utils.vapi 2011-10-12 12:34:23 +0000
@@ -0,0 +1,3 @@
+
+private string add_credits_section (string title, string[] people);
+
=== modified file 'lib/Widgets/AboutDialog.vala'
--- lib/Widgets/AboutDialog.vala 2011-10-10 15:30:04 +0000
+++ lib/Widgets/AboutDialog.vala 2011-10-12 12:34:23 +0000
@@ -23,80 +23,84 @@
using Gtk;
-public class Granite.Widgets.AboutDialog : Granite.GtkPatch.AboutDialog
-{
- /**
- * The URL for the link to the website of the program.
- */
- public string help {
- set {
- _help = value;
- help_button.sensitive = !(_help == null || _help == "");
- }
- get { return _help; }
- }
- string _help = "";
-
- /**
- * The URL for the link to the website of the program.
- */
- public string translate {
- set {
- _translate = value;
- translate_button.sensitive = !(_translate == null || _translate == "");
- }
- get { return _translate; }
- }
- string _translate = "";
-
- /**
- * The URL for the link to the website of the program.
- */
- public string bug {
- set {
- _bug = value;
- bug_button.sensitive = !(_bug == null || _bug == "");
- }
- get { return _bug; }
- }
- string _bug = "";
-
- Button help_button;
- Button translate_button;
- Button bug_button;
-
- /**
- * Creates a new Granite.AboutDialog
- */
- public AboutDialog()
+namespace Granite.Widgets {
+ public class AboutDialog : Granite.GtkPatch.AboutDialog
{
- Box action_area = (Box)get_action_area();
-
- /* help button */
- help_button = new Button.with_label(" ? ");
- help_button.get_style_context ().add_class ("help_button");
- help_button.halign = Gtk.Align.CENTER;
- /* FIXME test & discuss and fix this ugly hack */
- help_button.set_size_request (25, -1);
- help_button.pressed.connect(() => { activate_link(help); });
- action_area.pack_end (help_button, false, false, 0);
- ((Gtk.ButtonBox) action_area).set_child_secondary (help_button, true);
- ((Gtk.ButtonBox) action_area).set_child_non_homogeneous (help_button, true);
-
- /* translate button */
- translate_button = new Button.with_label("Translate this app");
- translate_button.pressed.connect(() => { activate_link(translate); });
- action_area.pack_start (translate_button, false, false, 0);
-
- /* bug button */
- bug_button = new Button.with_label("Report a problem");
- bug_button.pressed.connect(() => { activate_link(bug); });
- action_area.pack_start (bug_button, false, false, 0);
-
- action_area.reorder_child(bug_button, 0);
- action_area.reorder_child(translate_button, 0);
-
- action_area.show_all();
-
+ /**
+ * The URL for the link to the website of the program.
+ */
+ public string help {
+ set {
+ _help = value;
+ help_button.sensitive = !(_help == null || _help == "");
+ }
+ get { return _help; }
+ }
+ string _help = "";
+
+ /**
+ * The URL for the link to the website of the program.
+ */
+ public string translate {
+ set {
+ _translate = value;
+ translate_button.sensitive = !(_translate == null || _translate == "");
+ }
+ get { return _translate; }
+ }
+ string _translate = "";
+
+ /**
+ * The URL for the link to the website of the program.
+ */
+ public string bug {
+ set {
+ _bug = value;
+ bug_button.sensitive = !(_bug == null || _bug == "");
+ }
+ get { return _bug; }
+ }
+ string _bug = "";
+
+ Button help_button;
+ Button translate_button;
+ Button bug_button;
+
+ /**
+ * Creates a new Granite.AboutDialog
+ */
+ public AboutDialog()
+ {
+ Box action_area = (Box)get_action_area();
+
+ /* help button */
+ help_button = new Button.with_label(" ? ");
+ help_button.get_style_context ().add_class ("help_button");
+ help_button.halign = Gtk.Align.CENTER;
+ /* FIXME test & discuss and fix this ugly hack */
+ help_button.set_size_request (25, -1);
+ help_button.pressed.connect(() => { activate_link(help); });
+ action_area.pack_end (help_button, false, false, 0);
+ ((Gtk.ButtonBox) action_area).set_child_secondary (help_button, true);
+ ((Gtk.ButtonBox) action_area).set_child_non_homogeneous (help_button, true);
+
+ /* translate button */
+ translate_button = new Button.with_label("Translate this app");
+ translate_button.pressed.connect(() => { activate_link(translate); });
+ action_area.pack_start (translate_button, false, false, 0);
+
+ /* bug button */
+ bug_button = new Button.with_label("Report a problem");
+ bug_button.pressed.connect(() => { activate_link(bug); });
+ action_area.pack_start (bug_button, false, false, 0);
+
+ action_area.reorder_child(bug_button, 0);
+ action_area.reorder_child(translate_button, 0);
+
+ action_area.show_all();
+
+ }
}
+
+ public extern void show_about_dialog (Gtk.Window *parent, ...);
}
=== added file 'lib/Widgets/widgets-utils.c'
--- lib/Widgets/widgets-utils.c 1970-01-01 00:00:00 +0000
+++ lib/Widgets/widgets-utils.c 2011-10-12 12:34:23 +0000
@@ -0,0 +1,101 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2001 CodeFactory AB
+ * Copyright (C) 2001, 2002 Anders Carlsson
+ * Copyright (C) 2003, 2004 Matthias Clasen <mclasen@xxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Author: Anders Carlsson <andersca@xxxxxxxxx>
+ *
+ * Modified by the GTK+ Team and others 1997-2004. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "widgets-utils.h"
+
+static void
+close_cb (GtkWidget *about)
+{
+ GtkAboutDialogPrivate *priv = about->priv;
+
+ gtk_widget_hide (about);
+}
+
+/**
+ * gtk_show_about_dialog:
+ * @parent: (allow-none): transient parent, or %NULL for none
+ * @first_property_name: the name of the first property
+ * @Varargs: value of first property, followed by more properties, %NULL-terminated
+ *
+ * This is a convenience function for showing an application's about box.
+ * The constructed dialog is associated with the parent window and
+ * reused for future invocations of this function.
+ *
+ * Since: 2.6
+ */
+void
+ granite_widgets_show_about_dialog (GtkWindow *parent,
+ const gchar *first_property_name,
+ ...)
+{
+ static GtkWidget *global_about_dialog = NULL;
+ GtkWidget *dialog = NULL;
+ va_list var_args;
+
+ if (parent)
+ dialog = g_object_get_data (G_OBJECT (parent), "gtk-about-dialog");
+ else
+ dialog = global_about_dialog;
+
+ if (!dialog)
+ {
+ //dialog = gtk_about_dialog_new ();
+ dialog = granite_widgets_about_dialog_new ();
+ g_object_ref_sink (dialog);
+
+ g_signal_connect (dialog, "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+
+ /* Close dialog on user response */
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (close_cb), NULL);
+
+ va_start (var_args, first_property_name);
+ g_object_set_valist (G_OBJECT (dialog), first_property_name, var_args);
+ va_end (var_args);
+
+ if (parent)
+ {
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+ g_object_set_data_full (G_OBJECT (parent),
+ "gtk-about-dialog",
+ dialog, g_object_unref);
+ }
+ else
+ global_about_dialog = dialog;
+
+ }
+
+ gtk_window_present (GTK_WINDOW (dialog));
+}
+
+
=== added file 'lib/Widgets/widgets-utils.h'
--- lib/Widgets/widgets-utils.h 1970-01-01 00:00:00 +0000
+++ lib/Widgets/widgets-utils.h 2011-10-12 12:34:23 +0000
@@ -0,0 +1,6 @@
+#include <glib.h>
+#include <gtk/gtk.h>
+
+void granite_widgets_show_about_dialog (GtkWindow *parent,
+ const gchar *first_property_name,
+ ...);
Follow ups