[gnome-applets] modemlights: launch gnome-control-center for network configuration
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets] modemlights: launch gnome-control-center for network configuration
- Date: Sun, 21 Sep 2014 00:37:27 +0000 (UTC)
commit 40218bf96b08b33d24dac9bf687bd578930cf8f4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Jul 10 11:23:46 2014 +0300
modemlights: launch gnome-control-center for network configuration
modemlights/modem-applet.c | 42 ++++++++++++++++--------------------------
1 files changed, 16 insertions(+), 26 deletions(-)
---
diff --git a/modemlights/modem-applet.c b/modemlights/modem-applet.c
index df6068a..4ce7479 100644
--- a/modemlights/modem-applet.c
+++ b/modemlights/modem-applet.c
@@ -44,7 +44,6 @@
#include "modem-applet.h"
#define MODEM_APPLET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_MODEM_APPLET,
ModemAppletPrivate))
-#define NETWORK_TOOL "network-admin"
#define END_OF_REQUEST "<!-- GST: end of request -->\n"
#define BUF_SIZE 1024
@@ -859,44 +858,35 @@ launch_backend (ModemApplet *applet, gboolean root_auth)
}
}
-static void
-set_environment (gpointer display)
-{
- g_setenv ("DISPLA", display, TRUE);
-}
-
static gboolean
launch_config_tool (GdkScreen *screen, gboolean is_isdn)
{
- gchar *argv[4], *application, *display;
- gboolean ret;
+ GAppInfo *app_info;
GError *error;
- application = g_find_program_in_path (NETWORK_TOOL);
-
- if (!application)
- return FALSE;
+ error = NULL;
+ app_info = g_app_info_create_from_commandline ("gnome-control-center network",
+ NULL,
+ G_APP_INFO_CREATE_NONE,
+ &error);
- argv[0] = application;
- argv[1] = "--configure-type";
- argv[2] = (is_isdn) ? "isdn" : "modem";
- argv[3] = NULL;
+ if (error) {
+ g_warning ("Cannot launch application: %s", error->message);
- display = gdk_screen_make_display_name (screen);
- error = NULL;
+ g_error_free (error);
+ g_object_unref (app_info);
- ret = g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
- set_environment, &display, NULL, &error);
+ return FALSE;
+ }
- if (!ret) {
- g_warning ("launch_config_tool: %s", error->message);
+ if (!g_app_info_launch (app_info, NULL, NULL, &error)) {
+ g_warning ("Cannot launch application: %s", error->message);
g_error_free (error);
}
- g_free (display);
- g_free (application);
+ g_object_unref (app_info);
- return ret;
+ return TRUE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]