Logo Search packages:      
Sourcecode: unity version File versions  Download package

application-controller.c

/* application-controller.c generated by valac, the Vala compiler
 * generated from application-controller.vala, do not modify */

/*
 *      application-controller.vala
 *      Copyright (C) 2010 Canonical Ltd
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 3 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 *
 *
 *      Authored by Gordon Allott <gord.allott@canonical.com>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
#include <libbamf/libbamf.h>
#include <glib/gi18n-lib.h>
#include <unity.h>
#include <gee.h>
#include <float.h>
#include <math.h>
#include <clutk/clutk.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixdata.h>


#define UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM (unity_launcher_shortcut_item_get_type ())
#define UNITY_LAUNCHER_SHORTCUT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, UnityLauncherShortcutItem))
#define UNITY_LAUNCHER_IS_SHORTCUT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM))
#define UNITY_LAUNCHER_SHORTCUT_ITEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, UnityLauncherShortcutItemIface))

typedef struct _UnityLauncherShortcutItem UnityLauncherShortcutItem;
typedef struct _UnityLauncherShortcutItemIface UnityLauncherShortcutItemIface;

#define UNITY_LAUNCHER_TYPE_APPLICATION_SHORTCUT (unity_launcher_application_shortcut_get_type ())
#define UNITY_LAUNCHER_APPLICATION_SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_APPLICATION_SHORTCUT, UnityLauncherApplicationShortcut))
#define UNITY_LAUNCHER_APPLICATION_SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_APPLICATION_SHORTCUT, UnityLauncherApplicationShortcutClass))
#define UNITY_LAUNCHER_IS_APPLICATION_SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_APPLICATION_SHORTCUT))
#define UNITY_LAUNCHER_IS_APPLICATION_SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_APPLICATION_SHORTCUT))
#define UNITY_LAUNCHER_APPLICATION_SHORTCUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_APPLICATION_SHORTCUT, UnityLauncherApplicationShortcutClass))

typedef struct _UnityLauncherApplicationShortcut UnityLauncherApplicationShortcut;
typedef struct _UnityLauncherApplicationShortcutClass UnityLauncherApplicationShortcutClass;
typedef struct _UnityLauncherApplicationShortcutPrivate UnityLauncherApplicationShortcutPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (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 UNITY_LAUNCHER_TYPE_LIB_LAUNCHER_SHORTCUT (unity_launcher_lib_launcher_shortcut_get_type ())
#define UNITY_LAUNCHER_LIB_LAUNCHER_SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_LIB_LAUNCHER_SHORTCUT, UnityLauncherLibLauncherShortcut))
#define UNITY_LAUNCHER_LIB_LAUNCHER_SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_LIB_LAUNCHER_SHORTCUT, UnityLauncherLibLauncherShortcutClass))
#define UNITY_LAUNCHER_IS_LIB_LAUNCHER_SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_LIB_LAUNCHER_SHORTCUT))
#define UNITY_LAUNCHER_IS_LIB_LAUNCHER_SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_LIB_LAUNCHER_SHORTCUT))
#define UNITY_LAUNCHER_LIB_LAUNCHER_SHORTCUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_LIB_LAUNCHER_SHORTCUT, UnityLauncherLibLauncherShortcutClass))

typedef struct _UnityLauncherLibLauncherShortcut UnityLauncherLibLauncherShortcut;
typedef struct _UnityLauncherLibLauncherShortcutClass UnityLauncherLibLauncherShortcutClass;
typedef struct _UnityLauncherLibLauncherShortcutPrivate UnityLauncherLibLauncherShortcutPrivate;
#define _g_array_free0(var) ((var == NULL) ? NULL : (var = (g_array_free (var, TRUE), NULL)))

#define UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT (unity_launcher_launcher_pinning_shortcut_get_type ())
#define UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT, UnityLauncherLauncherPinningShortcut))
#define UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT, UnityLauncherLauncherPinningShortcutClass))
#define UNITY_LAUNCHER_IS_LAUNCHER_PINNING_SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT))
#define UNITY_LAUNCHER_IS_LAUNCHER_PINNING_SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT))
#define UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT, UnityLauncherLauncherPinningShortcutClass))

typedef struct _UnityLauncherLauncherPinningShortcut UnityLauncherLauncherPinningShortcut;
typedef struct _UnityLauncherLauncherPinningShortcutClass UnityLauncherLauncherPinningShortcutClass;
typedef struct _UnityLauncherLauncherPinningShortcutPrivate UnityLauncherLauncherPinningShortcutPrivate;

#define UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER (unity_launcher_scroller_child_controller_get_type ())
#define UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER, UnityLauncherScrollerChildController))
#define UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER, UnityLauncherScrollerChildControllerClass))
#define UNITY_LAUNCHER_IS_SCROLLER_CHILD_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER))
#define UNITY_LAUNCHER_IS_SCROLLER_CHILD_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER))
#define UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER, UnityLauncherScrollerChildControllerClass))

typedef struct _UnityLauncherScrollerChildController UnityLauncherScrollerChildController;
typedef struct _UnityLauncherScrollerChildControllerClass UnityLauncherScrollerChildControllerClass;
typedef struct _UnityLauncherScrollerChildControllerPrivate UnityLauncherScrollerChildControllerPrivate;

#define UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER_MENU_STATE (unity_launcher_scroller_child_controller_menu_state_get_type ())

#define UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER (unity_launcher_application_controller_get_type ())
#define UNITY_LAUNCHER_APPLICATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER, UnityLauncherApplicationController))
#define UNITY_LAUNCHER_APPLICATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER, UnityLauncherApplicationControllerClass))
#define UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER))
#define UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER))
#define UNITY_LAUNCHER_APPLICATION_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER, UnityLauncherApplicationControllerClass))

typedef struct _UnityLauncherApplicationController UnityLauncherApplicationController;
typedef struct _UnityLauncherApplicationControllerClass UnityLauncherApplicationControllerClass;
typedef struct _UnityLauncherApplicationControllerPrivate UnityLauncherApplicationControllerPrivate;

#define UNITY_LAUNCHER_TYPE_SCROLLER_CHILD (unity_launcher_scroller_child_get_type ())
#define UNITY_LAUNCHER_SCROLLER_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, UnityLauncherScrollerChild))
#define UNITY_LAUNCHER_SCROLLER_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, UnityLauncherScrollerChildClass))
#define UNITY_LAUNCHER_IS_SCROLLER_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD))
#define UNITY_LAUNCHER_IS_SCROLLER_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD))
#define UNITY_LAUNCHER_SCROLLER_CHILD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, UnityLauncherScrollerChildClass))

typedef struct _UnityLauncherScrollerChild UnityLauncherScrollerChild;
typedef struct _UnityLauncherScrollerChildClass UnityLauncherScrollerChildClass;

#define UNITY_LAUNCHER_TYPE_PIN_TYPE (unity_launcher_pin_type_get_type ())
typedef struct _UnityLauncherScrollerChildPrivate UnityLauncherScrollerChildPrivate;

#define UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER (unity_launcher_quicklist_controller_get_type ())
#define UNITY_LAUNCHER_QUICKLIST_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER, UnityLauncherQuicklistController))
#define UNITY_LAUNCHER_QUICKLIST_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER, UnityLauncherQuicklistControllerClass))
#define UNITY_LAUNCHER_IS_QUICKLIST_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER))
#define UNITY_LAUNCHER_IS_QUICKLIST_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER))
#define UNITY_LAUNCHER_QUICKLIST_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER, UnityLauncherQuicklistControllerClass))

typedef struct _UnityLauncherQuicklistController UnityLauncherQuicklistController;
typedef struct _UnityLauncherQuicklistControllerClass UnityLauncherQuicklistControllerClass;
typedef struct _Block1Data Block1Data;

struct _UnityLauncherShortcutItemIface {
      GTypeInterface parent_iface;
      char* (*get_name) (UnityLauncherShortcutItem* self);
      void (*activated) (UnityLauncherShortcutItem* self);
};

struct _UnityLauncherApplicationShortcut {
      GObject parent_instance;
      UnityLauncherApplicationShortcutPrivate * priv;
      char* exec;
      char* name;
      char* desktop_location;
};

struct _UnityLauncherApplicationShortcutClass {
      GObjectClass parent_class;
};

struct _UnityLauncherLibLauncherShortcut {
      GObject parent_instance;
      UnityLauncherLibLauncherShortcutPrivate * priv;
      BamfApplication* app;
      char* name;
};

struct _UnityLauncherLibLauncherShortcutClass {
      GObjectClass parent_class;
};

struct _UnityLauncherLauncherPinningShortcut {
      GObject parent_instance;
      UnityLauncherLauncherPinningShortcutPrivate * priv;
};

struct _UnityLauncherLauncherPinningShortcutClass {
      GObjectClass parent_class;
};

struct _UnityLauncherLauncherPinningShortcutPrivate {
      char* _desktop_file;
      char* cached_uid;
};

typedef enum  {
      UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_NO_MENU,
      UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_LABEL,
      UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_MENU,
      UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_MENU_CLOSE_WHEN_LEAVE
} UnityLauncherScrollerChildControllerMenuState;

struct _UnityLauncherScrollerChildController {
      GObject parent_instance;
      UnityLauncherScrollerChildControllerPrivate * priv;
      char* name;
      UnityLauncherScrollerChildControllerMenuState menu_state;
      guint32 last_press_time;
      gboolean button_down;
      float click_start_pos;
      gint drag_sensitivity;
};

struct _UnityLauncherScrollerChildControllerClass {
      GObjectClass parent_class;
      GeeArrayList* (*get_menu_shortcuts) (UnityLauncherScrollerChildController* self);
      GeeArrayList* (*get_menu_shortcut_actions) (UnityLauncherScrollerChildController* self);
      void (*activate) (UnityLauncherScrollerChildController* self);
};

struct _UnityLauncherApplicationController {
      UnityLauncherScrollerChildController parent_instance;
      UnityLauncherApplicationControllerPrivate * priv;
};

struct _UnityLauncherApplicationControllerClass {
      UnityLauncherScrollerChildControllerClass parent_class;
};

struct _UnityLauncherApplicationControllerPrivate {
      char* _desktop_file;
      GKeyFile* desktop_keyfile;
      char* icon_name;
      UnityThemeFilePath* theme_file_path;
      BamfApplication* app;
      gboolean is_favorite;
};

typedef enum  {
      UNITY_LAUNCHER_PIN_TYPE_UNPINNED,
      UNITY_LAUNCHER_PIN_TYPE_PINNED,
      UNITY_LAUNCHER_PIN_TYPE_ALWAYS,
      UNITY_LAUNCHER_PIN_TYPE_NEVER
} UnityLauncherPinType;

struct _UnityLauncherScrollerChild {
      CtkActor parent_instance;
      UnityLauncherScrollerChildPrivate * priv;
      UnityLauncherPinType pin_type;
};

struct _UnityLauncherScrollerChildClass {
      CtkActorClass parent_class;
      void (*force_rotation_jump) (UnityLauncherScrollerChild* self, float degrees);
};

struct _Block1Data {
      int _ref_count_;
      UnityLauncherApplicationController * self;
      UnityLauncherQuicklistController* controller;
};


static gpointer unity_launcher_application_shortcut_parent_class = NULL;
static UnityLauncherShortcutItemIface* unity_launcher_application_shortcut_unity_launcher_shortcut_item_parent_iface = NULL;
static gpointer unity_launcher_lib_launcher_shortcut_parent_class = NULL;
static UnityLauncherShortcutItemIface* unity_launcher_lib_launcher_shortcut_unity_launcher_shortcut_item_parent_iface = NULL;
static gpointer unity_launcher_launcher_pinning_shortcut_parent_class = NULL;
static UnityLauncherShortcutItemIface* unity_launcher_launcher_pinning_shortcut_unity_launcher_shortcut_item_parent_iface = NULL;
static gpointer unity_launcher_application_controller_parent_class = NULL;

GType unity_launcher_shortcut_item_get_type (void);
GType unity_launcher_application_shortcut_get_type (void);
enum  {
      UNITY_LAUNCHER_APPLICATION_SHORTCUT_DUMMY_PROPERTY
};
static char* unity_launcher_application_shortcut_real_get_name (UnityLauncherShortcutItem* base);
static void unity_launcher_application_shortcut_real_activated (UnityLauncherShortcutItem* base);
UnityLauncherApplicationShortcut* unity_launcher_application_shortcut_new (void);
UnityLauncherApplicationShortcut* unity_launcher_application_shortcut_construct (GType object_type);
static void unity_launcher_application_shortcut_finalize (GObject* obj);
GType unity_launcher_lib_launcher_shortcut_get_type (void);
enum  {
      UNITY_LAUNCHER_LIB_LAUNCHER_SHORTCUT_DUMMY_PROPERTY
};
static char* unity_launcher_lib_launcher_shortcut_real_get_name (UnityLauncherShortcutItem* base);
static void unity_launcher_lib_launcher_shortcut_real_activated (UnityLauncherShortcutItem* base);
UnityLauncherLibLauncherShortcut* unity_launcher_lib_launcher_shortcut_new (void);
UnityLauncherLibLauncherShortcut* unity_launcher_lib_launcher_shortcut_construct (GType object_type);
static void unity_launcher_lib_launcher_shortcut_finalize (GObject* obj);
GType unity_launcher_launcher_pinning_shortcut_get_type (void);
#define UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT, UnityLauncherLauncherPinningShortcutPrivate))
enum  {
      UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_DUMMY_PROPERTY,
      UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_DESKTOP_FILE,
      UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_NAME
};
const char* unity_launcher_launcher_pinning_shortcut_get_desktop_file (UnityLauncherLauncherPinningShortcut* self);
static gboolean unity_launcher_launcher_pinning_shortcut_is_sticky (UnityLauncherLauncherPinningShortcut* self);
UnityLauncherLauncherPinningShortcut* unity_launcher_launcher_pinning_shortcut_new (const char* _desktop_file);
UnityLauncherLauncherPinningShortcut* unity_launcher_launcher_pinning_shortcut_construct (GType object_type, const char* _desktop_file);
const char* unity_launcher_launcher_pinning_shortcut_get_name (UnityLauncherLauncherPinningShortcut* self);
static char* unity_launcher_launcher_pinning_shortcut_real_get_name (UnityLauncherShortcutItem* base);
static void unity_launcher_launcher_pinning_shortcut_real_activated (UnityLauncherShortcutItem* base);
static void unity_launcher_launcher_pinning_shortcut_set_desktop_file (UnityLauncherLauncherPinningShortcut* self, const char* value);
static GObject * unity_launcher_launcher_pinning_shortcut_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void unity_launcher_launcher_pinning_shortcut_finalize (GObject* obj);
static void unity_launcher_launcher_pinning_shortcut_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void unity_launcher_launcher_pinning_shortcut_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GType unity_launcher_scroller_child_controller_get_type (void);
GType unity_launcher_scroller_child_controller_menu_state_get_type (void);
GType unity_launcher_application_controller_get_type (void);
#define UNITY_LAUNCHER_APPLICATION_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER, UnityLauncherApplicationControllerPrivate))
enum  {
      UNITY_LAUNCHER_APPLICATION_CONTROLLER_DUMMY_PROPERTY,
      UNITY_LAUNCHER_APPLICATION_CONTROLLER_DESKTOP_FILE
};
GType unity_launcher_scroller_child_get_type (void);
UnityLauncherApplicationController* unity_launcher_application_controller_new (const char* desktop_file_, UnityLauncherScrollerChild* child_);
UnityLauncherApplicationController* unity_launcher_application_controller_construct (GType object_type, const char* desktop_file_, UnityLauncherScrollerChild* child_);
const char* unity_launcher_application_controller_get_desktop_file (UnityLauncherApplicationController* self);
GType unity_launcher_pin_type_get_type (void);
UnityLauncherScrollerChild* unity_launcher_scroller_child_controller_get_child (UnityLauncherScrollerChildController* self);
static void unity_launcher_application_controller_on_favorite_added (UnityLauncherApplicationController* self, const char* uid);
static void unity_launcher_application_controller_on_favorite_removed (UnityLauncherApplicationController* self, const char* uid);
static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcuts (UnityLauncherScrollerChildController* base);
static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcut_actions (UnityLauncherScrollerChildController* base);
void unity_launcher_scroller_child_set_activating (UnityLauncherScrollerChild* self, gboolean value);
static gboolean unity_launcher_application_controller_on_launch_timeout (UnityLauncherApplicationController* self);
static gboolean _unity_launcher_application_controller_on_launch_timeout_gsource_func (gpointer self);
static void unity_launcher_application_controller_real_activate (UnityLauncherScrollerChildController* base);
void unity_launcher_scroller_child_set_running (UnityLauncherScrollerChild* self, gboolean value);
void unity_launcher_scroller_child_set_active (UnityLauncherScrollerChild* self, gboolean value);
static void unity_launcher_application_controller_on_app_running_changed (UnityLauncherApplicationController* self, gboolean running);
static void _unity_launcher_application_controller_on_app_running_changed_bamf_view_running_changed (BamfView* _sender, gboolean object, gpointer self);
static void unity_launcher_application_controller_on_app_active_changed (UnityLauncherApplicationController* self, gboolean active);
static void _unity_launcher_application_controller_on_app_active_changed_bamf_view_active_changed (BamfView* _sender, gboolean object, gpointer self);
void unity_launcher_application_controller_detach_application (UnityLauncherApplicationController* self);
static void _unity_launcher_application_controller_detach_application_bamf_view_closed (BamfView* _sender, gpointer self);
static void unity_launcher_application_controller_on_app_urgant_changed (UnityLauncherApplicationController* self, gboolean urgancy);
static void _unity_launcher_application_controller_on_app_urgant_changed_bamf_view_urgent_changed (BamfView* _sender, gboolean object, gpointer self);
static void unity_launcher_application_controller_load_icon_from_icon_name (UnityLauncherApplicationController* self);
void unity_launcher_application_controller_attach_application (UnityLauncherApplicationController* self, BamfApplication* application);
void unity_launcher_scroller_child_set_needs_attention (UnityLauncherScrollerChild* self, gboolean value);
gboolean unity_launcher_application_controller_debug_is_application_attached (UnityLauncherApplicationController* self);
static void unity_launcher_application_controller_load_desktop_file_info (UnityLauncherApplicationController* self);
static gboolean unity_launcher_application_controller_try_load_from_file (UnityLauncherApplicationController* self, const char* filepath);
void unity_launcher_scroller_child_set_icon (UnityLauncherScrollerChild* self, GdkPixbuf* value);
static void _lambda11_ (UnityThemeFilePath* theme, const char* filepath, UnityLauncherApplicationController* self);
static void __lambda11__unity_theme_file_path_found_icon_path (UnityThemeFilePath* _sender, const char* filepath, gpointer self);
static void _lambda12_ (UnityLauncherApplicationController* self);
static void __lambda12__unity_theme_file_path_failed (UnityThemeFilePath* _sender, gpointer self);
static void unity_launcher_application_controller_set_desktop_file (UnityLauncherApplicationController* self, const char* value);
static void _unity_launcher_application_controller_on_favorite_added_unity_favorites_favorite_added (UnityFavorites* _sender, const char* uid, gpointer self);
static void _unity_launcher_application_controller_on_favorite_removed_unity_favorites_favorite_removed (UnityFavorites* _sender, const char* uid, gpointer self);
GType unity_launcher_quicklist_controller_get_type (void);
UnityLauncherQuicklistController* unity_launcher_quicklist_controller_get_default (void);
CtkActor* unity_launcher_quicklist_controller_get_attached_actor (UnityLauncherQuicklistController* self);
static void _lambda13_ (gboolean open, Block1Data* _data1_);
static void __lambda13__unity_launcher_quicklist_controller_menu_state_changed (UnityLauncherQuicklistController* _sender, gboolean open, gpointer self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
static GObject * unity_launcher_application_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void unity_launcher_application_controller_finalize (GObject* obj);
static void unity_launcher_application_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void unity_launcher_application_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static int _vala_strcmp0 (const char * str1, const char * str2);



static char* unity_launcher_application_shortcut_real_get_name (UnityLauncherShortcutItem* base) {
      UnityLauncherApplicationShortcut * self;
      char* result = NULL;
      self = (UnityLauncherApplicationShortcut*) base;
      result = g_strdup (self->name);
      return result;
}


static void unity_launcher_application_shortcut_real_activated (UnityLauncherShortcutItem* base) {
      UnityLauncherApplicationShortcut * self;
      GError * _inner_error_;
      GdkAppLaunchContext* context;
      self = (UnityLauncherApplicationShortcut*) base;
      _inner_error_ = NULL;
      context = gdk_app_launch_context_new ();
      {
            GKeyFile* desktop_file;
            GAppInfo* appinfo;
            desktop_file = g_key_file_new ();
            g_key_file_load_from_file (desktop_file, self->desktop_location, 0, &_inner_error_);
            if (_inner_error_ != NULL) {
                  _g_key_file_free0 (desktop_file);
                  goto __catch11_g_error;
            }
            g_key_file_set_string (desktop_file, "Desktop Entry", "Exec", self->exec);
            appinfo = (GAppInfo*) g_desktop_app_info_new_from_keyfile (desktop_file);
            g_app_info_create_from_commandline (self->exec, self->name, 0, &_inner_error_);
            if (_inner_error_ != NULL) {
                  _g_key_file_free0 (desktop_file);
                  _g_object_unref0 (appinfo);
                  goto __catch11_g_error;
            }
            gdk_app_launch_context_set_screen (context, gdk_display_get_default_screen (gdk_display_get_default ()));
            gdk_app_launch_context_set_timestamp (context, (guint32) GDK_CURRENT_TIME);
            g_app_info_launch (appinfo, NULL, (GAppLaunchContext*) context, &_inner_error_);
            if (_inner_error_ != NULL) {
                  _g_key_file_free0 (desktop_file);
                  _g_object_unref0 (appinfo);
                  goto __catch11_g_error;
            }
            _g_key_file_free0 (desktop_file);
            _g_object_unref0 (appinfo);
      }
      goto __finally11;
      __catch11_g_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("application-controller.vala:55: %s", e->message);
                  _g_error_free0 (e);
            }
      }
      __finally11:
      if (_inner_error_ != NULL) {
            _g_object_unref0 (context);
            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;
      }
      _g_object_unref0 (context);
}


UnityLauncherApplicationShortcut* unity_launcher_application_shortcut_construct (GType object_type) {
      UnityLauncherApplicationShortcut * self;
      self = (UnityLauncherApplicationShortcut*) g_object_new (object_type, NULL);
      return self;
}


UnityLauncherApplicationShortcut* unity_launcher_application_shortcut_new (void) {
      return unity_launcher_application_shortcut_construct (UNITY_LAUNCHER_TYPE_APPLICATION_SHORTCUT);
}


static void unity_launcher_application_shortcut_class_init (UnityLauncherApplicationShortcutClass * klass) {
      unity_launcher_application_shortcut_parent_class = g_type_class_peek_parent (klass);
      G_OBJECT_CLASS (klass)->finalize = unity_launcher_application_shortcut_finalize;
}


static void unity_launcher_application_shortcut_unity_launcher_shortcut_item_interface_init (UnityLauncherShortcutItemIface * iface) {
      unity_launcher_application_shortcut_unity_launcher_shortcut_item_parent_iface = g_type_interface_peek_parent (iface);
      iface->get_name = unity_launcher_application_shortcut_real_get_name;
      iface->activated = unity_launcher_application_shortcut_real_activated;
}


static void unity_launcher_application_shortcut_instance_init (UnityLauncherApplicationShortcut * self) {
}


static void unity_launcher_application_shortcut_finalize (GObject* obj) {
      UnityLauncherApplicationShortcut * self;
      self = UNITY_LAUNCHER_APPLICATION_SHORTCUT (obj);
      _g_free0 (self->exec);
      _g_free0 (self->name);
      _g_free0 (self->desktop_location);
      G_OBJECT_CLASS (unity_launcher_application_shortcut_parent_class)->finalize (obj);
}


GType unity_launcher_application_shortcut_get_type (void) {
      static volatile gsize unity_launcher_application_shortcut_type_id__volatile = 0;
      if (g_once_init_enter (&unity_launcher_application_shortcut_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (UnityLauncherApplicationShortcutClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_launcher_application_shortcut_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityLauncherApplicationShortcut), 0, (GInstanceInitFunc) unity_launcher_application_shortcut_instance_init, NULL };
            static const GInterfaceInfo unity_launcher_shortcut_item_info = { (GInterfaceInitFunc) unity_launcher_application_shortcut_unity_launcher_shortcut_item_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
            GType unity_launcher_application_shortcut_type_id;
            unity_launcher_application_shortcut_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityLauncherApplicationShortcut", &g_define_type_info, 0);
            g_type_add_interface_static (unity_launcher_application_shortcut_type_id, UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, &unity_launcher_shortcut_item_info);
            g_once_init_leave (&unity_launcher_application_shortcut_type_id__volatile, unity_launcher_application_shortcut_type_id);
      }
      return unity_launcher_application_shortcut_type_id__volatile;
}


static char* unity_launcher_lib_launcher_shortcut_real_get_name (UnityLauncherShortcutItem* base) {
      UnityLauncherLibLauncherShortcut * self;
      char* result = NULL;
      self = (UnityLauncherLibLauncherShortcut*) base;
      result = g_strdup (_ ("Quit"));
      return result;
}


static void unity_launcher_lib_launcher_shortcut_real_activated (UnityLauncherShortcutItem* base) {
      UnityLauncherLibLauncherShortcut * self;
      GArray* xids;
      self = (UnityLauncherLibLauncherShortcut*) base;
      xids = bamf_application_get_xids (self->app);
      unity_shell_close_xids (unity_global_shell, xids);
      _g_array_free0 (xids);
}


UnityLauncherLibLauncherShortcut* unity_launcher_lib_launcher_shortcut_construct (GType object_type) {
      UnityLauncherLibLauncherShortcut * self;
      self = (UnityLauncherLibLauncherShortcut*) g_object_new (object_type, NULL);
      return self;
}


UnityLauncherLibLauncherShortcut* unity_launcher_lib_launcher_shortcut_new (void) {
      return unity_launcher_lib_launcher_shortcut_construct (UNITY_LAUNCHER_TYPE_LIB_LAUNCHER_SHORTCUT);
}


static void unity_launcher_lib_launcher_shortcut_class_init (UnityLauncherLibLauncherShortcutClass * klass) {
      unity_launcher_lib_launcher_shortcut_parent_class = g_type_class_peek_parent (klass);
      G_OBJECT_CLASS (klass)->finalize = unity_launcher_lib_launcher_shortcut_finalize;
}


static void unity_launcher_lib_launcher_shortcut_unity_launcher_shortcut_item_interface_init (UnityLauncherShortcutItemIface * iface) {
      unity_launcher_lib_launcher_shortcut_unity_launcher_shortcut_item_parent_iface = g_type_interface_peek_parent (iface);
      iface->get_name = unity_launcher_lib_launcher_shortcut_real_get_name;
      iface->activated = unity_launcher_lib_launcher_shortcut_real_activated;
}


static void unity_launcher_lib_launcher_shortcut_instance_init (UnityLauncherLibLauncherShortcut * self) {
}


static void unity_launcher_lib_launcher_shortcut_finalize (GObject* obj) {
      UnityLauncherLibLauncherShortcut * self;
      self = UNITY_LAUNCHER_LIB_LAUNCHER_SHORTCUT (obj);
      _g_object_unref0 (self->app);
      _g_free0 (self->name);
      G_OBJECT_CLASS (unity_launcher_lib_launcher_shortcut_parent_class)->finalize (obj);
}


GType unity_launcher_lib_launcher_shortcut_get_type (void) {
      static volatile gsize unity_launcher_lib_launcher_shortcut_type_id__volatile = 0;
      if (g_once_init_enter (&unity_launcher_lib_launcher_shortcut_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (UnityLauncherLibLauncherShortcutClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_launcher_lib_launcher_shortcut_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityLauncherLibLauncherShortcut), 0, (GInstanceInitFunc) unity_launcher_lib_launcher_shortcut_instance_init, NULL };
            static const GInterfaceInfo unity_launcher_shortcut_item_info = { (GInterfaceInitFunc) unity_launcher_lib_launcher_shortcut_unity_launcher_shortcut_item_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
            GType unity_launcher_lib_launcher_shortcut_type_id;
            unity_launcher_lib_launcher_shortcut_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityLauncherLibLauncherShortcut", &g_define_type_info, 0);
            g_type_add_interface_static (unity_launcher_lib_launcher_shortcut_type_id, UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, &unity_launcher_shortcut_item_info);
            g_once_init_leave (&unity_launcher_lib_launcher_shortcut_type_id__volatile, unity_launcher_lib_launcher_shortcut_type_id);
      }
      return unity_launcher_lib_launcher_shortcut_type_id__volatile;
}


static gboolean unity_launcher_launcher_pinning_shortcut_is_sticky (UnityLauncherLauncherPinningShortcut* self) {
      gboolean result = FALSE;
      UnityFavorites* favorites;
      g_return_val_if_fail (self != NULL, FALSE);
      favorites = unity_favorites_get_default ();
      {
            GeeArrayList* _tmp0_;
            GeeIterator* _tmp1_;
            GeeIterator* _uid_it;
            _uid_it = (_tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) (_tmp0_ = unity_favorites_get_favorites (favorites))), _g_object_unref0 (_tmp0_), _tmp1_);
            while (TRUE) {
                  char* uid;
                  char* _tmp2_;
                  gboolean _tmp3_;
                  if (!gee_iterator_next (_uid_it)) {
                        break;
                  }
                  uid = (char*) gee_iterator_get (_uid_it);
                  if ((_tmp3_ = _vala_strcmp0 (_tmp2_ = unity_favorites_get_string (favorites, uid, "desktop_file"), self->priv->_desktop_file) == 0, _g_free0 (_tmp2_), _tmp3_)) {
                        char* _tmp4_;
                        self->priv->cached_uid = (_tmp4_ = g_strdup (uid), _g_free0 (self->priv->cached_uid), _tmp4_);
                        result = TRUE;
                        _g_free0 (uid);
                        _g_object_unref0 (_uid_it);
                        _g_object_unref0 (favorites);
                        return result;
                  }
                  _g_free0 (uid);
            }
            _g_object_unref0 (_uid_it);
      }
      result = FALSE;
      _g_object_unref0 (favorites);
      return result;
}


UnityLauncherLauncherPinningShortcut* unity_launcher_launcher_pinning_shortcut_construct (GType object_type, const char* _desktop_file) {
      UnityLauncherLauncherPinningShortcut * self;
      g_return_val_if_fail (_desktop_file != NULL, NULL);
      self = (UnityLauncherLauncherPinningShortcut*) g_object_new (object_type, "desktop-file", _desktop_file, NULL);
      return self;
}


UnityLauncherLauncherPinningShortcut* unity_launcher_launcher_pinning_shortcut_new (const char* _desktop_file) {
      return unity_launcher_launcher_pinning_shortcut_construct (UNITY_LAUNCHER_TYPE_LAUNCHER_PINNING_SHORTCUT, _desktop_file);
}


static char* unity_launcher_launcher_pinning_shortcut_real_get_name (UnityLauncherShortcutItem* base) {
      UnityLauncherLauncherPinningShortcut * self;
      char* result = NULL;
      self = (UnityLauncherLauncherPinningShortcut*) base;
      result = g_strdup (unity_launcher_launcher_pinning_shortcut_get_name (self));
      return result;
}


static void unity_launcher_launcher_pinning_shortcut_real_activated (UnityLauncherShortcutItem* base) {
      UnityLauncherLauncherPinningShortcut * self;
      UnityFavorites* favorites;
      self = (UnityLauncherLauncherPinningShortcut*) base;
      favorites = unity_favorites_get_default ();
      if (!unity_launcher_launcher_pinning_shortcut_is_sticky (self)) {
            if (self->priv->cached_uid == NULL) {
                  char* _tmp1_;
                  char* _tmp0_;
                  self->priv->cached_uid = (_tmp1_ = g_strconcat ("app-", _tmp0_ = g_path_get_basename (self->priv->_desktop_file), NULL), _g_free0 (self->priv->cached_uid), _tmp1_);
                  _g_free0 (_tmp0_);
            }
            unity_favorites_set_string (favorites, self->priv->cached_uid, "type", "application");
            unity_favorites_set_string (favorites, self->priv->cached_uid, "desktop_file", self->priv->_desktop_file);
            unity_favorites_add_favorite (favorites, self->priv->cached_uid);
      } else {
            unity_favorites_remove_favorite (favorites, self->priv->cached_uid);
      }
      _g_object_unref0 (favorites);
}


const char* unity_launcher_launcher_pinning_shortcut_get_desktop_file (UnityLauncherLauncherPinningShortcut* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_desktop_file;
      return result;
}


static void unity_launcher_launcher_pinning_shortcut_set_desktop_file (UnityLauncherLauncherPinningShortcut* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_desktop_file = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_desktop_file), _tmp0_);
      g_object_notify ((GObject *) self, "desktop-file");
}


const char* unity_launcher_launcher_pinning_shortcut_get_name (UnityLauncherLauncherPinningShortcut* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      if (unity_launcher_launcher_pinning_shortcut_is_sticky (self)) {
            result = _ ("Remove from Launcher");
            return result;
      } else {
            result = _ ("Keep In Launcher");
            return result;
      }
}


static GObject * unity_launcher_launcher_pinning_shortcut_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
      GObject * obj;
      GObjectClass * parent_class;
      UnityLauncherLauncherPinningShortcut * self;
      parent_class = G_OBJECT_CLASS (unity_launcher_launcher_pinning_shortcut_parent_class);
      obj = parent_class->constructor (type, n_construct_properties, construct_properties);
      self = UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT (obj);
      {
      }
      return obj;
}


static void unity_launcher_launcher_pinning_shortcut_class_init (UnityLauncherLauncherPinningShortcutClass * klass) {
      unity_launcher_launcher_pinning_shortcut_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (UnityLauncherLauncherPinningShortcutPrivate));
      G_OBJECT_CLASS (klass)->get_property = unity_launcher_launcher_pinning_shortcut_get_property;
      G_OBJECT_CLASS (klass)->set_property = unity_launcher_launcher_pinning_shortcut_set_property;
      G_OBJECT_CLASS (klass)->constructor = unity_launcher_launcher_pinning_shortcut_constructor;
      G_OBJECT_CLASS (klass)->finalize = unity_launcher_launcher_pinning_shortcut_finalize;
      g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_DESKTOP_FILE, g_param_spec_string ("desktop-file", "desktop-file", "desktop-file", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
      g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void unity_launcher_launcher_pinning_shortcut_unity_launcher_shortcut_item_interface_init (UnityLauncherShortcutItemIface * iface) {
      unity_launcher_launcher_pinning_shortcut_unity_launcher_shortcut_item_parent_iface = g_type_interface_peek_parent (iface);
      iface->get_name = unity_launcher_launcher_pinning_shortcut_real_get_name;
      iface->activated = unity_launcher_launcher_pinning_shortcut_real_activated;
}


static void unity_launcher_launcher_pinning_shortcut_instance_init (UnityLauncherLauncherPinningShortcut * self) {
      self->priv = UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_GET_PRIVATE (self);
      self->priv->cached_uid = NULL;
}


static void unity_launcher_launcher_pinning_shortcut_finalize (GObject* obj) {
      UnityLauncherLauncherPinningShortcut * self;
      self = UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT (obj);
      _g_free0 (self->priv->_desktop_file);
      _g_free0 (self->priv->cached_uid);
      G_OBJECT_CLASS (unity_launcher_launcher_pinning_shortcut_parent_class)->finalize (obj);
}


GType unity_launcher_launcher_pinning_shortcut_get_type (void) {
      static volatile gsize unity_launcher_launcher_pinning_shortcut_type_id__volatile = 0;
      if (g_once_init_enter (&unity_launcher_launcher_pinning_shortcut_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (UnityLauncherLauncherPinningShortcutClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_launcher_launcher_pinning_shortcut_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityLauncherLauncherPinningShortcut), 0, (GInstanceInitFunc) unity_launcher_launcher_pinning_shortcut_instance_init, NULL };
            static const GInterfaceInfo unity_launcher_shortcut_item_info = { (GInterfaceInitFunc) unity_launcher_launcher_pinning_shortcut_unity_launcher_shortcut_item_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
            GType unity_launcher_launcher_pinning_shortcut_type_id;
            unity_launcher_launcher_pinning_shortcut_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityLauncherLauncherPinningShortcut", &g_define_type_info, 0);
            g_type_add_interface_static (unity_launcher_launcher_pinning_shortcut_type_id, UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, &unity_launcher_shortcut_item_info);
            g_once_init_leave (&unity_launcher_launcher_pinning_shortcut_type_id__volatile, unity_launcher_launcher_pinning_shortcut_type_id);
      }
      return unity_launcher_launcher_pinning_shortcut_type_id__volatile;
}


static void unity_launcher_launcher_pinning_shortcut_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
      UnityLauncherLauncherPinningShortcut * self;
      self = UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT (object);
      switch (property_id) {
            case UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_DESKTOP_FILE:
            g_value_set_string (value, unity_launcher_launcher_pinning_shortcut_get_desktop_file (self));
            break;
            case UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_NAME:
            g_value_set_string (value, unity_launcher_launcher_pinning_shortcut_get_name (self));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void unity_launcher_launcher_pinning_shortcut_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
      UnityLauncherLauncherPinningShortcut * self;
      self = UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT (object);
      switch (property_id) {
            case UNITY_LAUNCHER_LAUNCHER_PINNING_SHORTCUT_DESKTOP_FILE:
            unity_launcher_launcher_pinning_shortcut_set_desktop_file (self, g_value_get_string (value));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


UnityLauncherApplicationController* unity_launcher_application_controller_construct (GType object_type, const char* desktop_file_, UnityLauncherScrollerChild* child_) {
      UnityLauncherApplicationController * self;
      g_return_val_if_fail (desktop_file_ != NULL, NULL);
      g_return_val_if_fail (child_ != NULL, NULL);
      self = (UnityLauncherApplicationController*) g_object_new (object_type, "desktop-file", desktop_file_, "child", child_, NULL);
      return self;
}


UnityLauncherApplicationController* unity_launcher_application_controller_new (const char* desktop_file_, UnityLauncherScrollerChild* child_) {
      return unity_launcher_application_controller_construct (UNITY_LAUNCHER_TYPE_APPLICATION_CONTROLLER, desktop_file_, child_);
}


static void unity_launcher_application_controller_on_favorite_added (UnityLauncherApplicationController* self, const char* uid) {
      UnityFavorites* favorites;
      char* desktop_filename;
      g_return_if_fail (self != NULL);
      g_return_if_fail (uid != NULL);
      favorites = unity_favorites_get_default ();
      desktop_filename = unity_favorites_get_string (favorites, uid, "desktop_file");
      if (_vala_strcmp0 (desktop_filename, unity_launcher_application_controller_get_desktop_file (self)) == 0) {
            self->priv->is_favorite = TRUE;
            unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_PINNED;
      }
      _g_object_unref0 (favorites);
      _g_free0 (desktop_filename);
}


static gboolean string_contains (const char* self, const char* needle) {
      gboolean result = FALSE;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (needle != NULL, FALSE);
      result = strstr (self, needle) != NULL;
      return result;
}


static void unity_launcher_application_controller_on_favorite_removed (UnityLauncherApplicationController* self, const char* uid) {
      UnityFavorites* favorites;
      char* desktop_filename;
      g_return_if_fail (self != NULL);
      g_return_if_fail (uid != NULL);
      favorites = unity_favorites_get_default ();
      desktop_filename = unity_favorites_get_string (favorites, uid, "desktop_file");
      if (_vala_strcmp0 (desktop_filename, unity_launcher_application_controller_get_desktop_file (self)) == 0) {
            self->priv->is_favorite = FALSE;
            unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_UNPINNED;
            g_signal_emit_by_name ((UnityLauncherScrollerChildController*) self, "closed");
            if (string_contains (desktop_filename, ".local")) {
                  +g_remove (desktop_filename);
            }
      }
      _g_object_unref0 (favorites);
      _g_free0 (desktop_filename);
}


static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcuts (UnityLauncherScrollerChildController* base) {
      UnityLauncherApplicationController * self;
      GeeArrayList* result = NULL;
      GError * _inner_error_;
      GeeArrayList* ret_list;
      GKeyFile* desktop_keyfile;
      char** _tmp1_;
      gint _groups_size_;
      gint groups_length1;
      gsize _tmp0_;
      char** groups;
      self = (UnityLauncherApplicationController*) base;
      _inner_error_ = NULL;
      ret_list = gee_array_list_new (UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
      if (unity_launcher_application_controller_get_desktop_file (self) == NULL) {
            result = ret_list;
            return result;
      }
      desktop_keyfile = g_key_file_new ();
      {
            g_key_file_load_from_file (desktop_keyfile, unity_launcher_application_controller_get_desktop_file (self), 0, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch12_g_error;
            }
      }
      goto __finally12;
      __catch12_g_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("application-controller.vala:263: Unable to load desktop file '%s': %s", unity_launcher_application_controller_get_desktop_file (self), e->message);
                  result = ret_list;
                  _g_error_free0 (e);
                  _g_key_file_free0 (desktop_keyfile);
                  return result;
            }
      }
      __finally12:
      if (_inner_error_ != NULL) {
            _g_object_unref0 (ret_list);
            _g_key_file_free0 (desktop_keyfile);
            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 NULL;
      }
      groups = (_tmp1_ = g_key_file_get_groups (desktop_keyfile, &_tmp0_), groups_length1 = _tmp0_, _groups_size_ = groups_length1, _tmp1_);
      {
            gint a;
            a = 0;
            {
                  gboolean _tmp2_;
                  _tmp2_ = TRUE;
                  while (TRUE) {
                        if (!_tmp2_) {
                              a++;
                        }
                        _tmp2_ = FALSE;
                        if (!(a < groups_length1)) {
                              break;
                        }
                        if (string_contains (groups[a], "QuickList Entry")) {
                              char* exec;
                              char* name;
                              UnityLauncherApplicationShortcut* shortcut;
                              char* _tmp7_;
                              char* _tmp8_;
                              char* _tmp9_;
                              exec = g_strdup ("");
                              name = g_strdup ("");
                              {
                                    char* _tmp3_;
                                    char* _tmp4_;
                                    char* _tmp5_;
                                    char* _tmp6_;
                                    _tmp3_ = g_key_file_get_value (desktop_keyfile, groups[a], "Exec", &_inner_error_);
                                    if (_inner_error_ != NULL) {
                                          goto __catch13_g_error;
                                    }
                                    exec = (_tmp4_ = _tmp3_, _g_free0 (exec), _tmp4_);
                                    _tmp5_ = g_key_file_get_locale_string (desktop_keyfile, groups[a], "Name", "", &_inner_error_);
                                    if (_inner_error_ != NULL) {
                                          goto __catch13_g_error;
                                    }
                                    name = (_tmp6_ = _tmp5_, _g_free0 (name), _tmp6_);
                              }
                              goto __finally13;
                              __catch13_g_error:
                              {
                                    GError * e;
                                    e = _inner_error_;
                                    _inner_error_ = NULL;
                                    {
                                          g_warning ("application-controller.vala:282: %s", e->message);
                                          _g_error_free0 (e);
                                          _g_free0 (exec);
                                          _g_free0 (name);
                                          continue;
                                    }
                              }
                              __finally13:
                              if (_inner_error_ != NULL) {
                                    _g_free0 (exec);
                                    _g_free0 (name);
                                    _g_object_unref0 (ret_list);
                                    _g_key_file_free0 (desktop_keyfile);
                                    groups = (_vala_array_free (groups, groups_length1, (GDestroyNotify) g_free), 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 NULL;
                              }
                              shortcut = unity_launcher_application_shortcut_new ();
                              shortcut->exec = (_tmp7_ = g_strdup (exec), _g_free0 (shortcut->exec), _tmp7_);
                              shortcut->name = (_tmp8_ = g_strdup (name), _g_free0 (shortcut->name), _tmp8_);
                              shortcut->desktop_location = (_tmp9_ = g_strdup (unity_launcher_application_controller_get_desktop_file (self)), _g_free0 (shortcut->desktop_location), _tmp9_);
                              gee_abstract_collection_add ((GeeAbstractCollection*) ret_list, (UnityLauncherShortcutItem*) shortcut);
                              _g_free0 (exec);
                              _g_free0 (name);
                              _g_object_unref0 (shortcut);
                        }
                  }
            }
      }
      result = ret_list;
      _g_key_file_free0 (desktop_keyfile);
      groups = (_vala_array_free (groups, groups_length1, (GDestroyNotify) g_free), NULL);
      return result;
}


static gpointer _g_object_ref0 (gpointer self) {
      return self ? g_object_ref (self) : NULL;
}


static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcut_actions (UnityLauncherScrollerChildController* base) {
      UnityLauncherApplicationController * self;
      GeeArrayList* result = NULL;
      GeeArrayList* ret_list;
      self = (UnityLauncherApplicationController*) base;
      ret_list = gee_array_list_new (UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
      if (unity_launcher_application_controller_get_desktop_file (self) != NULL) {
            UnityLauncherLauncherPinningShortcut* pin_entry;
            pin_entry = unity_launcher_launcher_pinning_shortcut_new (unity_launcher_application_controller_get_desktop_file (self));
            gee_abstract_collection_add ((GeeAbstractCollection*) ret_list, (UnityLauncherShortcutItem*) pin_entry);
            _g_object_unref0 (pin_entry);
      }
      if (BAMF_IS_APPLICATION (self->priv->app)) {
            if (bamf_view_is_running ((BamfView*) self->priv->app)) {
                  UnityLauncherLibLauncherShortcut* open_entry;
                  BamfApplication* _tmp0_;
                  open_entry = unity_launcher_lib_launcher_shortcut_new ();
                  open_entry->app = (_tmp0_ = _g_object_ref0 (self->priv->app), _g_object_unref0 (open_entry->app), _tmp0_);
                  gee_abstract_collection_add ((GeeAbstractCollection*) ret_list, (UnityLauncherShortcutItem*) open_entry);
                  _g_object_unref0 (open_entry);
            }
      }
      result = ret_list;
      return result;
}


static gboolean _unity_launcher_application_controller_on_launch_timeout_gsource_func (gpointer self) {
      gboolean result;
      result = unity_launcher_application_controller_on_launch_timeout (self);
      return result;
}


static void unity_launcher_application_controller_real_activate (UnityLauncherScrollerChildController* base) {
      UnityLauncherApplicationController * self;
      GError * _inner_error_;
      self = (UnityLauncherApplicationController*) base;
      _inner_error_ = NULL;
      if (BAMF_IS_APPLICATION (self->priv->app)) {
            if (bamf_view_is_running ((BamfView*) self->priv->app)) {
                  GArray* xids;
                  xids = bamf_application_get_xids (self->priv->app);
                  {
                        gint i;
                        i = 0;
                        {
                              gboolean _tmp0_;
                              _tmp0_ = TRUE;
                              while (TRUE) {
                                    guint32 xid;
                                    if (!_tmp0_) {
                                          i++;
                                    }
                                    _tmp0_ = FALSE;
                                    if (!(i < xids->len)) {
                                          break;
                                    }
                                    xid = g_array_index (xids, guint32, (guint) i);
                                    unity_shell_show_window (unity_global_shell, xid);
                              }
                        }
                  }
                  _g_array_free0 (xids);
            }
      } else {
            GdkAppLaunchContext* context;
            context = gdk_app_launch_context_new ();
            {
                  GKeyFile* desktop_keyfile;
                  GAppInfo* appinfo;
                  desktop_keyfile = g_key_file_new ();
                  g_key_file_load_from_file (desktop_keyfile, unity_launcher_application_controller_get_desktop_file (self), 0, &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (desktop_keyfile);
                        goto __catch14_g_error;
                  }
                  appinfo = (GAppInfo*) g_desktop_app_info_new_from_keyfile (desktop_keyfile);
                  gdk_app_launch_context_set_screen (context, gdk_display_get_default_screen (gdk_display_get_default ()));
                  gdk_app_launch_context_set_timestamp (context, (guint32) GDK_CURRENT_TIME);
                  g_app_info_launch (appinfo, NULL, (GAppLaunchContext*) context, &_inner_error_);
                  if (_inner_error_ != NULL) {
                        _g_key_file_free0 (desktop_keyfile);
                        _g_object_unref0 (appinfo);
                        goto __catch14_g_error;
                  }
                  unity_launcher_scroller_child_set_activating (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), TRUE);
                  g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 8, _unity_launcher_application_controller_on_launch_timeout_gsource_func, g_object_ref (self), g_object_unref);
                  _g_key_file_free0 (desktop_keyfile);
                  _g_object_unref0 (appinfo);
            }
            goto __finally14;
            __catch14_g_error:
            {
                  GError * e;
                  e = _inner_error_;
                  _inner_error_ = NULL;
                  {
                        g_warning ("application-controller.vala:348: %s", e->message);
                        _g_error_free0 (e);
                  }
            }
            __finally14:
            if (_inner_error_ != NULL) {
                  _g_object_unref0 (context);
                  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;
            }
            _g_object_unref0 (context);
      }
}


static gboolean unity_launcher_application_controller_on_launch_timeout (UnityLauncherApplicationController* self) {
      gboolean result = FALSE;
      g_return_val_if_fail (self != NULL, FALSE);
      unity_launcher_scroller_child_set_activating (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), FALSE);
      result = FALSE;
      return result;
}


static void _unity_launcher_application_controller_on_app_running_changed_bamf_view_running_changed (BamfView* _sender, gboolean object, gpointer self) {
      unity_launcher_application_controller_on_app_running_changed (self, object);
}


static void _unity_launcher_application_controller_on_app_active_changed_bamf_view_active_changed (BamfView* _sender, gboolean object, gpointer self) {
      unity_launcher_application_controller_on_app_active_changed (self, object);
}


static void _unity_launcher_application_controller_detach_application_bamf_view_closed (BamfView* _sender, gpointer self) {
      unity_launcher_application_controller_detach_application (self);
}


static void _unity_launcher_application_controller_on_app_urgant_changed_bamf_view_urgent_changed (BamfView* _sender, gboolean object, gpointer self) {
      unity_launcher_application_controller_on_app_urgant_changed (self, object);
}


static const char* string_to_string (const char* self) {
      const char* result = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      result = self;
      return result;
}


void unity_launcher_application_controller_attach_application (UnityLauncherApplicationController* self, BamfApplication* application) {
      BamfApplication* _tmp0_;
      char* _tmp1_;
      char* potential_icon_name;
      g_return_if_fail (self != NULL);
      g_return_if_fail (application != NULL);
      self->priv->app = (_tmp0_ = _g_object_ref0 (application), _g_object_unref0 (self->priv->app), _tmp0_);
      unity_launcher_scroller_child_set_running (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), bamf_view_is_running ((BamfView*) self->priv->app));
      unity_launcher_scroller_child_set_active (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), bamf_view_is_active ((BamfView*) self->priv->app));
      unity_launcher_scroller_child_set_activating (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), FALSE);
      g_signal_connect_object ((BamfView*) self->priv->app, "running-changed", (GCallback) _unity_launcher_application_controller_on_app_running_changed_bamf_view_running_changed, self, 0);
      g_signal_connect_object ((BamfView*) self->priv->app, "active-changed", (GCallback) _unity_launcher_application_controller_on_app_active_changed_bamf_view_active_changed, self, 0);
      g_signal_connect_object ((BamfView*) self->priv->app, "closed", (GCallback) _unity_launcher_application_controller_detach_application_bamf_view_closed, self, 0);
      g_signal_connect_object ((BamfView*) self->priv->app, "urgent-changed", (GCallback) _unity_launcher_application_controller_on_app_urgant_changed_bamf_view_urgent_changed, self, 0);
      ((UnityLauncherScrollerChildController*) self)->name = (_tmp1_ = bamf_view_get_name ((BamfView*) self->priv->app), _g_free0 (((UnityLauncherScrollerChildController*) self)->name), _tmp1_);
      if (_vala_strcmp0 (((UnityLauncherScrollerChildController*) self)->name, "") == 0) {
            char* _tmp2_;
            g_warning ("application-controller.vala:371: %s", _tmp2_ = g_strconcat ("Bamf returned null for app.get_name (): ", string_to_string (unity_launcher_application_controller_get_desktop_file (self)), NULL));
            _g_free0 (_tmp2_);
      }
      potential_icon_name = bamf_view_get_icon ((BamfView*) self->priv->app);
      if (_vala_strcmp0 (potential_icon_name, "") == 0) {
            char* _tmp3_;
            g_warning ("application-controller.vala:375: %s", _tmp3_ = g_strconcat ("Bamf returned null for app.get_icon (): ", string_to_string (unity_launcher_application_controller_get_desktop_file (self)), NULL));
            _g_free0 (_tmp3_);
      } else {
            _vala_strcmp0 (self->priv->icon_name, potential_icon_name) == 0;
      }
      unity_launcher_application_controller_load_icon_from_icon_name (self);
      _g_free0 (potential_icon_name);
}


void unity_launcher_application_controller_detach_application (UnityLauncherApplicationController* self) {
      guint _tmp0_;
      guint _tmp1_;
      guint _tmp2_;
      guint _tmp3_;
      BamfApplication* _tmp4_;
      g_return_if_fail (self != NULL);
      g_signal_parse_name ("running-changed", BAMF_TYPE_VIEW, &_tmp0_, NULL, FALSE);
      g_signal_handlers_disconnect_matched ((BamfView*) self->priv->app, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _unity_launcher_application_controller_on_app_running_changed_bamf_view_running_changed, self);
      g_signal_parse_name ("active-changed", BAMF_TYPE_VIEW, &_tmp1_, NULL, FALSE);
      g_signal_handlers_disconnect_matched ((BamfView*) self->priv->app, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _unity_launcher_application_controller_on_app_active_changed_bamf_view_active_changed, self);
      g_signal_parse_name ("urgent-changed", BAMF_TYPE_VIEW, &_tmp2_, NULL, FALSE);
      g_signal_handlers_disconnect_matched ((BamfView*) self->priv->app, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _unity_launcher_application_controller_on_app_urgant_changed_bamf_view_urgent_changed, self);
      g_signal_parse_name ("closed", BAMF_TYPE_VIEW, &_tmp3_, NULL, FALSE);
      g_signal_handlers_disconnect_matched ((BamfView*) self->priv->app, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _unity_launcher_application_controller_detach_application_bamf_view_closed, self);
      self->priv->app = (_tmp4_ = NULL, _g_object_unref0 (self->priv->app), _tmp4_);
      unity_launcher_scroller_child_set_running (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), FALSE);
      unity_launcher_scroller_child_set_active (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), FALSE);
      unity_launcher_scroller_child_set_needs_attention (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), FALSE);
      g_signal_emit_by_name ((UnityLauncherScrollerChildController*) self, "closed");
}


gboolean unity_launcher_application_controller_debug_is_application_attached (UnityLauncherApplicationController* self) {
      gboolean result = FALSE;
      g_return_val_if_fail (self != NULL, FALSE);
      result = self->priv->app != NULL;
      return result;
}


static void unity_launcher_application_controller_on_app_running_changed (UnityLauncherApplicationController* self, gboolean running) {
      g_return_if_fail (self != NULL);
      unity_launcher_scroller_child_set_running (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), running);
      if (!running) {
            unity_launcher_application_controller_detach_application (self);
      }
}


static void unity_launcher_application_controller_on_app_active_changed (UnityLauncherApplicationController* self, gboolean active) {
      g_return_if_fail (self != NULL);
      unity_launcher_scroller_child_set_active (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), active);
}


static void unity_launcher_application_controller_on_app_urgant_changed (UnityLauncherApplicationController* self, gboolean urgancy) {
      g_return_if_fail (self != NULL);
      unity_launcher_scroller_child_set_needs_attention (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), urgancy);
}


static void unity_launcher_application_controller_load_desktop_file_info (UnityLauncherApplicationController* self) {
      GError * _inner_error_;
      g_return_if_fail (self != NULL);
      _inner_error_ = NULL;
      {
            GKeyFile* _tmp0_;
            self->priv->desktop_keyfile = (_tmp0_ = g_key_file_new (), _g_key_file_free0 (self->priv->desktop_keyfile), _tmp0_);
            g_key_file_load_from_file (self->priv->desktop_keyfile, unity_launcher_application_controller_get_desktop_file (self), G_KEY_FILE_NONE, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch15_g_error;
            }
      }
      goto __finally15;
      __catch15_g_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("application-controller.vala:428: could not load desktop file: %s", e->message);
                  _g_error_free0 (e);
            }
      }
      __finally15:
      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;
      }
      {
            char* _tmp1_;
            char* _tmp2_;
            _tmp1_ = g_key_file_get_string (self->priv->desktop_keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch16_g_error;
            }
            self->priv->icon_name = (_tmp2_ = _tmp1_, _g_free0 (self->priv->icon_name), _tmp2_);
            unity_launcher_application_controller_load_icon_from_icon_name (self);
      }
      goto __finally16;
      __catch16_g_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("application-controller.vala:438: could not load icon name from desktop" \
" file: %s", e->message);
                  _g_error_free0 (e);
            }
      }
      __finally16:
      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;
      }
      {
            char* _tmp3_;
            char* _tmp4_;
            _tmp3_ = g_key_file_get_string (self->priv->desktop_keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch17_g_error;
            }
            ((UnityLauncherScrollerChildController*) self)->name = (_tmp4_ = _tmp3_, _g_free0 (((UnityLauncherScrollerChildController*) self)->name), _tmp4_);
      }
      goto __finally17;
      __catch17_g_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  g_warning ("application-controller.vala:447: could not load name from desktop file" \
": %s", e->message);
                  _g_error_free0 (e);
            }
      }
      __finally17:
      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;
      }
}


static void _lambda11_ (UnityThemeFilePath* theme, const char* filepath, UnityLauncherApplicationController* self) {
      GError * _inner_error_;
      g_return_if_fail (theme != NULL);
      g_return_if_fail (filepath != NULL);
      _inner_error_ = NULL;
      {
            GdkPixbuf* _tmp0_;
            GdkPixbuf* _tmp1_;
            _tmp0_ = gdk_pixbuf_new_from_file (filepath, &_inner_error_);
            if (_inner_error_ != NULL) {
                  goto __catch18_g_error;
            }
            unity_launcher_scroller_child_set_icon (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), _tmp1_ = _tmp0_);
            _g_object_unref0 (_tmp1_);
      }
      goto __finally18;
      __catch18_g_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  char* _tmp2_;
                  g_warning ("application-controller.vala:486: %s", _tmp2_ = g_strconcat ("Could not load from ", string_to_string (filepath), NULL));
                  _g_free0 (_tmp2_);
                  _g_error_free0 (e);
            }
      }
      __finally18:
      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;
      }
}


static void __lambda11__unity_theme_file_path_found_icon_path (UnityThemeFilePath* _sender, const char* filepath, gpointer self) {
      _lambda11_ (_sender, filepath, self);
}


static void _lambda12_ (UnityLauncherApplicationController* self) {
      GError * _inner_error_;
      _inner_error_ = NULL;
      {
            GtkIconTheme* default_theme;
            GdkPixbuf* _tmp0_;
            default_theme = _g_object_ref0 (gtk_icon_theme_get_default ());
            _tmp0_ = gtk_icon_theme_load_icon (default_theme, GTK_STOCK_MISSING_IMAGE, 48, 0, &_inner_error_);
            if (_inner_error_ != NULL) {
                  _g_object_unref0 (default_theme);
                  goto __catch19_g_error;
            }
            unity_launcher_scroller_child_set_icon (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), _tmp0_);
            _g_object_unref0 (default_theme);
      }
      goto __finally19;
      __catch19_g_error:
      {
            GError * e;
            e = _inner_error_;
            _inner_error_ = NULL;
            {
                  char* _tmp1_;
                  g_warning ("application-controller.vala:498: Could not load any icon for %s", _tmp1_ = bamf_view_get_name ((BamfView*) self->priv->app));
                  _g_free0 (_tmp1_);
                  _g_error_free0 (e);
            }
      }
      __finally19:
      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;
      }
}


static void __lambda12__unity_theme_file_path_failed (UnityThemeFilePath* _sender, gpointer self) {
      _lambda12_ (self);
}


static void unity_launcher_application_controller_load_icon_from_icon_name (UnityLauncherApplicationController* self) {
      char* _tmp0_;
      gboolean _tmp1_;
      UnityThemeFilePath* _tmp2_;
      GtkIconTheme* theme;
      GtkIconTheme* _tmp3_;
      g_return_if_fail (self != NULL);
      if (unity_launcher_application_controller_try_load_from_file (self, self->priv->icon_name)) {
            return;
      }
      if ((_tmp1_ = unity_launcher_application_controller_try_load_from_file (self, _tmp0_ = g_strconcat ("/usr/share/pixmaps/", self->priv->icon_name, NULL)), _g_free0 (_tmp0_), _tmp1_)) {
            return;
      }
      self->priv->theme_file_path = (_tmp2_ = unity_theme_file_path_new (), _g_object_unref0 (self->priv->theme_file_path), _tmp2_);
      theme = _g_object_ref0 (gtk_icon_theme_get_default ());
      unity_theme_file_path_add_icon_theme (self->priv->theme_file_path, theme);
      theme = (_tmp3_ = gtk_icon_theme_new (), _g_object_unref0 (theme), _tmp3_);
      gtk_icon_theme_set_custom_theme (theme, "unity-icon-theme");
      unity_theme_file_path_add_icon_theme (self->priv->theme_file_path, theme);
      gtk_icon_theme_set_custom_theme (theme, "Web");
      unity_theme_file_path_add_icon_theme (self->priv->theme_file_path, theme);
      g_signal_connect_object (self->priv->theme_file_path, "found-icon-path", (GCallback) __lambda11__unity_theme_file_path_found_icon_path, self, 0);
      g_signal_connect_object (self->priv->theme_file_path, "failed", (GCallback) __lambda12__unity_theme_file_path_failed, self, 0);
      unity_theme_file_path_get_icon_filepath (self->priv->theme_file_path, self->priv->icon_name, NULL, NULL);
      _g_object_unref0 (theme);
}


static gboolean unity_launcher_application_controller_try_load_from_file (UnityLauncherApplicationController* self, const char* filepath) {
      gboolean result = FALSE;
      GError * _inner_error_;
      GdkPixbuf* pixbuf;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (filepath != NULL, FALSE);
      _inner_error_ = NULL;
      pixbuf = NULL;
      if (g_file_test (filepath, G_FILE_TEST_IS_REGULAR)) {
            {
                  GdkPixbuf* _tmp0_;
                  GdkPixbuf* _tmp1_;
                  _tmp0_ = gdk_pixbuf_new_from_file_at_scale (filepath, 48, 48, TRUE, &_inner_error_);
                  if (_inner_error_ != NULL) {
                        goto __catch20_g_error;
                  }
                  pixbuf = (_tmp1_ = _tmp0_, _g_object_unref0 (pixbuf), _tmp1_);
            }
            goto __finally20;
            __catch20_g_error:
            {
                  GError * e;
                  e = _inner_error_;
                  _inner_error_ = NULL;
                  {
                        g_warning ("application-controller.vala:517: Unable to load image from file '%s': " \
"%s", filepath, e->message);
                        _g_error_free0 (e);
                  }
            }
            __finally20:
            if (_inner_error_ != NULL) {
                  _g_object_unref0 (pixbuf);
                  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;
            }
            if (GDK_IS_PIXBUF (pixbuf)) {
                  unity_launcher_scroller_child_set_icon (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), pixbuf);
                  result = TRUE;
                  _g_object_unref0 (pixbuf);
                  return result;
            }
      }
      result = FALSE;
      _g_object_unref0 (pixbuf);
      return result;
}


const char* unity_launcher_application_controller_get_desktop_file (UnityLauncherApplicationController* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_desktop_file;
      return result;
}


static void unity_launcher_application_controller_set_desktop_file (UnityLauncherApplicationController* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_desktop_file = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_desktop_file), _tmp0_);
      unity_launcher_application_controller_load_desktop_file_info (self);
      g_object_notify ((GObject *) self, "desktop-file");
}


static void _unity_launcher_application_controller_on_favorite_added_unity_favorites_favorite_added (UnityFavorites* _sender, const char* uid, gpointer self) {
      unity_launcher_application_controller_on_favorite_added (self, uid);
}


static void _unity_launcher_application_controller_on_favorite_removed_unity_favorites_favorite_removed (UnityFavorites* _sender, const char* uid, gpointer self) {
      unity_launcher_application_controller_on_favorite_removed (self, uid);
}


static void _lambda13_ (gboolean open, Block1Data* _data1_) {
      UnityLauncherApplicationController * self;
      gboolean _tmp0_ = FALSE;
      CtkActor* _tmp1_;
      gboolean _tmp2_;
      self = _data1_->self;
      if ((_tmp2_ = (_tmp1_ = unity_launcher_quicklist_controller_get_attached_actor (_data1_->controller)) == CTK_ACTOR (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)), _g_object_unref0 (_tmp1_), _tmp2_)) {
            _tmp0_ = self->priv->app != NULL;
      } else {
            _tmp0_ = FALSE;
      }
      if (_tmp0_) {
            if (open) {
                  GArray* _tmp3_;
                  unity_shell_expose_xids (unity_global_shell, _tmp3_ = bamf_application_get_xids (self->priv->app));
                  _g_array_free0 (_tmp3_);
            } else {
                  unity_shell_stop_expose (unity_global_shell);
            }
      }
}


static void __lambda13__unity_launcher_quicklist_controller_menu_state_changed (UnityLauncherQuicklistController* _sender, gboolean open, gpointer self) {
      _lambda13_ (open, self);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
      ++_data1_->_ref_count_;
      return _data1_;
}


static void block1_data_unref (Block1Data* _data1_) {
      if ((--_data1_->_ref_count_) == 0) {
            _g_object_unref0 (_data1_->self);
            _g_object_unref0 (_data1_->controller);
            g_slice_free (Block1Data, _data1_);
      }
}


static GObject * unity_launcher_application_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
      GObject * obj;
      GObjectClass * parent_class;
      UnityLauncherApplicationController * self;
      parent_class = G_OBJECT_CLASS (unity_launcher_application_controller_parent_class);
      obj = parent_class->constructor (type, n_construct_properties, construct_properties);
      self = UNITY_LAUNCHER_APPLICATION_CONTROLLER (obj);
      {
            Block1Data* _data1_;
            UnityThemeFilePath* _tmp0_;
            UnityFavorites* favorites;
            _data1_ = g_slice_new0 (Block1Data);
            _data1_->_ref_count_ = 1;
            _data1_->self = g_object_ref (self);
            self->priv->theme_file_path = (_tmp0_ = unity_theme_file_path_new (), _g_object_unref0 (self->priv->theme_file_path), _tmp0_);
            favorites = unity_favorites_get_default ();
            g_signal_connect_object (favorites, "favorite-added", (GCallback) _unity_launcher_application_controller_on_favorite_added_unity_favorites_favorite_added, self, 0);
            g_signal_connect_object (favorites, "favorite-removed", (GCallback) _unity_launcher_application_controller_on_favorite_removed_unity_favorites_favorite_removed, self, 0);
            self->priv->is_favorite = TRUE;
            unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_UNPINNED;
            {
                  GeeArrayList* _tmp1_;
                  GeeIterator* _tmp2_;
                  GeeIterator* _uid_it;
                  _uid_it = (_tmp2_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) (_tmp1_ = unity_favorites_get_favorites (favorites))), _g_object_unref0 (_tmp1_), _tmp2_);
                  while (TRUE) {
                        char* uid;
                        char* _tmp3_;
                        gboolean _tmp4_;
                        if (!gee_iterator_next (_uid_it)) {
                              break;
                        }
                        uid = (char*) gee_iterator_get (_uid_it);
                        if ((_tmp4_ = _vala_strcmp0 (_tmp3_ = unity_favorites_get_string (favorites, uid, "desktop_file"), unity_launcher_application_controller_get_desktop_file (self)) == 0, _g_free0 (_tmp3_), _tmp4_)) {
                              self->priv->is_favorite = TRUE;
                              unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_PINNED;
                              _g_free0 (uid);
                              break;
                        }
                        _g_free0 (uid);
                  }
                  _g_object_unref0 (_uid_it);
            }
            _data1_->controller = _g_object_ref0 (unity_launcher_quicklist_controller_get_default ());
            g_signal_connect_data (_data1_->controller, "menu-state-changed", (GCallback) __lambda13__unity_launcher_quicklist_controller_menu_state_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
            _g_object_unref0 (favorites);
            block1_data_unref (_data1_);
      }
      return obj;
}


static void unity_launcher_application_controller_class_init (UnityLauncherApplicationControllerClass * klass) {
      unity_launcher_application_controller_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (UnityLauncherApplicationControllerPrivate));
      UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_CLASS (klass)->get_menu_shortcuts = unity_launcher_application_controller_real_get_menu_shortcuts;
      UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_CLASS (klass)->get_menu_shortcut_actions = unity_launcher_application_controller_real_get_menu_shortcut_actions;
      UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_CLASS (klass)->activate = unity_launcher_application_controller_real_activate;
      G_OBJECT_CLASS (klass)->get_property = unity_launcher_application_controller_get_property;
      G_OBJECT_CLASS (klass)->set_property = unity_launcher_application_controller_set_property;
      G_OBJECT_CLASS (klass)->constructor = unity_launcher_application_controller_constructor;
      G_OBJECT_CLASS (klass)->finalize = unity_launcher_application_controller_finalize;
      g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_APPLICATION_CONTROLLER_DESKTOP_FILE, g_param_spec_string ("desktop-file", "desktop-file", "desktop-file", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void unity_launcher_application_controller_instance_init (UnityLauncherApplicationController * self) {
      self->priv = UNITY_LAUNCHER_APPLICATION_CONTROLLER_GET_PRIVATE (self);
      self->priv->app = NULL;
      self->priv->is_favorite = FALSE;
}


static void unity_launcher_application_controller_finalize (GObject* obj) {
      UnityLauncherApplicationController * self;
      self = UNITY_LAUNCHER_APPLICATION_CONTROLLER (obj);
      {
      }
      _g_free0 (self->priv->_desktop_file);
      _g_key_file_free0 (self->priv->desktop_keyfile);
      _g_free0 (self->priv->icon_name);
      _g_object_unref0 (self->priv->theme_file_path);
      _g_object_unref0 (self->priv->app);
      G_OBJECT_CLASS (unity_launcher_application_controller_parent_class)->finalize (obj);
}


GType unity_launcher_application_controller_get_type (void) {
      static volatile gsize unity_launcher_application_controller_type_id__volatile = 0;
      if (g_once_init_enter (&unity_launcher_application_controller_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (UnityLauncherApplicationControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_launcher_application_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityLauncherApplicationController), 0, (GInstanceInitFunc) unity_launcher_application_controller_instance_init, NULL };
            GType unity_launcher_application_controller_type_id;
            unity_launcher_application_controller_type_id = g_type_register_static (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER, "UnityLauncherApplicationController", &g_define_type_info, 0);
            g_once_init_leave (&unity_launcher_application_controller_type_id__volatile, unity_launcher_application_controller_type_id);
      }
      return unity_launcher_application_controller_type_id__volatile;
}


static void unity_launcher_application_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
      UnityLauncherApplicationController * self;
      self = UNITY_LAUNCHER_APPLICATION_CONTROLLER (object);
      switch (property_id) {
            case UNITY_LAUNCHER_APPLICATION_CONTROLLER_DESKTOP_FILE:
            g_value_set_string (value, unity_launcher_application_controller_get_desktop_file (self));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void unity_launcher_application_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
      UnityLauncherApplicationController * self;
      self = UNITY_LAUNCHER_APPLICATION_CONTROLLER (object);
      switch (property_id) {
            case UNITY_LAUNCHER_APPLICATION_CONTROLLER_DESKTOP_FILE:
            unity_launcher_application_controller_set_desktop_file (self, g_value_get_string (value));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      if ((array != NULL) && (destroy_func != NULL)) {
            int i;
            for (i = 0; i < array_length; i = i + 1) {
                  if (((gpointer*) array)[i] != NULL) {
                        destroy_func (((gpointer*) array)[i]);
                  }
            }
      }
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      _vala_array_destroy (array, array_length, destroy_func);
      g_free (array);
}


static int _vala_strcmp0 (const char * str1, const char * str2) {
      if (str1 == NULL) {
            return -(str1 != str2);
      }
      if (str2 == NULL) {
            return str1 != str2;
      }
      return strcmp (str1, str2);
}





Generated by  Doxygen 1.6.0   Back to index