* [Bluez-devel] [PATCH] Beautify about dialog
@ 2007-12-16 21:09 Jaap A. Haitsma
2007-12-16 21:47 ` Marcel Holtmann
0 siblings, 1 reply; 13+ messages in thread
From: Jaap A. Haitsma @ 2007-12-16 21:09 UTC (permalink / raw)
To: bluez-devel
[-- 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
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-16 21:09 [Bluez-devel] [PATCH] Beautify about dialog Jaap A. Haitsma @ 2007-12-16 21:47 ` Marcel Holtmann 2007-12-16 22:43 ` Jaap A. Haitsma 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2007-12-16 21:47 UTC (permalink / raw) To: BlueZ development Hi Jaap, > Attached patch does the following > > * about dialog code is simpler you can't use gtk_dialog_run for the applet's about dialog. It will block and thus block all PIN requests. The current code is this way for a reason. > * email address and URLs are clickable Send a separate patch for this. > * Makes sure that every window gets a bluetooth window icon This should be already working. And if it is missing somewhere, I need a separate patch for it. Regards Marcel ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-16 21:47 ` Marcel Holtmann @ 2007-12-16 22:43 ` Jaap A. Haitsma 2007-12-16 23:24 ` Bastien Nocera 2007-12-17 0:58 ` Marcel Holtmann 0 siblings, 2 replies; 13+ messages in thread From: Jaap A. Haitsma @ 2007-12-16 22:43 UTC (permalink / raw) To: BlueZ development [-- Attachment #1: Type: text/plain, Size: 1385 bytes --] Hi Marcel, > > > Attached patch does the following > > > > * about dialog code is simpler > > you can't use gtk_dialog_run for the applet's about dialog. It will > block and thus block all PIN requests. The current code is this way for > a reason. Didn't know that. I now use g_object_set which also reduces the amount of code considerably. > > * email address and URLs are clickable > > Send a separate patch for this. It's still in the same patch, because the patches change stuff in the same function These two function calls in about_callback do the trick 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); > > * Makes sure that every window gets a bluetooth window icon > > This should be already working. And if it is missing somewhere, I need a > separate patch for it. The credits window didn't have it. The call: gtk_window_set_default_icon_name ("stock_bluetooth"); makes sure that any window at least gets an icon g_set_application_name (_("Bluetooth Applet")); makes sure that the about dialog always says "Bluetooth Applet" no matter which version of GTK you have installed. (In GTK 2.12 the name attribute was changed) I hope that with this info it is easy to review the patch. If not let me know and I'll try to split it up Kind regards Jaap Jaap [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: gnome-bluetooth-about-dialog2.patch --] [-- Type: text/x-patch; name=gnome-bluetooth-about-dialog2.patch, Size: 5738 bytes --] 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 22:31:35 -0000 @@ -1504,40 +1504,120 @@ 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; + + 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); + } + +} + +/* 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); + + if (ret == TRUE) + return; - gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), - _("Bluetooth Applet")); + g_error_free (error); + error = NULL; - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION); + 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_copyright(GTK_ABOUT_DIALOG(dialog), - "Copyright \xc2\xa9 2005-2007 Marcel Holtmann"); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), - _("A Bluetooth manager for the GNOME desktop")); +static void about_callback(GtkWidget *item, gpointer user_data) +{ + GtkWidget *dialog; + + const gchar *authors[] = { + "Marcel Holtmann <marcel@holtmann.org>", + "Bastien Nocera <hadess@hadess.net>", + NULL + }; + const char *translators; + translators = _("translator-credits"); - gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(dialog), - "stock_bluetooth"); + 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_website(GTK_ABOUT_DIALOG(dialog), - "www.bluez.org"); + 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_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors); + dialog = gtk_about_dialog_new(); - gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), - _("translator-credits")); + g_object_set (G_OBJECT(dialog), + "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); g_signal_connect(dialog, "close", G_CALLBACK(close_callback), NULL); @@ -1795,6 +1875,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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 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 0:58 ` Marcel Holtmann 1 sibling, 1 reply; 13+ messages in thread From: Bastien Nocera @ 2007-12-16 23:24 UTC (permalink / raw) To: BlueZ development Hey Jaap, On Sun, 2007-12-16 at 23:43 +0100, Jaap A. Haitsma wrote: > Hi Marcel, > > > > > > Attached patch does the following > > > > > > * about dialog code is simpler > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > block and thus block all PIN requests. The current code is this way for > > a reason. > > Didn't know that. I now use g_object_set which also reduces the amount > of code considerably. You can still use gtk_show_about_dialog(). It removes the close callback, and makes sure that only one dialogue shows up, and removes a lot of boiler-plate code (it doesn't use a separate main loop like gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is still needed. Cheers ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-16 23:24 ` Bastien Nocera @ 2007-12-17 1:03 ` Marcel Holtmann 2007-12-17 7:15 ` Jaap A. Haitsma 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2007-12-17 1:03 UTC (permalink / raw) To: BlueZ development Hi Bastien, > > > > Attached patch does the following > > > > > > > > * about dialog code is simpler > > > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > > block and thus block all PIN requests. The current code is this way for > > > a reason. > > > > Didn't know that. I now use g_object_set which also reduces the amount > > of code considerably. > > You can still use gtk_show_about_dialog(). It removes the close > callback, and makes sure that only one dialogue shows up, and removes a > lot of boiler-plate code (it doesn't use a separate main loop like > gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is > still needed. not sure why I haven't done it that way. Maybe it was not available when I wrote the initial version. However now the requirements are GTK 2.10 or later. So if we can simplify code, I am all for it. Regards Marcel ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 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 19:04 ` Marcel Holtmann 0 siblings, 2 replies; 13+ messages in thread From: Jaap A. Haitsma @ 2007-12-17 7:15 UTC (permalink / raw) To: BlueZ development [-- Attachment #1: Type: text/plain, Size: 1123 bytes --] On Dec 17, 2007 2:03 AM, Marcel Holtmann <marcel@holtmann.org> wrote: > Hi Bastien, > > > > > > Attached patch does the following > > > > > > > > > > * about dialog code is simpler > > > > > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > > > block and thus block all PIN requests. The current code is this way for > > > > a reason. > > > > > > Didn't know that. I now use g_object_set which also reduces the amount > > > of code considerably. > > > > You can still use gtk_show_about_dialog(). It removes the close > > callback, and makes sure that only one dialogue shows up, and removes a > > lot of boiler-plate code (it doesn't use a separate main loop like > > gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is > > still needed. > > not sure why I haven't done it that way. Maybe it was not available when > I wrote the initial version. However now the requirements are GTK 2.10 > or later. So if we can simplify code, I am all for it. > > Regards > Attached two patches One uses gtk-show-about-dialog The other makes sure that the windows always get an icon Jaap [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: bluez-gnome-window-icon.patch --] [-- Type: text/x-patch; name=bluez-gnome-window-icon.patch, Size: 498 bytes --] Index: applet/main.c =================================================================== RCS file: /cvsroot/bluez/gnome/applet/main.c,v retrieving revision 1.90 diff -u -r1.90 main.c --- applet/main.c 17 Dec 2007 01:41:19 -0000 1.90 +++ applet/main.c 17 Dec 2007 07:09:50 -0000 @@ -1812,6 +1812,7 @@ #ifdef HAVE_LIBNOTIFY notify_init("bluetooth-manager"); #endif + gtk_window_set_default_icon_name ("stock_bluetooth"); conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); if (error != NULL) { [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #3: bluez-gnome-gtk-show-about-dialog.patch --] [-- Type: text/x-patch; name=bluez-gnome-gtk-show-about-dialog.patch, Size: 3853 bytes --] Index: applet/main.c =================================================================== RCS file: /cvsroot/bluez/gnome/applet/main.c,v retrieving revision 1.90 diff -u -r1.90 main.c --- applet/main.c 17 Dec 2007 01:41:19 -0000 1.90 +++ applet/main.c 17 Dec 2007 07:08:33 -0000 @@ -1521,50 +1521,48 @@ "Bastien Nocera <hadess@hadess.net>", NULL }; - GtkWidget *dialog; - - dialog = gtk_about_dialog_new(); - - gtk_window_set_icon_name(GTK_WINDOW(dialog), "stock_bluetooth"); - - gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), - _("Bluetooth Applet")); - - 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"); - - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), - _("A Bluetooth manager for the GNOME desktop")); - - gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(dialog), - "stock_bluetooth"); - - gtk_about_dialog_set_url_hook(about_url_hook, NULL, NULL); - - gtk_about_dialog_set_email_hook(about_email_hook, NULL, NULL); - - gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), - "http://www.bluez.org"); - - gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(dialog), - "www.bluez.org"); - - gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors); - - gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), - _("translator-credits")); - - g_signal_connect(dialog, "close", - G_CALLBACK(close_callback), NULL); - - g_signal_connect(dialog, "response", - G_CALLBACK(close_callback), NULL); - - gtk_widget_show_all(dialog); + + const char *translators; + translators = _("translator-credits"); + + 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_url_hook, NULL, NULL); + gtk_about_dialog_set_email_hook (about_email_hook, NULL, NULL); + + gtk_show_about_dialog (NULL, + "program-name", _("Bluetooth Applet"), + "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); + g_free (license_trans); } + static void settings_callback(GObject *widget, gpointer user_data) { const char *command = "bluetooth-properties"; [-- Attachment #4: 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 #5: Type: text/plain, Size: 164 bytes --] _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 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 1 sibling, 1 reply; 13+ messages in thread From: Jaap A. Haitsma @ 2007-12-17 7:54 UTC (permalink / raw) To: BlueZ development On Dec 17, 2007 8:15 AM, Jaap A. Haitsma <jaap@haitsma.org> wrote: > On Dec 17, 2007 2:03 AM, Marcel Holtmann <marcel@holtmann.org> wrote: > > Hi Bastien, > > > > > > > > Attached patch does the following > > > > > > > > > > > > * about dialog code is simpler > > > > > > > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > > > > block and thus block all PIN requests. The current code is this way for > > > > > a reason. > > > > > > > > Didn't know that. I now use g_object_set which also reduces the amount > > > > of code considerably. > > > > > > You can still use gtk_show_about_dialog(). It removes the close > > > callback, and makes sure that only one dialogue shows up, and removes a > > > lot of boiler-plate code (it doesn't use a separate main loop like > > > gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is > > > still needed. > > > > not sure why I haven't done it that way. Maybe it was not available when > > I wrote the initial version. However now the requirements are GTK 2.10 > > or later. So if we can simplify code, I am all for it. > > > > Regards > > > Attached two patches > > One uses gtk-show-about-dialog > The other makes sure that the windows always get an icon > Hi I don't have access to the source code at the moment, but I just thought of the fact that in gtk-show-about-dialog I set "program-name". "program-name" got introduced in GTK 2.12, because "name" was already a property of GtkWidget. So setting "name" does not give the desired result for GTK >= 2.12 and "program-name" does not exist in GTK < 2.12 I know of two solutions 1. Don't set program-name or name but just call a g_set_application_name (_("Bluetooth Applet)); 2. Use #ifdef in which you check the version of GTK and depending on the version you set name or program name Jaap ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-17 7:54 ` Jaap A. Haitsma @ 2007-12-17 10:43 ` Bastien Nocera 0 siblings, 0 replies; 13+ messages in thread From: Bastien Nocera @ 2007-12-17 10:43 UTC (permalink / raw) To: BlueZ development On Mon, 2007-12-17 at 08:54 +0100, Jaap A. Haitsma wrote: <snip> > I know of two solutions > 1. Don't set program-name or name but just call a > g_set_application_name (_("Bluetooth Applet)); > 2. Use #ifdef in which you check the version of GTK and depending on > the version you set name or program name That's what GTK_CHECK_VERSION() is for. ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-17 7:15 ` Jaap A. Haitsma 2007-12-17 7:54 ` Jaap A. Haitsma @ 2007-12-17 19:04 ` Marcel Holtmann 2007-12-18 21:52 ` Jaap A. Haitsma 1 sibling, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2007-12-17 19:04 UTC (permalink / raw) To: BlueZ development Hi Jaap, > > > > > > Attached patch does the following > > > > > > > > > > > > * about dialog code is simpler > > > > > > > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > > > > block and thus block all PIN requests. The current code is this way for > > > > > a reason. > > > > > > > > Didn't know that. I now use g_object_set which also reduces the amount > > > > of code considerably. > > > > > > You can still use gtk_show_about_dialog(). It removes the close > > > callback, and makes sure that only one dialogue shows up, and removes a > > > lot of boiler-plate code (it doesn't use a separate main loop like > > > gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is > > > still needed. > > > > not sure why I haven't done it that way. Maybe it was not available when > > I wrote the initial version. However now the requirements are GTK 2.10 > > or later. So if we can simplify code, I am all for it. > > > Attached two patches > > One uses gtk-show-about-dialog fix the coding style for this one. I can already see that it messes up the whitespaces. We use tabs and no whitespace in front of the ( in function declarations. > The other makes sure that the windows always get an icon I applied that patch, but at the same time I applied it to all other applications inside bluez-gnome. There is more than the applet. Regards Marcel ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-17 19:04 ` Marcel Holtmann @ 2007-12-18 21:52 ` Jaap A. Haitsma 2007-12-18 23:22 ` Marcel Holtmann 0 siblings, 1 reply; 13+ messages in thread From: Jaap A. Haitsma @ 2007-12-18 21:52 UTC (permalink / raw) To: BlueZ development [-- Attachment #1: Type: text/plain, Size: 1365 bytes --] On Dec 17, 2007 8:04 PM, Marcel Holtmann <marcel@holtmann.org> wrote: > Hi Jaap, > > > > > > > > Attached patch does the following > > > > > > > > > > > > > > * about dialog code is simpler > > > > > > > > > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > > > > > block and thus block all PIN requests. The current code is this way for > > > > > > a reason. > > > > > > > > > > Didn't know that. I now use g_object_set which also reduces the amount > > > > > of code considerably. > > > > > > > > You can still use gtk_show_about_dialog(). It removes the close > > > > callback, and makes sure that only one dialogue shows up, and removes a > > > > lot of boiler-plate code (it doesn't use a separate main loop like > > > > gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is > > > > still needed. > > > > > > not sure why I haven't done it that way. Maybe it was not available when > > > I wrote the initial version. However now the requirements are GTK 2.10 > > > or later. So if we can simplify code, I am all for it. > > > > > Attached two patches > > > > One uses gtk-show-about-dialog > > fix the coding style for this one. I can already see that it messes up > the whitespaces. We use tabs and no whitespace in front of the ( in > function declarations. Attached patch with coding style fixup attached Jaap [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: gnome-bluetooth-gtk-show-about-dialog.patch --] [-- Type: text/x-patch; name=gnome-bluetooth-gtk-show-about-dialog.patch, Size: 3302 bytes --] Index: applet/main.c =================================================================== RCS file: /cvsroot/bluez/gnome/applet/main.c,v retrieving revision 1.93 diff -u -r1.93 main.c --- applet/main.c 18 Dec 2007 20:27:58 -0000 1.93 +++ applet/main.c 18 Dec 2007 21:49:59 -0000 @@ -1524,48 +1524,49 @@ "Bastien Nocera <hadess@hadess.net>", NULL }; - GtkWidget *dialog; - - dialog = gtk_about_dialog_new(); - - gtk_window_set_icon_name(GTK_WINDOW(dialog), "stock_bluetooth"); - - gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), - _("Bluetooth Applet")); - - 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"); - - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), - _("A Bluetooth manager for the GNOME desktop")); - - gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(dialog), - "stock_bluetooth"); + const char *translators; + translators = _("translator-credits"); + + 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_url_hook, NULL, NULL); - gtk_about_dialog_set_email_hook(about_email_hook, NULL, NULL); - gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), - "http://www.bluez.org"); - - gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(dialog), - "www.bluez.org"); - - gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors); - - gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), - _("translator-credits")); - - g_signal_connect(dialog, "close", - G_CALLBACK(close_callback), NULL); - - g_signal_connect(dialog, "response", - G_CALLBACK(close_callback), NULL); - - gtk_widget_show_all(dialog); + gtk_show_about_dialog(NULL, +#if GTK_CHECK_VERSION(2,12,0) + "program-name", _("Bluetooth Applet"), +#else + "name", _("Bluetooth Applet"), +#endif + "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); + g_free(license_trans); } static void settings_callback(GObject *widget, gpointer user_data) [-- 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-18 21:52 ` Jaap A. Haitsma @ 2007-12-18 23:22 ` Marcel Holtmann 2007-12-20 22:24 ` Jaap A. Haitsma 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2007-12-18 23:22 UTC (permalink / raw) To: BlueZ development Hi Jaap, > > > > > > > > Attached patch does the following > > > > > > > > > > > > > > > > * about dialog code is simpler > > > > > > > > > > > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > > > > > > block and thus block all PIN requests. The current code is this way for > > > > > > > a reason. > > > > > > > > > > > > Didn't know that. I now use g_object_set which also reduces the amount > > > > > > of code considerably. > > > > > > > > > > You can still use gtk_show_about_dialog(). It removes the close > > > > > callback, and makes sure that only one dialogue shows up, and removes a > > > > > lot of boiler-plate code (it doesn't use a separate main loop like > > > > > gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is > > > > > still needed. > > > > > > > > not sure why I haven't done it that way. Maybe it was not available when > > > > I wrote the initial version. However now the requirements are GTK 2.10 > > > > or later. So if we can simplify code, I am all for it. > > > > > > > Attached two patches > > > > > > One uses gtk-show-about-dialog > > > > fix the coding style for this one. I can already see that it messes up > > the whitespaces. We use tabs and no whitespace in front of the ( in > > function declarations. > > Attached patch with coding style fixup attached I don't see the advantage of this patch. Especially with this ugly ifdef for the program-name bug, I decided to not apply it. Especially the license crap is not worth doing it. There is no need that the UI shows the license in the about dialog. You can still fill in the code for the URL and email hooks to make the actually work. I didn't bother so far, because the default screen thing seem to be wrong. You should use the screen where the actual about dialog is present. However I am not so deep into GDK to tell what is the correct way here. Regards Marcel ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-18 23:22 ` Marcel Holtmann @ 2007-12-20 22:24 ` Jaap A. Haitsma 0 siblings, 0 replies; 13+ messages in thread From: Jaap A. Haitsma @ 2007-12-20 22:24 UTC (permalink / raw) To: BlueZ development [-- Attachment #1: Type: text/plain, Size: 4264 bytes --] On Dec 19, 2007 12:22 AM, Marcel Holtmann <marcel@holtmann.org> wrote: > > Hi Jaap, > > > > > > > > > > Attached patch does the following > > > > > > > > > > > > > > > > > > * about dialog code is simpler > > > > > > > > > > > > > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > > > > > > > block and thus block all PIN requests. The current code is this way for > > > > > > > > a reason. > > > > > > > > > > > > > > Didn't know that. I now use g_object_set which also reduces the amount > > > > > > > of code considerably. > > > > > > > > > > > > You can still use gtk_show_about_dialog(). It removes the close > > > > > > callback, and makes sure that only one dialogue shows up, and removes a > > > > > > lot of boiler-plate code (it doesn't use a separate main loop like > > > > > > gtk_dialog_run does). The gtk_dialog_run avoidance in the callbacks is > > > > > > still needed. > > > > > > > > > > not sure why I haven't done it that way. Maybe it was not available when > > > > > I wrote the initial version. However now the requirements are GTK 2.10 > > > > > or later. So if we can simplify code, I am all for it. > > > > > > > > > Attached two patches > > > > > > > > One uses gtk-show-about-dialog > > > > > > fix the coding style for this one. I can already see that it messes up > > > the whitespaces. We use tabs and no whitespace in front of the ( in > > > function declarations. > > > > Attached patch with coding style fixup attached > > I don't see the advantage of this patch. Especially with this ugly ifdef > for the program-name bug, I decided to not apply it. The "program-name" thing actually solved a bug in GTK+. See [1] The ugly ifdef you don't have to do if you use g_set_application_name [2]. Can you explain what's against against using g_set_application_name? It seems a handy function to me. You call it once in main and it's set correctly for error dialogs etc. > Especially the > license crap is not worth doing it. There is no need that the UI shows > the license in the about dialog. As a first time contributor to bluez-gnome I'm confused. You request me to do all kind of changes, which I do. I can understand that because you don't want to spend your time fixing up patches of others. You agree with Bastien if it results in simplification its good. You ask me to fix the coding style. I do that and also don't use g_set_application_name because you don't like it. Then you don't apply it because you say you don't like ifdef and the license. If you don't count the license code my patch replaces 13 functions with just 1. Isn't that a simplification? I'm interested in helping out with bluez-gnome because I think it's a great app. However if the way this patch got treated is the normal way I'm not sure if I will have the motivation to submit other patches Anyway, licenses are shown in many GTK programs. To name a few GIMP, gedit, nautilus, eog, gnome-terminal, gnome-power-manager, all gnome-games, gcalculator But in case you don't want the license. I attached two versions of the patch. They both use g_set_application_name to remove the #if but one is with the license and the other isn't. In case you still don't want g_set_application you can alternatively bump the GTK+ requirement to 2.12 and use the "program-name" property > You can still fill in the code for the URL and email hooks to make the > actually work. I didn't bother so far, because the default screen thing > seem to be wrong. You should use the screen where the actual about > dialog is present. However I am not so deep into GDK to tell what is the > correct way here. > I'm no expert either on that. I copied the code from network manager. Leaving it as it is now in CVS (i.e. about dialog shows the links but they don't work) doesn't seem like a good idea to me because users are likely to run into this issue. I'd recommend one of the two following 1. Remove gtk_about_dialog_set_url_hook and gtk_about_dialog_set_email_hook 2. Use the code of the patch I sent you. It might be correct because it's in Network Manager Applet. Jaap [1] http://bugzilla.gnome.org/show_bug.cgi?id=345822 [2] http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-set-application-name [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: bluez-gnome-gtk-show-about-dialog-without-license.patch --] [-- Type: text/x-patch; name=bluez-gnome-gtk-show-about-dialog-without-license.patch, Size: 2405 bytes --] Index: applet/main.c =================================================================== RCS file: /cvsroot/bluez/gnome/applet/main.c,v retrieving revision 1.94 diff -u -r1.94 main.c --- applet/main.c 19 Dec 2007 01:06:05 -0000 1.94 +++ applet/main.c 20 Dec 2007 21:38:11 -0000 @@ -1524,48 +1524,23 @@ "Bastien Nocera <hadess@hadess.net>", NULL }; - GtkWidget *dialog; - - dialog = gtk_about_dialog_new(); - - gtk_window_set_icon_name(GTK_WINDOW(dialog), "stock_bluetooth"); - - gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), - _("Bluetooth Applet")); - - 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"); - - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), - _("A Bluetooth manager for the GNOME desktop")); - - gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(dialog), - "stock_bluetooth"); + const char *translators; + translators = _("translator-credits"); gtk_about_dialog_set_url_hook(about_url_hook, NULL, NULL); - gtk_about_dialog_set_email_hook(about_email_hook, NULL, NULL); - gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), - "http://www.bluez.org"); - - gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(dialog), - "www.bluez.org"); - - gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors); - - gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), - _("translator-credits")); - - g_signal_connect(dialog, "close", - G_CALLBACK(close_callback), NULL); - - g_signal_connect(dialog, "response", - G_CALLBACK(close_callback), NULL); - - gtk_widget_show_all(dialog); + 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", + NULL); } static void settings_callback(GObject *widget, gpointer user_data) @@ -1834,6 +1809,8 @@ if (instance == NULL) gtk_exit(0); + g_set_application_name (_("Bluetooth Applet")); + gtk_window_set_default_icon_name("stock_bluetooth"); #ifdef HAVE_LIBNOTIFY [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #3: bluez-gnome-gtk-show-about-dialog.patch --] [-- Type: text/x-patch; name=bluez-gnome-gtk-show-about-dialog.patch, Size: 3362 bytes --] Index: applet/main.c =================================================================== RCS file: /cvsroot/bluez/gnome/applet/main.c,v retrieving revision 1.94 diff -u -r1.94 main.c --- applet/main.c 19 Dec 2007 01:06:05 -0000 1.94 +++ applet/main.c 20 Dec 2007 21:34:20 -0000 @@ -1524,48 +1524,44 @@ "Bastien Nocera <hadess@hadess.net>", NULL }; - GtkWidget *dialog; - - dialog = gtk_about_dialog_new(); - - gtk_window_set_icon_name(GTK_WINDOW(dialog), "stock_bluetooth"); - - gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), - _("Bluetooth Applet")); - - 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"); - - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), - _("A Bluetooth manager for the GNOME desktop")); - - gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(dialog), - "stock_bluetooth"); + const char *translators; + translators = _("translator-credits"); + + 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_url_hook, NULL, NULL); - gtk_about_dialog_set_email_hook(about_email_hook, NULL, NULL); - gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), - "http://www.bluez.org"); - - gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(dialog), - "www.bluez.org"); - - gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors); - - gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), - _("translator-credits")); - - g_signal_connect(dialog, "close", - G_CALLBACK(close_callback), NULL); - - g_signal_connect(dialog, "response", - G_CALLBACK(close_callback), NULL); - - gtk_widget_show_all(dialog); + 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); + g_free(license_trans); } static void settings_callback(GObject *widget, gpointer user_data) @@ -1834,6 +1830,8 @@ if (instance == NULL) gtk_exit(0); + g_set_application_name (_("Bluetooth Applet")); + gtk_window_set_default_icon_name("stock_bluetooth"); #ifdef HAVE_LIBNOTIFY [-- Attachment #4: Type: text/plain, Size: 228 bytes --] ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ [-- Attachment #5: Type: text/plain, Size: 164 bytes --] _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bluez-devel] [PATCH] Beautify about dialog 2007-12-16 22:43 ` Jaap A. Haitsma 2007-12-16 23:24 ` Bastien Nocera @ 2007-12-17 0:58 ` Marcel Holtmann 1 sibling, 0 replies; 13+ messages in thread From: Marcel Holtmann @ 2007-12-17 0:58 UTC (permalink / raw) To: BlueZ development Hi Jaap, > > > * about dialog code is simpler > > > > you can't use gtk_dialog_run for the applet's about dialog. It will > > block and thus block all PIN requests. The current code is this way for > > a reason. > > Didn't know that. I now use g_object_set which also reduces the amount > of code considerably. I don't think that this makes it any easier to read. The trade a big block of function with a big big block of properties. Don't see the advantage in it. > > > * email address and URLs are clickable > > > > Send a separate patch for this. > > It's still in the same patch, because the patches change stuff in the > same function > > These two function calls in about_callback do the trick > > 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); Then send a patch for it and I can apply it in step. Sending me a big bunch in one go doesn't make me gonna review it and apply it. Simple patches go in quicker. > > > * Makes sure that every window gets a bluetooth window icon > > > > This should be already working. And if it is missing somewhere, I need a > > separate patch for it. > > The credits window didn't have it. > > The call: > gtk_window_set_default_icon_name ("stock_bluetooth"); > makes sure that any window at least gets an icon That is fair enough. Send a patch for it. > g_set_application_name (_("Bluetooth Applet")); > makes sure that the about dialog always says "Bluetooth Applet" no > matter which version of GTK you have installed. (In GTK 2.12 the name > attribute was changed) I am against this. I was _not_ using g_set_application_name on purpose, because I don't see its advantage. If the GTK changes its attributes, then this is a GTK bug. The GTK 2.x version should be ABI and API compatible. File a report against GTK 2.12 on this one. Regards Marcel ------------------------------------------------------------------------- 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 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-12-20 22:24 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-12-16 21:09 [Bluez-devel] [PATCH] Beautify about dialog Jaap A. Haitsma 2007-12-16 21:47 ` 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox