From: Andrea Zagli Date: Mon, 10 Dec 2012 08:35:46 +0000 (+0100) Subject: Sostituita g_app_info_launch_default_for_uri con ShellExecute in win32. X-Git-Tag: 0.5.0~3^2 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=cb83c63cc5dc105f5e995d56336140bf38a74165;p=solipa%2Flibsolipa Sostituita g_app_info_launch_default_for_uri con ShellExecute in win32. --- diff --git a/src/Makefile.am b/src/Makefile.am index 14023d4..d7efa0b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ guidir = $(datadir)/$(PACKAGE)/gui if PLATFORM_WIN32 -WIN32_LIBS=-lwsock32 +WIN32_LIBS=-lwsock32 -lshell32 else WIN32_LIBS= endif diff --git a/src/utils.c b/src/utils.c index 44ebb17..4917ece 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Andrea Zagli + * Copyright (C) 2010-2012 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,12 @@ #include #include +#ifdef G_OS_WIN32 + #include + #include + #include +#endif + #include "solipa.h" #include "utils.h" @@ -1880,6 +1886,24 @@ solipa_gstring_initial_capital (GString *gstring) void solipa_apri_collegamento (GtkWindow *transient, const gchar *indirizzo) { +#ifdef G_OS_WIN32 + + /* da rimuovere quando gnome-vfs-extra (o gvfs) sarà compilabile in win */ + guint err; + + err = ShellExecute (NULL, "open", indirizzo, NULL, NULL, SW_SHOW); + if (err < 33) + { + solipa_message_dialog (GTK_WIDGET (transient), + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + g_strdup_printf ("Impossibile aprire il collegamento selezionato (%s): %d.", + indirizzo, + err)); + } + +#else + GAppInfo *gappinfo; GError *error; @@ -1893,6 +1917,8 @@ solipa_apri_collegamento (GtkWindow *transient, const gchar *indirizzo) indirizzo, error != NULL && error->message != NULL ? error->message : "nessun dettaglio")); } + +#endif } /** diff --git a/src/utils.h b/src/utils.h index b3b7f81..d6b6817 100644 --- a/src/utils.h +++ b/src/utils.h @@ -103,6 +103,8 @@ GdkPixbuf *solipa_file_get_icon_as_pixbuf (const gchar *filename, GtkWidget *wid void solipa_gstring_initial_capital (GString *gstring); +void solipa_apri_collegamento (GtkWindow *transient, const gchar *indirizzo); + gchar *g_mkdtemp (gchar *tmpl);