From: Christian Dywan Date: Sun, 18 Mar 2012 13:14:09 +0000 (+0100) Subject: Show app instance name in about:version X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5aa526d106ea1f163887663f682552a091e7e67e;p=midori Show app instance name in about:version --- diff --git a/midori/midori-app.c b/midori/midori-app.c index 46400944..84d50258 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -68,9 +68,6 @@ struct _MidoriApp { GObject parent_instance; - MidoriBrowser* browser; - - gchar* name; MidoriWebSettings* settings; KatzeArray* bookmarks; KatzeArray* trash; @@ -80,6 +77,7 @@ struct _MidoriApp KatzeArray* extensions; KatzeArray* browsers; + MidoriBrowser* browser; MidoriAppInstance instance; #if !HAVE_HILDON || !HAVE_LIBNOTIFY @@ -87,6 +85,8 @@ struct _MidoriApp #endif }; +static gchar* app_name = NULL; + struct _MidoriAppClass { GObjectClass parent_class; @@ -718,29 +718,30 @@ midori_app_create_instance (MidoriApp* app) GIOChannel* channel; #endif - if (!app->name) + if (!(display = gdk_display_get_default ())) + return MidoriAppInstanceNull; + { #if HAVE_UNIQUE const gchar* config = sokoke_set_config_dir (NULL); gchar* name_hash; name_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, config, -1); - app->name = g_strconcat ("midori", "_", name_hash, NULL); + katze_assign (app_name, g_strconcat ("midori", "_", name_hash, NULL)); g_free (name_hash); g_object_notify (G_OBJECT (app), "name"); #else - app->name = g_strdup (PACKAGE_NAME); + katze_assign (app_name, g_strdup (PACKAGE_NAME)); #endif } - if (!(display = gdk_display_get_default ())) - return MidoriAppInstanceNull; - display_name = g_strdup (gdk_display_get_name (display)); n = strlen (display_name); for (i = 0; i < n; i++) if (strchr (":.\\/", display_name[i])) display_name[i] = '_'; - instance_name = g_strdup_printf ("de.twotoasts.%s_%s", app->name, display_name); + instance_name = g_strdup_printf ("de.twotoasts.%s_%s", app_name, display_name); + g_free (display_name); + katze_assign (app_name, instance_name); #if HAVE_UNIQUE instance = unique_app_new (instance_name, NULL); @@ -758,14 +759,16 @@ midori_app_create_instance (MidoriApp* app) (GIOFunc)midori_app_io_channel_watch_cb, app); } #endif - - g_free (instance_name); - g_free (display_name); - #endif return instance; } +const gchar* +midori_app_get_name (MidoriApp* app) +{ + return app_name; +} + static void midori_app_init (MidoriApp* app) { @@ -793,7 +796,7 @@ midori_app_finalize (GObject* object) { MidoriApp* app = MIDORI_APP (object); - katze_assign (app->name, NULL); + katze_assign (app_name, NULL); katze_object_assign (app->settings, NULL); katze_object_assign (app->bookmarks, NULL); katze_object_assign (app->trash, NULL); @@ -833,7 +836,7 @@ midori_app_set_property (GObject* object, switch (prop_id) { case PROP_NAME: - katze_assign (app->name, g_value_dup_string (value)); + katze_assign (app_name, g_value_dup_string (value)); break; case PROP_SETTINGS: katze_object_assign (app->settings, g_value_dup_object (value)); @@ -873,7 +876,7 @@ midori_app_get_property (GObject* object, switch (prop_id) { case PROP_NAME: - g_value_set_string (value, app->name); + g_value_set_string (value, app_name); break; case PROP_SETTINGS: g_value_set_object (value, app->settings); diff --git a/midori/midori-app.h b/midori/midori-app.h index 934ce0ce..c918a19e 100644 --- a/midori/midori-app.h +++ b/midori/midori-app.h @@ -41,6 +41,9 @@ midori_app_get_type (void) G_GNUC_CONST; MidoriApp* midori_app_new (void); +const gchar* +midori_app_get_name (MidoriApp* app); + gboolean midori_app_instance_is_running (MidoriApp* app); diff --git a/midori/midori-view.c b/midori/midori-view.c index 63b8f93d..70729677 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -13,6 +13,7 @@ #include "midori-view.h" #include "midori-browser.h" #include "midori-searchaction.h" +#include "midori-app.h" #include "midori-platform.h" #include "midori-core.h" #include "midori-findbar.h" @@ -4142,7 +4143,7 @@ midori_view_set_uri (MidoriView* view, "style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">" "" "" - "" + "" "" "" "" @@ -4159,7 +4160,7 @@ midori_view_set_uri (MidoriView* view, "", _("Version numbers in brackets show the version used at runtime."), command_line, - PACKAGE_VERSION, + PACKAGE_VERSION, midori_app_get_name (NULL), WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION, webkit_major_version (), webkit_minor_version (),
Command line%s
Midori%s
Midori%s (%s)
WebKitGTK+%d.%d.%d (%d.%d.%d)
GTK+%d.%d.%d (%d.%d.%d)
Glib%d.%d.%d (%d.%d.%d)