[gnome-software] Add back the profiling functionality after the launcher split
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add back the profiling functionality after the launcher split
- Date: Fri, 18 Oct 2013 08:41:11 +0000 (UTC)
commit 8700d83f67beaa3e1b91c82b7770035eeac9ef73
Author: Richard Hughes <richard hughsie com>
Date: Fri Oct 18 09:18:35 2013 +0100
Add back the profiling functionality after the launcher split
src/gs-application.c | 17 +++++++++++++++--
src/gs-launcher.c | 34 ++++++++++++++++++++--------------
2 files changed, 35 insertions(+), 16 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index ebda4ba..b8797f2 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -33,10 +33,11 @@
#include "gs-shell.h"
#include "gs-update-monitor.h"
#include "gs-plugin-loader.h"
+#include "gs-profile.h"
struct _GsApplication {
- GtkApplication parent;
-
+ GtkApplication parent;
+ GsProfile *profile;
GCancellable *cancellable;
GtkApplication *application;
GtkCssProvider *provider;
@@ -55,6 +56,7 @@ G_DEFINE_TYPE (GsApplication, gs_application, GTK_TYPE_APPLICATION);
static void
gs_application_init (GsApplication *application)
{
+ application->profile = gs_profile_new ();
}
static void
@@ -174,6 +176,15 @@ about_activated (GSimpleAction *action,
}
static void
+profile_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer data)
+{
+ GsApplication *app = GS_APPLICATION (data);
+ gs_profile_dump (app->profile);
+}
+
+static void
quit_activated (GSimpleAction *action,
GVariant *parameter,
gpointer app)
@@ -265,6 +276,7 @@ details_activated (GSimpleAction *action,
static GActionEntry actions[] = {
{ "about", about_activated, NULL, NULL, NULL },
{ "quit", quit_activated, NULL, NULL, NULL },
+ { "profile", profile_activated, NULL, NULL, NULL },
{ "set-mode", set_mode_activated, "s", NULL, NULL },
{ "search", search_activated, "s", NULL, NULL },
{ "details", details_activated, "(ss)", NULL, NULL }
@@ -304,6 +316,7 @@ gs_application_finalize (GObject *object)
g_clear_object (&app->shell);
g_clear_object (&app->provider);
g_clear_object (&app->monitor);
+ g_clear_object (&app->profile);
G_OBJECT_CLASS (gs_application_parent_class)->finalize (object);
}
diff --git a/src/gs-launcher.c b/src/gs-launcher.c
index d873d53..cbfcf08 100644
--- a/src/gs-launcher.c
+++ b/src/gs-launcher.c
@@ -46,31 +46,33 @@ gs_launcher_init (GsLauncher *launcher)
static gboolean
gs_launcher_local_command_line (GApplication *app, gchar ***args, gint *status)
{
- GOptionContext *context;
- gchar *mode = NULL;
+ GOptionContext *context;
+ gchar *mode = NULL;
gchar *search = NULL;
gchar *id = NULL;
- gboolean version = FALSE;
+ gboolean version = FALSE;
+ gboolean profile = FALSE;
gint argc;
- const GOptionEntry options[] = {
- { "mode", '\0', 0, G_OPTION_ARG_STRING, &mode,
- /* TRANSLATORS: this is a command line option */
- _("Start up mode: either ‘updates’, ‘updated’, ‘installed’ or ‘overview’"), _("MODE") },
+ const GOptionEntry options[] = {
+ { "mode", '\0', 0, G_OPTION_ARG_STRING, &mode,
+ /* TRANSLATORS: this is a command line option */
+ _("Start up mode: either ‘updates’, ‘updated’, ‘installed’ or ‘overview’"), _("MODE") },
{ "search", '\0', 0, G_OPTION_ARG_STRING, &search,
_("Search for applications"), _("SEARCH") },
{ "details", '\0', 0, G_OPTION_ARG_STRING, &id,
_("Show application details"), _("ID") },
- { "version", 0, 0, G_OPTION_ARG_NONE, &version, NULL, NULL },
-
- { NULL}
- };
+ { "profile", 0, 0, G_OPTION_ARG_NONE, &profile,
+ _("Show profiling information for the service"), NULL },
+ { "version", 0, 0, G_OPTION_ARG_NONE, &version, NULL, NULL },
+ { NULL}
+ };
GError *error = NULL;
- context = g_option_context_new ("");
- g_option_context_add_main_entries (context, options, NULL);
+ context = g_option_context_new ("");
+ g_option_context_add_main_entries (context, options, NULL);
argc = g_strv_length (*args);
- if (!g_option_context_parse (context, &argc, args, &error)) {
+ if (!g_option_context_parse (context, &argc, args, &error)) {
g_printerr ("%s\n", error->message);
g_error_free (error);
*status = 1;
@@ -102,6 +104,10 @@ gs_launcher_local_command_line (GApplication *app, gchar ***args, gint *status)
g_action_group_activate_action (G_ACTION_GROUP (app),
"details",
g_variant_new ("(ss)", id, ""));
+ } else if (profile) {
+ g_action_group_activate_action (G_ACTION_GROUP (app),
+ "profile",
+ NULL);
} else {
g_application_activate (app);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]