[gnome-software] Add a way to set a debug level in the service from the helper
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a way to set a debug level in the service from the helper
- Date: Fri, 18 Oct 2013 08:41:17 +0000 (UTC)
commit 84c1c14c8d0ae44b9e0f254fbd09e40bd8017bed
Author: Richard Hughes <richard hughsie com>
Date: Fri Oct 18 09:40:39 2013 +0100
Add a way to set a debug level in the service from the helper
src/gs-application.c | 15 +++++++++++++++
src/gs-launcher.c | 23 ++++++++++++++++++-----
2 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index b8797f2..a7e4cad 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -252,6 +252,20 @@ search_activated (GSimpleAction *action,
}
static void
+set_debug_level_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer data)
+{
+ if (g_variant_get_int32 (parameter) > 0) {
+ g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
+ g_debug ("enabled debugging");
+ } else {
+ g_debug ("enabled disabled");
+ g_setenv ("G_MESSAGES_DEBUG", "", TRUE);
+ }
+}
+
+static void
details_activated (GSimpleAction *action,
GVariant *parameter,
gpointer data)
@@ -279,6 +293,7 @@ static GActionEntry actions[] = {
{ "profile", profile_activated, NULL, NULL, NULL },
{ "set-mode", set_mode_activated, "s", NULL, NULL },
{ "search", search_activated, "s", NULL, NULL },
+ { "set-debug-level", set_debug_level_activated, "i", NULL, NULL },
{ "details", details_activated, "(ss)", NULL, NULL }
};
diff --git a/src/gs-launcher.c b/src/gs-launcher.c
index cbfcf08..60b9acd 100644
--- a/src/gs-launcher.c
+++ b/src/gs-launcher.c
@@ -50,8 +50,10 @@ gs_launcher_local_command_line (GApplication *app, gchar ***args, gint *status)
gchar *mode = NULL;
gchar *search = NULL;
gchar *id = NULL;
+ gboolean activate_ui = TRUE;
gboolean version = FALSE;
gboolean profile = FALSE;
+ gint debug_level = -1;
gint argc;
const GOptionEntry options[] = {
{ "mode", '\0', 0, G_OPTION_ARG_STRING, &mode,
@@ -61,6 +63,8 @@ gs_launcher_local_command_line (GApplication *app, gchar ***args, gint *status)
_("Search for applications"), _("SEARCH") },
{ "details", '\0', 0, G_OPTION_ARG_STRING, &id,
_("Show application details"), _("ID") },
+ { "set-debug-level", '\0', 0, G_OPTION_ARG_INT, &debug_level,
+ _("Set the specified debugging level"), _("ID") },
{ "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 },
@@ -92,6 +96,19 @@ gs_launcher_local_command_line (GApplication *app, gchar ***args, gint *status)
goto out;
}
+ if (profile) {
+ activate_ui = FALSE;
+ g_action_group_activate_action (G_ACTION_GROUP (app),
+ "profile",
+ NULL);
+ }
+ if (debug_level >= 0) {
+ activate_ui = FALSE;
+ g_action_group_activate_action (G_ACTION_GROUP (app),
+ "set-debug-level",
+ g_variant_new_int32 (debug_level));
+ }
+
if (mode != NULL) {
g_action_group_activate_action (G_ACTION_GROUP (app),
"set-mode",
@@ -104,11 +121,7 @@ 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 {
+ } else if (activate_ui) {
g_application_activate (app);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]