* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Author: David Zeuthen <davidz@redhat.com>
*/
#include <gi18n.h>
+#ifdef G_OS_WIN32
+#include "glib/glib-private.h"
+#endif
+
/* ---------------------------------------------------------------------------------------------------- */
G_GNUC_UNUSED static void completion_debug (const gchar *format, ...);
}
g_variant_get (result, "(&s)", &xml_data);
- //g_printerr ("xml=`%s'", xml_data);
+ //g_printerr ("xml='%s'", xml_data);
error = NULL;
node = g_dbus_node_info_new_for_xml (xml_data, &error);
goto out;
}
- //g_printerr ("bar `%s'\n", path);
+ //g_printerr ("bar '%s'\n", path);
if (node->interfaces != NULL)
g_print ("%s \n", path);
{
gchar *s;
- //g_printerr ("foo `%s'\n", node->nodes[n].path);
+ //g_printerr ("foo '%s'\n", node->nodes[n].path);
if (g_strcmp0 (path, "/") == 0)
s = g_strdup_printf ("/%s", node->nodes[n]->path);
if (interface_info == NULL)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Warning: According to introspection data, interface `%s' does not exist\n"),
+ _("Warning: According to introspection data, interface '%s' does not exist\n"),
interface_name);
goto out;
}
if (method_info == NULL)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Warning: According to introspection data, method `%s' does not exist on interface `%s'\n"),
+ _("Warning: According to introspection data, method '%s' does not exist on interface '%s'\n"),
method_name,
interface_name);
goto out;
g_printerr (_("Error: signal not specified.\n"));
goto out;
}
+
s = strrchr (opt_emit_signal, '.');
+ if (s == NULL)
+ {
+ g_printerr (_("Error: signal must be the fully-qualified name.\n"));
+ goto out;
+ }
signal_name = g_strdup (s + 1);
interface_name = g_strndup (opt_emit_signal, s - opt_emit_signal);
&error);
if (value == NULL)
{
+ gchar *context;
+
+ context = g_variant_parse_error_print_context (error, (*argv)[n]);
g_error_free (error);
error = NULL;
value = _g_variant_parse_me_harder (NULL, (*argv)[n], &error);
if (value == NULL)
{
+ /* Use the original non-"parse-me-harder" error */
g_printerr (_("Error parsing parameter %d: %s\n"),
n,
- error->message);
+ context);
g_error_free (error);
+ g_free (context);
g_variant_builder_clear (&builder);
goto out;
}
+ g_free (context);
}
g_variant_builder_add_value (&builder, value);
}
s = strrchr (opt_call_method, '.');
if (!request_completion && s == NULL)
{
- g_printerr (_("Error: Method name `%s' is invalid\n"), opt_call_method);
+ g_printerr (_("Error: Method name '%s' is invalid\n"), opt_call_method);
goto out;
}
method_name = g_strdup (s + 1);
&error);
if (value == NULL)
{
+ gchar *context;
+
+ context = g_variant_parse_error_print_context (error, (*argv)[n]);
g_error_free (error);
error = NULL;
value = _g_variant_parse_me_harder (type, (*argv)[n], &error);
if (type != NULL)
{
s = g_variant_type_dup_string (type);
- g_printerr (_("Error parsing parameter %d of type `%s': %s\n"),
+ g_printerr (_("Error parsing parameter %d of type '%s': %s\n"),
n,
s,
- error->message);
+ context);
g_free (s);
}
else
{
g_printerr (_("Error parsing parameter %d: %s\n"),
n,
- error->message);
+ context);
}
g_error_free (error);
g_variant_builder_clear (&builder);
+ g_free (context);
goto out;
}
+ g_free (context);
}
g_variant_builder_add_value (&builder, value);
}
&error);
if (result == NULL)
{
- g_printerr (_("Error: %s\n"), error->message);
- g_error_free (error);
+ if (error)
+ {
+ g_printerr (_("Error: %s\n"), error->message);
+ g_error_free (error);
+ }
if (in_signature_types != NULL)
{
GString *s;
g_variant_type_peek_string (type),
g_variant_type_get_string_length (type));
}
- g_printerr ("(According to introspection data, you need to pass `%s')\n", s->str);
+ g_printerr ("(According to introspection data, you need to pass '%s')\n", s->str);
g_string_free (s, TRUE);
}
goto out;
gchar *s;
GError *error;
GDBusConnection *c;
- GVariant *result;
- GDBusNodeInfo *node;
gboolean complete_names;
gboolean complete_paths;
GMainLoop *loop;
ret = FALSE;
c = NULL;
- node = NULL;
- result = NULL;
modify_argv0_for_command (argc, argv, "monitor");
ret = TRUE;
out:
- if (node != NULL)
- g_dbus_node_info_unref (node);
- if (result != NULL)
- g_variant_unref (result);
if (c != NULL)
g_object_unref (c);
g_option_context_free (o);
gboolean request_completion;
gchar *completion_cur;
gchar *completion_prev;
+#ifdef G_OS_WIN32
+ gchar *tmp;
+#endif
setlocale (LC_ALL, "");
textdomain (GETTEXT_PACKAGE);
#ifdef G_OS_WIN32
- extern gchar *_glib_get_locale_dir (void);
- gchar *tmp = _glib_get_locale_dir ();
+ tmp = _glib_get_locale_dir ();
bindtextdomain (GETTEXT_PACKAGE, tmp);
g_free (tmp);
#else
completion_cur = NULL;
completion_prev = NULL;
- g_type_init ();
-
if (argc < 2)
{
usage (&argc, &argv, FALSE);
completion_debug ("completion_point=%d", completion_point);
completion_debug ("----");
completion_debug (" 0123456789012345678901234567890123456789012345678901234567890123456789");
- completion_debug ("`%s'", completion_line);
+ completion_debug ("'%s'", completion_line);
completion_debug (" %*s^",
completion_point, "");
completion_debug ("----");
}
}
#if 0
- completion_debug (" cur=`%s'", completion_cur);
- completion_debug ("prev=`%s'", completion_prev);
+ completion_debug (" cur='%s'", completion_cur);
+ completion_debug ("prev='%s'", completion_prev);
#endif
argc = completion_argc;
}
else
{
- g_printerr ("Unknown command `%s'\n", command);
+ g_printerr ("Unknown command '%s'\n", command);
usage (&argc, &argv, FALSE);
goto out;
}