Back to index

unity-lens-music  6.0.0
Defines | Typedefs | Functions | Variables
musicstore-daemon.c File Reference
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <locale.h>

Go to the source code of this file.

Defines

#define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE   (unity_music_lens_simple_scope_get_type ())
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
#define UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY   (unity_music_lens_music_store_scope_proxy_get_type ())
#define UNITY_MUSIC_LENS_MUSIC_STORE_SCOPE_PROXY(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY, UnityMusicLensMusicStoreScopeProxy))
#define UNITY_MUSIC_LENS_MUSIC_STORE_SCOPE_PROXY_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY, UnityMusicLensMusicStoreScopeProxyClass))
#define UNITY_MUSIC_LENS_IS_MUSIC_STORE_SCOPE_PROXY(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY))
#define UNITY_MUSIC_LENS_IS_MUSIC_STORE_SCOPE_PROXY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY))
#define UNITY_MUSIC_LENS_MUSIC_STORE_SCOPE_PROXY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY, UnityMusicLensMusicStoreScopeProxyClass))
#define _g_variant_type_free0(var)   ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var)   ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_object_unref0(var)   ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var)   ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define CONFIG_PACKAGE   "unity-lens-music"
#define CONFIG_LOCALEDIR   "/usr/local/share/locale"

Typedefs

typedef struct _UnityMusicLensSimpleScope
typedef struct _UnityMusicLensSimpleScopeClass
typedef struct _UnityMusicLensMusicStoreScopeProxy
typedef struct _UnityMusicLensMusicStoreScopeProxyClass

Functions

GType unity_music_lens_simple_scope_get_type (void)
gint unity_music_lens_main (gchar **args, int args_length1)
int main (int argc, char **argv)

Variables

GApplication * unity_music_lens_app = NULL
UnityMusicLensMusicStoreScopeProxy * unity_music_lens_daemon = NULL

Define Documentation

#define _g_error_free0 (   var)    ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

Definition at line 54 of file musicstore-daemon.c.

#define _g_object_unref0 (   var)    ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

Definition at line 53 of file musicstore-daemon.c.

#define _g_variant_type_free0 (   var)    ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))

Definition at line 51 of file musicstore-daemon.c.

#define _g_variant_unref0 (   var)    ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

Definition at line 52 of file musicstore-daemon.c.

#define CONFIG_LOCALEDIR   "/usr/local/share/locale"
#define CONFIG_PACKAGE   "unity-lens-music"
#define UNITY_MUSIC_LENS_IS_MUSIC_STORE_SCOPE_PROXY (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY))

Definition at line 45 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_IS_MUSIC_STORE_SCOPE_PROXY_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY))

Definition at line 46 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))

Definition at line 35 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))

Definition at line 36 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_MUSIC_STORE_SCOPE_PROXY (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY, UnityMusicLensMusicStoreScopeProxy))

Definition at line 43 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_MUSIC_STORE_SCOPE_PROXY_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY, UnityMusicLensMusicStoreScopeProxyClass))

Definition at line 44 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_MUSIC_STORE_SCOPE_PROXY_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_STORE_SCOPE_PROXY, UnityMusicLensMusicStoreScopeProxyClass))

Definition at line 47 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_SIMPLE_SCOPE (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))

Definition at line 33 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))

Definition at line 34 of file musicstore-daemon.c.

#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))

Definition at line 37 of file musicstore-daemon.c.

Definition at line 42 of file musicstore-daemon.c.

Definition at line 32 of file musicstore-daemon.c.


Typedef Documentation

Definition at line 49 of file musicstore-daemon.c.

Definition at line 50 of file musicstore-daemon.c.

Definition at line 39 of file musicstore-daemon.c.

Definition at line 40 of file musicstore-daemon.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 216 of file musicstore-daemon.c.

                                  {
       g_type_init ();
       return unity_music_lens_main (argv, argc);
}

Here is the call graph for this function:

gint unity_music_lens_main ( gchar **  args,
int  args_length1 
)

