From: "Jaap A. Haitsma" <jaap@haitsma.org>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] [PATCH] Beautify about dialog
Date: Sun, 16 Dec 2007 22:09:25 +0100 [thread overview]
Message-ID: <8a8adccc0712161309m29c70a45x212bead7a823d808@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
Attached patch does the following
* about dialog code is simpler
* email address and URLs are clickable
* Makes sure that every window gets a bluetooth window icon
Jaap
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnome-bluetooth-about-dialog.patch --]
[-- Type: text/x-patch; name=gnome-bluetooth-about-dialog.patch, Size: 7792 bytes --]
? Makefile
? Makefile.in
? aclocal.m4
? autogen.sh
? autom4te.cache
? config.guess
? config.h
? config.h.in
? config.log
? config.status
? config.sub
? configure
? depcomp
? install-sh
? intltool-extract
? intltool-extract.in
? intltool-merge
? intltool-merge.in
? intltool-update
? intltool-update.in
? missing
? mkinstalldirs
? omf.make
? stamp-h1
? xmldocs.make
? analyzer/.deps
? analyzer/Makefile
? analyzer/Makefile.in
? analyzer/bluetooth-analyzer
? analyzer/bluetooth-analyzer.desktop
? analyzer/bluetooth-manager.xml
? applet/.deps
? applet/Makefile
? applet/Makefile.in
? applet/bluetooth-applet
? applet/bluetooth-applet.desktop
? common/.deps
? common/Makefile
? common/Makefile.in
? common/auth-agent-glue.h
? common/dbus-glue.h
? common/marshal.c
? common/marshal.h
? common/passkey-agent-glue.h
? common/test-agent
? common/test-client
? common/test-deviceselection
? po/.intltool-merge-cache
? po/Makefile
? po/Makefile.in
? po/Makefile.in.in
? po/POTFILES
? po/bg.gmo
? po/ca.gmo
? po/cs.gmo
? po/da.gmo
? po/de.gmo
? po/en_GB.gmo
? po/es.gmo
? po/fi.gmo
? po/fr.gmo
? po/hu.gmo
? po/id.gmo
? po/it.gmo
? po/ku.gmo
? po/nb.gmo
? po/nl.gmo
? po/pl.gmo
? po/pt.gmo
? po/pt_BR.gmo
? po/ro.gmo
? po/ru.gmo
? po/sk.gmo
? po/sr.gmo
? po/stamp-it
? po/sv.gmo
? po/tr.gmo
? po/zh_CN.gmo
? properties/.deps
? properties/Makefile
? properties/Makefile.in
? properties/bluetooth-manager.schemas
? properties/bluetooth-properties
? properties/bluetooth-properties.desktop
? proximity/.deps
? proximity/Makefile
? proximity/Makefile.in
? proximity/bluetooth-proximity
? proximity/marshal.c
? proximity/marshal.h
? sendto/.deps
? sendto/Makefile
? sendto/Makefile.in
? sendto/bluetooth-sendto
? sendto/marshal.c
? sendto/marshal.h
? wizard/.deps
? wizard/Makefile
? wizard/Makefile.in
? wizard/bluetooth-wizard
Index: applet/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.89
diff -u -r1.89 main.c
--- applet/main.c 4 Dec 2007 15:30:51 -0000 1.89
+++ applet/main.c 16 Dec 2007 21:06:42 -0000
@@ -1504,48 +1504,119 @@
gtk_widget_destroy(dialog);
}
-static void about_callback(GtkWidget *item, gpointer user_data)
+static void
+about_dialog_handle_url_cb (GtkAboutDialog *about, const gchar *url, gpointer data)
{
- const gchar *authors[] = {
- "Marcel Holtmann <marcel@holtmann.org>",
- "Bastien Nocera <hadess@hadess.net>",
- NULL
- };
- GtkWidget *dialog;
+ GError *error = NULL;
+ gboolean ret;
+ char *cmdline;
+ GdkScreen *gscreen;
+ GtkWidget *error_dialog;
+
+ gscreen = gdk_screen_get_default();
+
+ cmdline = g_strconcat ("gnome-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
- dialog = gtk_about_dialog_new();
+ if (ret == TRUE)
+ return;
- gtk_window_set_icon_name(GTK_WINDOW(dialog), "stock_bluetooth");
+ g_error_free (error);
+ error = NULL;
- gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog),
- _("Bluetooth Applet"));
+ cmdline = g_strconcat ("xdg-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret == FALSE) {
+ error_dialog = gtk_message_dialog_new ( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Failed to show url %s", error->message);
+ gtk_dialog_run (GTK_DIALOG (error_dialog));
+ g_error_free (error);
+ }
- gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION);
+}
- gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),
- "Copyright \xc2\xa9 2005-2007 Marcel Holtmann");
+/* Make email in about dialog clickable */
+static void
+about_dialog_handle_email_cb (GtkAboutDialog *about, const char *email_address, gpointer data)
+{
+ GError *error = NULL;
+ gboolean ret;
+ char *cmdline;
+ GdkScreen *gscreen;
+ GtkWidget *error_dialog;
+
+ gscreen = gdk_screen_get_default();
+
+ cmdline = g_strconcat ("gnome-open mailto:", email_address, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
- gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog),
- _("A Bluetooth manager for the GNOME desktop"));
+ if (ret == TRUE)
+ return;
- gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(dialog),
- "stock_bluetooth");
+ g_error_free (error);
+ error = NULL;
- gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog),
- "www.bluez.org");
+ cmdline = g_strconcat ("xdg-open mailto:", email_address, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret == FALSE) {
+ error_dialog = gtk_message_dialog_new ( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Failed to show url %s", error->message);
+ gtk_dialog_run (GTK_DIALOG (error_dialog));
+ g_error_free (error);
+ }
+}
- gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors);
- gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog),
- _("translator-credits"));
+static void about_callback(GtkWidget *item, gpointer user_data)
+{
+ const gchar *authors[] = {
+ "Marcel Holtmann <marcel@holtmann.org>",
+ "Bastien Nocera <hadess@hadess.net>",
+ NULL
+ };
- g_signal_connect(dialog, "close",
- G_CALLBACK(close_callback), NULL);
+ const char *translators;
+ translators = _("translator-credits");
- g_signal_connect(dialog, "response",
- G_CALLBACK(close_callback), NULL);
+ const char *license[] = {
+ N_("This program is free software; you can redistribute it and/or modify "
+ "it under the terms of the GNU General Public License as published by "
+ "the Free Software Foundation; either version 2 of the License, or "
+ "(at your option) any later version.\n"),
+ N_("This program 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 General Public License for more details.\n"),
+ N_("You should have received a copy of the GNU General Public License "
+ "along with this program. If not, see <http://www.gnu.org/licenses/>.")
+ };
+
+ char *license_trans;
+
+ license_trans = g_strconcat (_(license[0]), "\n", _(license[1]), "\n",
+ _(license[2]), "\n", NULL);
+
+ gtk_about_dialog_set_url_hook (about_dialog_handle_url_cb, NULL, NULL);
+ gtk_about_dialog_set_email_hook (about_dialog_handle_email_cb, NULL, NULL);
+
+ gtk_show_about_dialog (NULL,
+ "version", VERSION,
+ "copyright", "Copyright \xc2\xa9 2005-2007 Marcel Holtmann",
+ "comments", _("A Bluetooth manager for the GNOME desktop"),
+ "authors", authors,
+ "translator-credits", translators,
+ "website", "http://www.bluez.org",
+ "website-label", _("Bluez Website"),
+ "logo-icon-name", "stock_bluetooth",
+ "wrap-license", TRUE,
+ "license", license_trans,
+ NULL);
- gtk_widget_show_all(dialog);
+ g_free (license_trans);
}
static void settings_callback(GObject *widget, gpointer user_data)
@@ -1795,6 +1866,8 @@
#ifdef HAVE_LIBNOTIFY
notify_init("bluetooth-manager");
#endif
+ g_set_application_name (_("Bluetooth Applet"));
+ gtk_window_set_default_icon_name ("stock_bluetooth");
conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
if (error != NULL) {
[-- Attachment #3: Type: text/plain, Size: 308 bytes --]
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next reply other threads:[~2007-12-16 21:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-16 21:09 Jaap A. Haitsma [this message]
2007-12-16 21:47 ` [Bluez-devel] [PATCH] Beautify about dialog Marcel Holtmann
2007-12-16 22:43 ` Jaap A. Haitsma
2007-12-16 23:24 ` Bastien Nocera
2007-12-17 1:03 ` Marcel Holtmann
2007-12-17 7:15 ` Jaap A. Haitsma
2007-12-17 7:54 ` Jaap A. Haitsma
2007-12-17 10:43 ` Bastien Nocera
2007-12-17 19:04 ` Marcel Holtmann
2007-12-18 21:52 ` Jaap A. Haitsma
2007-12-18 23:22 ` Marcel Holtmann
2007-12-20 22:24 ` Jaap A. Haitsma
2007-12-17 0:58 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8a8adccc0712161309m29c70a45x212bead7a823d808@mail.gmail.com \
--to=jaap@haitsma.org \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox