Re: [Bluez-devel] [PATCH] Beautify about dialog

Jaap A. Haitsma
2007-12-17T07:15:26Z

[-- 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 --]