Definition at line 144 of file musicstore-daemon.c.

                                                            {
       gint result = 0;
       gboolean _tmp0_ = FALSE;
       UnityMusicLensMusicStoreScopeProxy* _tmp1_;
       GApplication* _tmp2_;
       GApplication* _tmp6_;
       gboolean _tmp7_ = FALSE;
       GApplication* _tmp8_;
       GApplication* _tmp9_;
       gint _tmp10_ = 0;
       GError * _inner_error_ = NULL;
       textdomain (CONFIG_PACKAGE);
       bindtextdomain (CONFIG_PACKAGE, CONFIG_LOCALEDIR);
       bind_textdomain_codeset (CONFIG_PACKAGE, "UTF-8");
       setlocale (LC_ALL, "");
       _tmp0_ = unity_music_lens_dbus_name_has_owner ("com.canonical.Unity.Scope.MusicStore");
       if (_tmp0_) {
              g_print ("%s", "Another instance of the UbuntuOne Music Daemon " "already appears to be running.\nBailing out.\n");
              result = 2;
              return result;
       }
       _tmp1_ = unity_music_lens_music_store_scope_proxy_new ();
       _g_object_unref0 (unity_music_lens_daemon);
       unity_music_lens_daemon = _tmp1_;
       _tmp2_ = g_application_new ("com.canonical.Unity.Scope.MusicStore", G_APPLICATION_IS_SERVICE);
       _g_object_unref0 (unity_music_lens_app);
       unity_music_lens_app = _tmp2_;
       {
              GApplication* _tmp3_;
              _tmp3_ = unity_music_lens_app;
              g_application_register (_tmp3_, NULL, &_inner_error_);
              if (_inner_error_ != NULL) {
                     goto __catch2_g_error;
              }
       }
       goto __finally2;
       __catch2_g_error:
       {
              GError* e = NULL;
              GError* _tmp4_;
              const gchar* _tmp5_;
              e = _inner_error_;
              _inner_error_ = NULL;
              _tmp4_ = e;
              _tmp5_ = _tmp4_->message;
              g_print ("Failed to start music daemon: %s\n", _tmp5_);
              result = 1;
              _g_error_free0 (e);
              return result;
       }
       __finally2:
       if (_inner_error_ != NULL) {
              g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
              g_clear_error (&_inner_error_);
              return 0;
       }
       _tmp6_ = unity_music_lens_app;
       _tmp7_ = g_application_get_is_remote (_tmp6_);
       if (_tmp7_) {
              g_print ("%s", "Another instance of the Unity Music Daemon " "already appears to be running.\nBailing out.\n");
              result = 2;
              return result;
       }
       _tmp8_ = unity_music_lens_app;
       g_application_hold (_tmp8_);
       _tmp9_ = unity_music_lens_app;
       _tmp10_ = g_application_run (_tmp9_, 0, NULL);
       result = _tmp10_;
       return result;
}

Here is the call graph for this function:

Definition at line 62 of file musicstore-daemon.c.

                                                                  {
       gboolean result = FALSE;
       GError * _inner_error_ = NULL;
       g_return_val_if_fail (name != NULL, FALSE);
       {
              gboolean has_owner = FALSE;
              GDBusConnection* _tmp0_ = NULL;
              GDBusConnection* bus;
              GDBusConnection* _tmp1_;
              const gchar* _tmp2_;
              GVariant* _tmp3_;
              GVariant* _tmp4_;
              GVariantType* _tmp5_;
              GVariantType* _tmp6_;
              GVariant* _tmp7_ = NULL;
              GVariant* _tmp8_;
              GVariant* _result_;
              GVariant* _tmp9_;
              _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error_);
              bus = _tmp0_;
              if (_inner_error_ != NULL) {
                     goto __catch1_g_error;
              }
              _tmp1_ = bus;
              _tmp2_ = name;
              _tmp3_ = g_variant_new ("(s)", _tmp2_, NULL);
              _tmp4_ = g_variant_ref_sink (_tmp3_);
              _tmp5_ = g_variant_type_new ("(b)");
              _tmp6_ = _tmp5_;
              _tmp7_ = g_dbus_connection_call_sync (_tmp1_, "org.freedesktop.DBus", "/org/freedesktop/dbus", "org.freedesktop.DBus", "NameHasOwner", _tmp4_, _tmp6_, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, &_inner_error_);
              _tmp8_ = _tmp7_;
              _g_variant_type_free0 (_tmp6_);
              _g_variant_unref0 (_tmp4_);
              _result_ = _tmp8_;
              if (_inner_error_ != NULL) {
                     _g_object_unref0 (bus);
                     goto __catch1_g_error;
              }
              _tmp9_ = _result_;
              g_variant_get (_tmp9_, "(b)", &has_owner, NULL);
              result = has_owner;
              _g_variant_unref0 (_result_);
              _g_object_unref0 (bus);
              return result;
       }
       goto __finally1;
       __catch1_g_error:
       {
              GError* e = NULL;
              const gchar* _tmp10_;
              GError* _tmp11_;
              const gchar* _tmp12_;
              e = _inner_error_;
              _inner_error_ = NULL;
              _tmp10_ = name;
              _tmp11_ = e;
              _tmp12_ = _tmp11_->message;
              g_warning ("musicstore-daemon.vala:46: Unable to decide whether '%s' is running: %" \
"s", _tmp10_, _tmp12_);
              _g_error_free0 (e);
       }
       __finally1:
       if (_inner_error_ != NULL) {
              g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
              g_clear_error (&_inner_error_);
              return FALSE;
       }
       result = FALSE;
       return result;
}

Variable Documentation

GApplication* unity_music_lens_app = NULL

Definition at line 58 of file musicstore-daemon.c.

UnityMusicLensMusicStoreScopeProxy* unity_music_lens_daemon = NULL

Definition at line 60 of file musicstore-daemon.c.