/* applications-widget.c generated by valac 0.14.2, the Vala compiler * generated from applications-widget.vala, do not modify */ /* -*- Mode: vala; tab-width: 4; intend-tabs-mode: t -*- */ /* alm * * Copyright (C) Seif Lotfy 2012 * Copyright (C) Stefano Candori 2012 * Copyright (C) Manish Sinha 2012 * * alm is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * alm 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see ."; */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ALM_TYPE_APPLICATIONS_WIDGET (alm_applications_widget_get_type ()) #define ALM_APPLICATIONS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_APPLICATIONS_WIDGET, AlmApplicationsWidget)) #define ALM_APPLICATIONS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_APPLICATIONS_WIDGET, AlmApplicationsWidgetClass)) #define ALM_IS_APPLICATIONS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_APPLICATIONS_WIDGET)) #define ALM_IS_APPLICATIONS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_APPLICATIONS_WIDGET)) #define ALM_APPLICATIONS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_APPLICATIONS_WIDGET, AlmApplicationsWidgetClass)) typedef struct _AlmApplicationsWidget AlmApplicationsWidget; typedef struct _AlmApplicationsWidgetClass AlmApplicationsWidgetClass; typedef struct _AlmApplicationsWidgetPrivate AlmApplicationsWidgetPrivate; #define ALM_TYPE_BLACKLIST (alm_blacklist_get_type ()) #define ALM_BLACKLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_BLACKLIST, AlmBlacklist)) #define ALM_BLACKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_BLACKLIST, AlmBlacklistClass)) #define ALM_IS_BLACKLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_BLACKLIST)) #define ALM_IS_BLACKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_BLACKLIST)) #define ALM_BLACKLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_BLACKLIST, AlmBlacklistClass)) typedef struct _AlmBlacklist AlmBlacklist; typedef struct _AlmBlacklistClass AlmBlacklistClass; #define ALM_TYPE_APPLICATION_BLACKLIST (alm_application_blacklist_get_type ()) #define ALM_APPLICATION_BLACKLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_APPLICATION_BLACKLIST, AlmApplicationBlacklist)) #define ALM_APPLICATION_BLACKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_APPLICATION_BLACKLIST, AlmApplicationBlacklistClass)) #define ALM_IS_APPLICATION_BLACKLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_APPLICATION_BLACKLIST)) #define ALM_IS_APPLICATION_BLACKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_APPLICATION_BLACKLIST)) #define ALM_APPLICATION_BLACKLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_APPLICATION_BLACKLIST, AlmApplicationBlacklistClass)) typedef struct _AlmApplicationBlacklist AlmApplicationBlacklist; typedef struct _AlmApplicationBlacklistClass AlmApplicationBlacklistClass; #define ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG (alm_applications_chooser_dialog_get_type ()) #define ALM_APPLICATIONS_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, AlmApplicationsChooserDialog)) #define ALM_APPLICATIONS_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, AlmApplicationsChooserDialogClass)) #define ALM_IS_APPLICATIONS_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG)) #define ALM_IS_APPLICATIONS_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG)) #define ALM_APPLICATIONS_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, AlmApplicationsChooserDialogClass)) typedef struct _AlmApplicationsChooserDialog AlmApplicationsChooserDialog; typedef struct _AlmApplicationsChooserDialogClass AlmApplicationsChooserDialogClass; #define ALM_TYPE_APPLICATIONS_TREE_VIEW (alm_applications_tree_view_get_type ()) #define ALM_APPLICATIONS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_APPLICATIONS_TREE_VIEW, AlmApplicationsTreeView)) #define ALM_APPLICATIONS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_APPLICATIONS_TREE_VIEW, AlmApplicationsTreeViewClass)) #define ALM_IS_APPLICATIONS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_APPLICATIONS_TREE_VIEW)) #define ALM_IS_APPLICATIONS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_APPLICATIONS_TREE_VIEW)) #define ALM_APPLICATIONS_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_APPLICATIONS_TREE_VIEW, AlmApplicationsTreeViewClass)) typedef struct _AlmApplicationsTreeView AlmApplicationsTreeView; typedef struct _AlmApplicationsTreeViewClass AlmApplicationsTreeViewClass; #define ALM_TYPE_APP_CHOOSE_INFO (alm_app_choose_info_get_type ()) #define ALM_APP_CHOOSE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_APP_CHOOSE_INFO, AlmAppChooseInfo)) #define ALM_APP_CHOOSE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_APP_CHOOSE_INFO, AlmAppChooseInfoClass)) #define ALM_IS_APP_CHOOSE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_APP_CHOOSE_INFO)) #define ALM_IS_APP_CHOOSE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_APP_CHOOSE_INFO)) #define ALM_APP_CHOOSE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_APP_CHOOSE_INFO, AlmAppChooseInfoClass)) typedef struct _AlmAppChooseInfo AlmAppChooseInfo; typedef struct _AlmAppChooseInfoClass AlmAppChooseInfoClass; #define _alm_blacklist_unref0(var) ((var == NULL) ? NULL : (var = (alm_blacklist_unref (var), NULL))) #define _alm_application_blacklist_unref0(var) ((var == NULL) ? NULL : (var = (alm_application_blacklist_unref (var), NULL))) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) #define _alm_app_choose_info_unref0(var) ((var == NULL) ? NULL : (var = (alm_app_choose_info_unref (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _AlmApplicationBlacklistPrivate AlmApplicationBlacklistPrivate; #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) typedef struct _AlmParamSpecApplicationBlacklist AlmParamSpecApplicationBlacklist; typedef struct _AlmApplicationsTreeViewPrivate AlmApplicationsTreeViewPrivate; #define ALM_APPLICATIONS_TREE_VIEW_TYPE_TREE_VIEW_COLS (alm_applications_tree_view_tree_view_cols_get_type ()) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define _gtk_icon_info_free0(var) ((var == NULL) ? NULL : (var = (gtk_icon_info_free (var), NULL))) #define ALM_TYPE_APP_SELECTION_TREE_VIEW (alm_app_selection_tree_view_get_type ()) #define ALM_APP_SELECTION_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_APP_SELECTION_TREE_VIEW, AlmAppSelectionTreeView)) #define ALM_APP_SELECTION_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_APP_SELECTION_TREE_VIEW, AlmAppSelectionTreeViewClass)) #define ALM_IS_APP_SELECTION_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_APP_SELECTION_TREE_VIEW)) #define ALM_IS_APP_SELECTION_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_APP_SELECTION_TREE_VIEW)) #define ALM_APP_SELECTION_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_APP_SELECTION_TREE_VIEW, AlmAppSelectionTreeViewClass)) typedef struct _AlmAppSelectionTreeView AlmAppSelectionTreeView; typedef struct _AlmAppSelectionTreeViewClass AlmAppSelectionTreeViewClass; typedef struct _AlmAppSelectionTreeViewPrivate AlmAppSelectionTreeViewPrivate; #define ALM_APP_SELECTION_TREE_VIEW_TYPE_TREE_VIEW_COLS (alm_app_selection_tree_view_tree_view_cols_get_type ()) typedef struct _AlmApplicationsChooserDialogPrivate AlmApplicationsChooserDialogPrivate; #define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL))) #define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL))) typedef struct _AlmAppChooseInfoPrivate AlmAppChooseInfoPrivate; typedef struct _AlmParamSpecAppChooseInfo AlmParamSpecAppChooseInfo; struct _AlmApplicationsWidget { GtkBox parent_instance; AlmApplicationsWidgetPrivate * priv; }; struct _AlmApplicationsWidgetClass { GtkBoxClass parent_class; }; struct _AlmApplicationsWidgetPrivate { AlmBlacklist* blacklist_interface; AlmApplicationBlacklist* app_blacklist; AlmApplicationsChooserDialog* app_dialog; AlmApplicationsTreeView* app_treeview; GtkBox* container_box; GHashTable* blocked_list; GHashTable* unblocked_list; gboolean app_change_recursive; }; struct _AlmApplicationBlacklist { GTypeInstance parent_instance; volatile int ref_count; AlmApplicationBlacklistPrivate * priv; }; struct _AlmApplicationBlacklistClass { GTypeClass parent_class; void (*finalize) (AlmApplicationBlacklist *self); }; struct _AlmApplicationBlacklistPrivate { AlmBlacklist* blacklist_interface; GeeHashSet* all_blocked_apps; }; struct _AlmParamSpecApplicationBlacklist { GParamSpec parent_instance; }; struct _AlmApplicationsTreeView { GtkBox parent_instance; AlmApplicationsTreeViewPrivate * priv; }; struct _AlmApplicationsTreeViewClass { GtkBoxClass parent_class; }; struct _AlmApplicationsTreeViewPrivate { AlmApplicationBlacklist* app_blacklist; GtkListStore* store; GtkTreeView* treeview; GHashTable* blocked_apps; GHashTable* unblocked_apps; }; typedef enum { ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_APP_NAME, ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_ICON, ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_DESKTOP_FILE, ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_N_COLS } AlmApplicationsTreeViewTreeViewCols; struct _AlmAppSelectionTreeView { GtkBox parent_instance; AlmAppSelectionTreeViewPrivate * priv; }; struct _AlmAppSelectionTreeViewClass { GtkBoxClass parent_class; }; struct _AlmAppSelectionTreeViewPrivate { AlmApplicationBlacklist* app_blacklist; GtkListStore* store; GtkTreeView* treeview; }; typedef enum { ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_APP_NAME, ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_ICON, ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_DESKTOP_FILE, ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_N_COLS } AlmAppSelectionTreeViewTreeViewCols; struct _AlmApplicationsChooserDialog { GtkDialog parent_instance; AlmApplicationsChooserDialogPrivate * priv; }; struct _AlmApplicationsChooserDialogClass { GtkDialogClass parent_class; }; struct _AlmApplicationsChooserDialogPrivate { AlmApplicationBlacklist* app_blacklist; AlmAppSelectionTreeView* treeview; GHashTable* all_actors_list; GHashTable* blocked_apps; GHashTable* unblocked_apps; }; struct _AlmAppChooseInfo { GTypeInstance parent_instance; volatile int ref_count; AlmAppChooseInfoPrivate * priv; }; struct _AlmAppChooseInfoClass { GTypeClass parent_class; void (*finalize) (AlmAppChooseInfo *self); }; struct _AlmAppChooseInfoPrivate { gchar* app_name; GdkPixbuf* app_icon; gchar* last_accessed_time; guint usage_rating; }; struct _AlmParamSpecAppChooseInfo { GParamSpec parent_instance; }; static gpointer alm_applications_widget_parent_class = NULL; static gpointer alm_application_blacklist_parent_class = NULL; extern gchar* alm_application_blacklist_interpretation_prefix; gchar* alm_application_blacklist_interpretation_prefix = NULL; static gpointer alm_applications_tree_view_parent_class = NULL; static GtkIconTheme* alm_applications_tree_view_icon_theme; static GtkIconTheme* alm_applications_tree_view_icon_theme = NULL; static gpointer alm_app_selection_tree_view_parent_class = NULL; static gpointer alm_applications_chooser_dialog_parent_class = NULL; static gpointer alm_app_choose_info_parent_class = NULL; GType alm_applications_widget_get_type (void) G_GNUC_CONST; gpointer alm_blacklist_ref (gpointer instance); void alm_blacklist_unref (gpointer instance); GParamSpec* alm_param_spec_blacklist (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); void alm_value_set_blacklist (GValue* value, gpointer v_object); void alm_value_take_blacklist (GValue* value, gpointer v_object); gpointer alm_value_get_blacklist (const GValue* value); GType alm_blacklist_get_type (void) G_GNUC_CONST; gpointer alm_application_blacklist_ref (gpointer instance); void alm_application_blacklist_unref (gpointer instance); GParamSpec* alm_param_spec_application_blacklist (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); void alm_value_set_application_blacklist (GValue* value, gpointer v_object); void alm_value_take_application_blacklist (GValue* value, gpointer v_object); gpointer alm_value_get_application_blacklist (const GValue* value); GType alm_application_blacklist_get_type (void) G_GNUC_CONST; GType alm_applications_chooser_dialog_get_type (void) G_GNUC_CONST; GType alm_applications_tree_view_get_type (void) G_GNUC_CONST; gpointer alm_app_choose_info_ref (gpointer instance); void alm_app_choose_info_unref (gpointer instance); GParamSpec* alm_param_spec_app_choose_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); void alm_value_set_app_choose_info (GValue* value, gpointer v_object); void alm_value_take_app_choose_info (GValue* value, gpointer v_object); gpointer alm_value_get_app_choose_info (const GValue* value); GType alm_app_choose_info_get_type (void) G_GNUC_CONST; #define ALM_APPLICATIONS_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ALM_TYPE_APPLICATIONS_WIDGET, AlmApplicationsWidgetPrivate)) enum { ALM_APPLICATIONS_WIDGET_DUMMY_PROPERTY }; AlmApplicationsWidget* alm_applications_widget_new (AlmBlacklist* blacklist_inter); AlmApplicationsWidget* alm_applications_widget_construct (GType object_type, AlmBlacklist* blacklist_inter); static void _g_free0_ (gpointer var); static void _alm_app_choose_info_unref0_ (gpointer var); AlmApplicationBlacklist* alm_application_blacklist_new (AlmBlacklist* blacklist); AlmApplicationBlacklist* alm_application_blacklist_construct (GType object_type, AlmBlacklist* blacklist); AlmApplicationsTreeView* alm_applications_tree_view_new (AlmApplicationBlacklist* app_blacklist, GHashTable* blocked, GHashTable* unblocked); AlmApplicationsTreeView* alm_applications_tree_view_construct (GType object_type, AlmApplicationBlacklist* app_blacklist, GHashTable* blocked, GHashTable* unblocked); static void alm_applications_widget_set_up_ui (AlmApplicationsWidget* self); static void __lambda6_ (AlmApplicationsWidget* self, const gchar* app, ZeitgeistEvent* event); void alm_applications_tree_view_remove_app_from_view (AlmApplicationsTreeView* self, const gchar* app); static void ___lambda6__alm_application_blacklist_application_removed (AlmApplicationBlacklist* _sender, const gchar* app, ZeitgeistEvent* ev, gpointer self); static void __lambda7_ (AlmApplicationsWidget* self, const gchar* app, ZeitgeistEvent* event); void alm_applications_tree_view_add_application_to_view (AlmApplicationsTreeView* self, const gchar* app); static void ___lambda7__alm_application_blacklist_application_added (AlmApplicationBlacklist* _sender, const gchar* app, ZeitgeistEvent* ev, gpointer self); void alm_applications_widget_app_add_clicked (AlmApplicationsWidget* self, GtkToolButton* button); static void _alm_applications_widget_app_add_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self); void alm_applications_widget_app_remove_clicked (AlmApplicationsWidget* self, GtkToolButton* button); static void _alm_applications_widget_app_remove_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self); GeeHashSet* alm_application_blacklist_get_all_apps (AlmApplicationBlacklist* self); static void alm_applications_widget_populate_view (AlmApplicationsWidget* self, GeeHashSet* app_list); AlmApplicationsChooserDialog* alm_applications_chooser_dialog_new (AlmApplicationBlacklist* app_blacklist, GHashTable* blocked_list, GHashTable* unblocked_list); AlmApplicationsChooserDialog* alm_applications_chooser_dialog_construct (GType object_type, AlmApplicationBlacklist* app_blacklist, GHashTable* blocked_list, GHashTable* unblocked_list); GtkTreeView* alm_applications_chooser_dialog_get_tree (AlmApplicationsChooserDialog* self); GtkListStore* alm_applications_chooser_dialog_get_liststore (AlmApplicationsChooserDialog* self); void alm_application_blacklist_block (AlmApplicationBlacklist* self, const gchar* application); gchar* alm_applications_tree_view_remove_selected_app (AlmApplicationsTreeView* self); void alm_application_blacklist_unblock (AlmApplicationBlacklist* self, const gchar* application); void alm_applications_chooser_dialog_insert_app_liststore (AlmApplicationsChooserDialog* self, const gchar* app); gchar* alm_applications_widget_markup_for_app (GDesktopAppInfo* app_info); static void alm_applications_widget_finalize (GObject* obj); #define ALM_APPLICATION_BLACKLIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ALM_TYPE_APPLICATION_BLACKLIST, AlmApplicationBlacklistPrivate)) enum { ALM_APPLICATION_BLACKLIST_DUMMY_PROPERTY }; static void alm_application_blacklist_on_blacklist_added (AlmApplicationBlacklist* self, const gchar* blacklist_id, ZeitgeistEvent* ev); static void _alm_application_blacklist_on_blacklist_added_alm_blacklist_template_added (AlmBlacklist* _sender, const gchar* blacklist_id, ZeitgeistEvent* blacklist_template, gpointer self); static void alm_application_blacklist_on_blacklist_removed (AlmApplicationBlacklist* self, const gchar* blacklist_id, ZeitgeistEvent* ev); static void _alm_application_blacklist_on_blacklist_removed_alm_blacklist_template_removed (AlmBlacklist* _sender, const gchar* blacklist_id, ZeitgeistEvent* blacklist_template, gpointer self); static GeeHashSet* alm_application_blacklist_get_blocked_apps (AlmApplicationBlacklist* self); void alm_application_blacklist_get_all_applications (AlmApplicationBlacklist* self, AlmApplicationsChooserDialog* dialog); void alm_blacklist_get_all_applications (AlmBlacklist* self, AlmApplicationsChooserDialog* dialog); GHashTable* alm_blacklist_get_all_templates (AlmBlacklist* self); void alm_blacklist_add_template (AlmBlacklist* self, const gchar* blacklist_id, ZeitgeistEvent* blacklist_template); void alm_blacklist_remove_template (AlmBlacklist* self, const gchar* blacklist_id); static void g_cclosure_user_marshal_VOID__STRING_OBJECT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); static void alm_application_blacklist_finalize (AlmApplicationBlacklist* obj); #define ALM_APPLICATIONS_TREE_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ALM_TYPE_APPLICATIONS_TREE_VIEW, AlmApplicationsTreeViewPrivate)) enum { ALM_APPLICATIONS_TREE_VIEW_DUMMY_PROPERTY, ALM_APPLICATIONS_TREE_VIEW_LISTSTORE }; static GType alm_applications_tree_view_tree_view_cols_get_type (void) G_GNUC_UNUSED; static void alm_applications_tree_view_set_up_ui (AlmApplicationsTreeView* self); GdkPixbuf* alm_applications_tree_view_get_pixbuf_from_gio_icon (GIcon* icon); GtkListStore* alm_applications_tree_view_get_liststore (AlmApplicationsTreeView* self); AlmAppChooseInfo* alm_app_choose_info_new (const gchar* app_name, GdkPixbuf* app_icon, const gchar* last_accessed_time, guint usage_rating); AlmAppChooseInfo* alm_app_choose_info_construct (GType object_type, const gchar* app_name, GdkPixbuf* app_icon, const gchar* last_accessed_time, guint usage_rating); static void alm_applications_tree_view_finalize (GObject* obj); static void _vala_alm_applications_tree_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); GType alm_app_selection_tree_view_get_type (void) G_GNUC_CONST; #define ALM_APP_SELECTION_TREE_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ALM_TYPE_APP_SELECTION_TREE_VIEW, AlmAppSelectionTreeViewPrivate)) enum { ALM_APP_SELECTION_TREE_VIEW_DUMMY_PROPERTY, ALM_APP_SELECTION_TREE_VIEW_TREE, ALM_APP_SELECTION_TREE_VIEW_LISTSTORE }; static GType alm_app_selection_tree_view_tree_view_cols_get_type (void) G_GNUC_UNUSED; AlmAppSelectionTreeView* alm_app_selection_tree_view_new (AlmApplicationBlacklist* app_blacklist); AlmAppSelectionTreeView* alm_app_selection_tree_view_construct (GType object_type, AlmApplicationBlacklist* app_blacklist); static void alm_app_selection_tree_view_set_up_ui (AlmAppSelectionTreeView* self); GtkTreeView* alm_app_selection_tree_view_get_tree (AlmAppSelectionTreeView* self); GtkListStore* alm_app_selection_tree_view_get_liststore (AlmAppSelectionTreeView* self); static void alm_app_selection_tree_view_finalize (GObject* obj); static void _vala_alm_app_selection_tree_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); #define ALM_APPLICATIONS_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, AlmApplicationsChooserDialogPrivate)) enum { ALM_APPLICATIONS_CHOOSER_DIALOG_DUMMY_PROPERTY, ALM_APPLICATIONS_CHOOSER_DIALOG_TREE, ALM_APPLICATIONS_CHOOSER_DIALOG_LISTSTORE }; static void alm_applications_chooser_dialog_set_up_ui (AlmApplicationsChooserDialog* self); void alm_applications_chooser_dialog_handle_app_population (AlmApplicationsChooserDialog* self, GHashTable* all_actors); static gint64* _int64_dup (gint64* self); void alm_applications_chooser_dialog_insert_liststore (AlmApplicationsChooserDialog* self, GAppInfo* app_info, const gchar* last_accessed, guint usage); static void _g_object_unref0_ (gpointer var); static void _g_list_free__g_object_unref0_ (GList* self); void alm_app_choose_info_set_last_accessed (AlmAppChooseInfo* self, const gchar* value); void alm_app_choose_info_set_usage (AlmAppChooseInfo* self, guint value); const gchar* alm_app_choose_info_get_name (AlmAppChooseInfo* self); GdkPixbuf* alm_app_choose_info_get_icon (AlmAppChooseInfo* self); const gchar* alm_app_choose_info_get_last_accessed (AlmAppChooseInfo* self); guint alm_app_choose_info_get_usage (AlmAppChooseInfo* self); static void alm_applications_chooser_dialog_finalize (GObject* obj); static void _vala_alm_applications_chooser_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); #define ALM_APP_CHOOSE_INFO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ALM_TYPE_APP_CHOOSE_INFO, AlmAppChooseInfoPrivate)) enum { ALM_APP_CHOOSE_INFO_DUMMY_PROPERTY }; void alm_app_choose_info_set_name (AlmAppChooseInfo* self, const gchar* value); void alm_app_choose_info_set_icon (AlmAppChooseInfo* self, GdkPixbuf* value); static void alm_app_choose_info_finalize (AlmAppChooseInfo* obj); static gpointer _alm_blacklist_ref0 (gpointer self) { return self ? alm_blacklist_ref (self) : NULL; } static void _g_free0_ (gpointer var) { var = (g_free (var), NULL); } static void _alm_app_choose_info_unref0_ (gpointer var) { (var == NULL) ? NULL : (var = (alm_app_choose_info_unref (var), NULL)); } AlmApplicationsWidget* alm_applications_widget_construct (GType object_type, AlmBlacklist* blacklist_inter) { AlmApplicationsWidget * self = NULL; AlmBlacklist* _tmp0_; AlmBlacklist* _tmp1_; GHashFunc _tmp2_; GEqualFunc _tmp3_; GHashTable* _tmp4_; GHashFunc _tmp5_; GEqualFunc _tmp6_; GHashTable* _tmp7_; AlmBlacklist* _tmp8_; AlmApplicationBlacklist* _tmp9_; AlmApplicationBlacklist* _tmp10_; GHashTable* _tmp11_; GHashTable* _tmp12_; AlmApplicationsTreeView* _tmp13_; AlmApplicationsTreeView* _tmp14_; g_return_val_if_fail (blacklist_inter != NULL, NULL); self = (AlmApplicationsWidget*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, NULL); _tmp0_ = blacklist_inter; _tmp1_ = _alm_blacklist_ref0 (_tmp0_); _alm_blacklist_unref0 (self->priv->blacklist_interface); self->priv->blacklist_interface = _tmp1_; _tmp2_ = g_str_hash; _tmp3_ = g_str_equal; _tmp4_ = g_hash_table_new_full (_tmp2_, _tmp3_, _g_free0_, _alm_app_choose_info_unref0_); _g_hash_table_unref0 (self->priv->blocked_list); self->priv->blocked_list = _tmp4_; _tmp5_ = g_str_hash; _tmp6_ = g_str_equal; _tmp7_ = g_hash_table_new_full (_tmp5_, _tmp6_, _g_free0_, _alm_app_choose_info_unref0_); _g_hash_table_unref0 (self->priv->unblocked_list); self->priv->unblocked_list = _tmp7_; _tmp8_ = self->priv->blacklist_interface; _tmp9_ = alm_application_blacklist_new (_tmp8_); _alm_application_blacklist_unref0 (self->priv->app_blacklist); self->priv->app_blacklist = _tmp9_; _tmp10_ = self->priv->app_blacklist; _tmp11_ = self->priv->blocked_list; _tmp12_ = self->priv->unblocked_list; _tmp13_ = alm_applications_tree_view_new (_tmp10_, _tmp11_, _tmp12_); _tmp14_ = g_object_ref_sink (_tmp13_); _g_object_unref0 (self->priv->app_treeview); self->priv->app_treeview = _tmp14_; alm_applications_widget_set_up_ui (self); return self; } AlmApplicationsWidget* alm_applications_widget_new (AlmBlacklist* blacklist_inter) { return alm_applications_widget_construct (ALM_TYPE_APPLICATIONS_WIDGET, blacklist_inter); } static void __lambda6_ (AlmApplicationsWidget* self, const gchar* app, ZeitgeistEvent* event) { gboolean _tmp0_; g_return_if_fail (app != NULL); g_return_if_fail (event != NULL); _tmp0_ = self->priv->app_change_recursive; if (!_tmp0_) { AlmApplicationsTreeView* _tmp1_; const gchar* _tmp2_; _tmp1_ = self->priv->app_treeview; _tmp2_ = app; alm_applications_tree_view_remove_app_from_view (_tmp1_, _tmp2_); } self->priv->app_change_recursive = FALSE; } static void ___lambda6__alm_application_blacklist_application_removed (AlmApplicationBlacklist* _sender, const gchar* app, ZeitgeistEvent* ev, gpointer self) { __lambda6_ (self, app, ev); } static void __lambda7_ (AlmApplicationsWidget* self, const gchar* app, ZeitgeistEvent* event) { gboolean _tmp0_; g_return_if_fail (app != NULL); g_return_if_fail (event != NULL); _tmp0_ = self->priv->app_change_recursive; if (!_tmp0_) { AlmApplicationsTreeView* _tmp1_; const gchar* _tmp2_; _tmp1_ = self->priv->app_treeview; _tmp2_ = app; alm_applications_tree_view_add_application_to_view (_tmp1_, _tmp2_); } self->priv->app_change_recursive = FALSE; } static void ___lambda7__alm_application_blacklist_application_added (AlmApplicationBlacklist* _sender, const gchar* app, ZeitgeistEvent* ev, gpointer self) { __lambda7_ (self, app, ev); } static void _alm_applications_widget_app_add_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) { alm_applications_widget_app_add_clicked (self, _sender); } static void _alm_applications_widget_app_remove_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) { alm_applications_widget_app_remove_clicked (self, _sender); } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } static void alm_applications_widget_set_up_ui (AlmApplicationsWidget* self) { GtkBox* _tmp0_; GtkBox* _tmp1_; AlmApplicationBlacklist* _tmp2_; AlmApplicationBlacklist* _tmp3_; AlmApplicationsTreeView* _tmp4_; GtkToolbar* _tmp5_; GtkToolbar* _tmp6_; GtkToolbar* app_toolbar; GtkToolButton* _tmp7_; GtkToolButton* _tmp8_; GtkToolButton* app_add; GtkToolButton* _tmp9_; GtkToolButton* _tmp10_; GtkToolButton* app_remove; GtkBox* _tmp11_; AlmApplicationsTreeView* _tmp12_; GtkBox* _tmp13_; GtkLabel* _tmp14_; GtkLabel* _tmp15_; GtkLabel* label; GtkBox* _tmp16_; AlmApplicationBlacklist* _tmp17_; GeeHashSet* _tmp18_; GeeHashSet* _tmp19_; GeeHashSet* _tmp20_; GeeHashSet* app_list; AlmApplicationBlacklist* _tmp21_; GHashTable* _tmp22_; GHashTable* _tmp23_; AlmApplicationsChooserDialog* _tmp24_; AlmApplicationsChooserDialog* _tmp25_; g_return_if_fail (self != NULL); gtk_box_set_spacing ((GtkBox*) self, 6); gtk_container_set_border_width ((GtkContainer*) self, (guint) 12); _tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); _tmp1_ = g_object_ref_sink (_tmp0_); _g_object_unref0 (self->priv->container_box); self->priv->container_box = _tmp1_; _tmp2_ = self->priv->app_blacklist; g_signal_connect_object (_tmp2_, "application-removed", (GCallback) ___lambda6__alm_application_blacklist_application_removed, self, 0); _tmp3_ = self->priv->app_blacklist; g_signal_connect_object (_tmp3_, "application-added", (GCallback) ___lambda7__alm_application_blacklist_application_added, self, 0); _tmp4_ = self->priv->app_treeview; gtk_widget_set_visible ((GtkWidget*) _tmp4_, TRUE); _tmp5_ = (GtkToolbar*) gtk_toolbar_new (); _tmp6_ = g_object_ref_sink (_tmp5_); app_toolbar = _tmp6_; g_object_set (app_toolbar, "toolbar-style", GTK_TOOLBAR_ICONS, NULL); gtk_toolbar_set_icon_size (app_toolbar, 1); g_object_set (app_toolbar, "icon-size-set", TRUE, NULL); gtk_widget_set_visible ((GtkWidget*) app_toolbar, TRUE); _tmp7_ = (GtkToolButton*) gtk_tool_button_new (NULL, "Add Application"); _tmp8_ = g_object_ref_sink (_tmp7_); app_add = _tmp8_; gtk_tool_button_set_icon_name (app_add, "list-add-symbolic"); g_signal_connect_object (app_add, "clicked", (GCallback) _alm_applications_widget_app_add_clicked_gtk_tool_button_clicked, self, 0); _tmp9_ = (GtkToolButton*) gtk_tool_button_new (NULL, "Remove Application"); _tmp10_ = g_object_ref_sink (_tmp9_); app_remove = _tmp10_; gtk_tool_button_set_icon_name (app_remove, "list-remove-symbolic"); g_signal_connect_object (app_remove, "clicked", (GCallback) _alm_applications_widget_app_remove_clicked_gtk_tool_button_clicked, self, 0); gtk_toolbar_insert (app_toolbar, (GtkToolItem*) app_add, 0); gtk_toolbar_insert (app_toolbar, (GtkToolItem*) app_remove, 1); _tmp11_ = self->priv->container_box; _tmp12_ = self->priv->app_treeview; gtk_box_pack_start (_tmp11_, (GtkWidget*) _tmp12_, TRUE, TRUE, (guint) 0); _tmp13_ = self->priv->container_box; gtk_box_pack_start (_tmp13_, (GtkWidget*) app_toolbar, FALSE, FALSE, (guint) 0); _tmp14_ = (GtkLabel*) gtk_label_new (NULL); _tmp15_ = g_object_ref_sink (_tmp14_); label = _tmp15_; gtk_label_set_markup (label, "Do not log activity from the following applications:"); gtk_misc_set_alignment ((GtkMisc*) label, (gfloat) 0, 0.5f); gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) label, FALSE, FALSE, (guint) 0); _tmp16_ = self->priv->container_box; gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp16_, TRUE, TRUE, (guint) 0); _tmp17_ = self->priv->app_blacklist; _tmp18_ = alm_application_blacklist_get_all_apps (_tmp17_); _tmp19_ = _tmp18_; _tmp20_ = _g_object_ref0 (_tmp19_); app_list = _tmp20_; alm_applications_widget_populate_view (self, app_list); _tmp21_ = self->priv->app_blacklist; _tmp22_ = self->priv->blocked_list; _tmp23_ = self->priv->unblocked_list; _tmp24_ = alm_applications_chooser_dialog_new (_tmp21_, _tmp22_, _tmp23_); _tmp25_ = g_object_ref_sink (_tmp24_); _g_object_unref0 (self->priv->app_dialog); self->priv->app_dialog = _tmp25_; _g_object_unref0 (app_list); _g_object_unref0 (label); _g_object_unref0 (app_remove); _g_object_unref0 (app_add); _g_object_unref0 (app_toolbar); } static gpointer _alm_app_choose_info_ref0 (gpointer self) { return self ? alm_app_choose_info_ref (self) : NULL; } void alm_applications_widget_app_add_clicked (AlmApplicationsWidget* self, GtkToolButton* button) { AlmApplicationsChooserDialog* _tmp0_; GtkWidget* _tmp1_ = NULL; GtkWidget* _tmp2_ = NULL; FILE* _tmp3_; AlmApplicationsChooserDialog* _tmp4_; gint _tmp5_ = 0; gint res; GtkWidget* _tmp6_ = NULL; gint _tmp7_; AlmApplicationsChooserDialog* _tmp47_; g_return_if_fail (self != NULL); g_return_if_fail (button != NULL); _tmp0_ = self->priv->app_dialog; _tmp1_ = gtk_widget_get_toplevel ((GtkWidget*) self); gtk_window_set_transient_for ((GtkWindow*) _tmp0_, GTK_WINDOW (_tmp1_)); _tmp2_ = gtk_widget_get_toplevel ((GtkWidget*) self); gtk_widget_set_sensitive (_tmp2_, FALSE); _tmp3_ = stdout; fprintf (_tmp3_, "\n\n=============================================\n\n"); _tmp4_ = self->priv->app_dialog; _tmp5_ = gtk_dialog_run ((GtkDialog*) _tmp4_); res = _tmp5_; _tmp6_ = gtk_widget_get_toplevel ((GtkWidget*) self); gtk_widget_set_sensitive (_tmp6_, TRUE); _tmp7_ = res; if (_tmp7_ == ((gint) GTK_RESPONSE_OK)) { AlmApplicationsChooserDialog* _tmp8_; GtkTreeView* _tmp9_; GtkTreeView* _tmp10_; GtkTreeSelection* _tmp11_ = NULL; GtkTreeSelection* _tmp12_; GtkTreeSelection* sel; GtkTreeModel* model = NULL; GtkTreeIter iter = {0}; GtkTreeSelection* _tmp13_; GtkTreeModel* _tmp14_ = NULL; GtkTreeIter _tmp15_ = {0}; GtkTreeModel* _tmp16_; gchar* app = NULL; GtkTreeModel* _tmp17_; GtkTreeIter _tmp18_; AlmApplicationsChooserDialog* _tmp19_; GtkListStore* _tmp20_; GtkListStore* _tmp21_; GtkTreeIter _tmp22_; AlmApplicationsTreeView* _tmp23_; const gchar* _tmp24_; AlmApplicationBlacklist* _tmp25_; const gchar* _tmp26_; GHashTable* _tmp27_; const gchar* _tmp28_; gconstpointer _tmp29_ = NULL; AlmAppChooseInfo* _tmp30_; AlmAppChooseInfo* info; AlmAppChooseInfo* _tmp31_; _tmp8_ = self->priv->app_dialog; _tmp9_ = alm_applications_chooser_dialog_get_tree (_tmp8_); _tmp10_ = _tmp9_; _tmp11_ = gtk_tree_view_get_selection (_tmp10_); _tmp12_ = _g_object_ref0 (_tmp11_); sel = _tmp12_; _tmp13_ = sel; gtk_tree_selection_get_selected (_tmp13_, &_tmp14_, &_tmp15_); _g_object_unref0 (model); _tmp16_ = _g_object_ref0 (_tmp14_); model = _tmp16_; iter = _tmp15_; _tmp17_ = model; _tmp18_ = iter; gtk_tree_model_get (_tmp17_, &_tmp18_, 2, &app, -1); _tmp19_ = self->priv->app_dialog; _tmp20_ = alm_applications_chooser_dialog_get_liststore (_tmp19_); _tmp21_ = _tmp20_; _tmp22_ = iter; gtk_list_store_remove (_tmp21_, &_tmp22_); self->priv->app_change_recursive = TRUE; _tmp23_ = self->priv->app_treeview; _tmp24_ = app; alm_applications_tree_view_add_application_to_view (_tmp23_, _tmp24_); _tmp25_ = self->priv->app_blacklist; _tmp26_ = app; alm_application_blacklist_block (_tmp25_, _tmp26_); _tmp27_ = self->priv->unblocked_list; _tmp28_ = app; _tmp29_ = g_hash_table_lookup (_tmp27_, _tmp28_); _tmp30_ = _alm_app_choose_info_ref0 ((AlmAppChooseInfo*) _tmp29_); info = _tmp30_; _tmp31_ = info; if (_tmp31_ != NULL) { GHashTable* _tmp32_; const gchar* _tmp33_; GHashTable* _tmp34_; const gchar* _tmp35_; gconstpointer _tmp36_ = NULL; _tmp32_ = self->priv->unblocked_list; _tmp33_ = app; g_hash_table_remove (_tmp32_, _tmp33_); _tmp34_ = self->priv->blocked_list; _tmp35_ = app; _tmp36_ = g_hash_table_lookup (_tmp34_, _tmp35_); if (((AlmAppChooseInfo*) _tmp36_) == NULL) { GHashTable* _tmp37_; const gchar* _tmp38_; gchar* _tmp39_; AlmAppChooseInfo* _tmp40_; AlmAppChooseInfo* _tmp41_; _tmp37_ = self->priv->blocked_list; _tmp38_ = app; _tmp39_ = g_strdup (_tmp38_); _tmp40_ = info; _tmp41_ = _alm_app_choose_info_ref0 (_tmp40_); g_hash_table_insert (_tmp37_, _tmp39_, _tmp41_); } else { GHashTable* _tmp42_; const gchar* _tmp43_; gchar* _tmp44_; AlmAppChooseInfo* _tmp45_; AlmAppChooseInfo* _tmp46_; _tmp42_ = self->priv->blocked_list; _tmp43_ = app; _tmp44_ = g_strdup (_tmp43_); _tmp45_ = info; _tmp46_ = _alm_app_choose_info_ref0 (_tmp45_); g_hash_table_replace (_tmp42_, _tmp44_, _tmp46_); } } _alm_app_choose_info_unref0 (info); _g_free0 (app); _g_object_unref0 (model); _g_object_unref0 (sel); } _tmp47_ = self->priv->app_dialog; gtk_widget_hide ((GtkWidget*) _tmp47_); } void alm_applications_widget_app_remove_clicked (AlmApplicationsWidget* self, GtkToolButton* button) { AlmApplicationsTreeView* _tmp0_; gchar* _tmp1_ = NULL; gchar* app; AlmApplicationBlacklist* _tmp2_; const gchar* _tmp3_; GHashTable* _tmp4_; const gchar* _tmp5_; gconstpointer _tmp6_ = NULL; AlmAppChooseInfo* _tmp7_; AlmAppChooseInfo* info; AlmAppChooseInfo* _tmp8_; AlmApplicationsChooserDialog* _tmp24_; const gchar* _tmp25_; g_return_if_fail (self != NULL); g_return_if_fail (button != NULL); self->priv->app_change_recursive = TRUE; _tmp0_ = self->priv->app_treeview; _tmp1_ = alm_applications_tree_view_remove_selected_app (_tmp0_); app = _tmp1_; _tmp2_ = self->priv->app_blacklist; _tmp3_ = app; alm_application_blacklist_unblock (_tmp2_, _tmp3_); _tmp4_ = self->priv->blocked_list; _tmp5_ = app; _tmp6_ = g_hash_table_lookup (_tmp4_, _tmp5_); _tmp7_ = _alm_app_choose_info_ref0 ((AlmAppChooseInfo*) _tmp6_); info = _tmp7_; _tmp8_ = info; if (_tmp8_ != NULL) { GHashTable* _tmp9_; const gchar* _tmp10_; GHashTable* _tmp11_; const gchar* _tmp12_; gconstpointer _tmp13_ = NULL; _tmp9_ = self->priv->blocked_list; _tmp10_ = app; g_hash_table_remove (_tmp9_, _tmp10_); _tmp11_ = self->priv->unblocked_list; _tmp12_ = app; _tmp13_ = g_hash_table_lookup (_tmp11_, _tmp12_); if (((AlmAppChooseInfo*) _tmp13_) == NULL) { GHashTable* _tmp14_; const gchar* _tmp15_; gchar* _tmp16_; AlmAppChooseInfo* _tmp17_; AlmAppChooseInfo* _tmp18_; _tmp14_ = self->priv->unblocked_list; _tmp15_ = app; _tmp16_ = g_strdup (_tmp15_); _tmp17_ = info; _tmp18_ = _alm_app_choose_info_ref0 (_tmp17_); g_hash_table_insert (_tmp14_, _tmp16_, _tmp18_); } else { GHashTable* _tmp19_; const gchar* _tmp20_; gchar* _tmp21_; AlmAppChooseInfo* _tmp22_; AlmAppChooseInfo* _tmp23_; _tmp19_ = self->priv->unblocked_list; _tmp20_ = app; _tmp21_ = g_strdup (_tmp20_); _tmp22_ = info; _tmp23_ = _alm_app_choose_info_ref0 (_tmp22_); g_hash_table_replace (_tmp19_, _tmp21_, _tmp23_); } } _tmp24_ = self->priv->app_dialog; _tmp25_ = app; alm_applications_chooser_dialog_insert_app_liststore (_tmp24_, _tmp25_); _alm_app_choose_info_unref0 (info); _g_free0 (app); } static void alm_applications_widget_populate_view (AlmApplicationsWidget* self, GeeHashSet* app_list) { g_return_if_fail (self != NULL); g_return_if_fail (app_list != NULL); { GeeHashSet* _tmp0_; GeeIterator* _tmp1_ = NULL; GeeIterator* _app_it; _tmp0_ = app_list; _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _tmp0_); _app_it = _tmp1_; while (TRUE) { GeeIterator* _tmp2_; gboolean _tmp3_ = FALSE; GeeIterator* _tmp4_; gpointer _tmp5_ = NULL; gchar* app; AlmApplicationsTreeView* _tmp6_; const gchar* _tmp7_; _tmp2_ = _app_it; _tmp3_ = gee_iterator_next (_tmp2_); if (!_tmp3_) { break; } _tmp4_ = _app_it; _tmp5_ = gee_iterator_get (_tmp4_); app = (gchar*) _tmp5_; _tmp6_ = self->priv->app_treeview; _tmp7_ = app; alm_applications_tree_view_add_application_to_view (_tmp6_, _tmp7_); _g_free0 (app); } _g_object_unref0 (_app_it); } } gchar* alm_applications_widget_markup_for_app (GDesktopAppInfo* app_info) { gchar* result = NULL; GDesktopAppInfo* _tmp0_; const gchar* _tmp1_ = NULL; gchar* _tmp2_; gchar* app_name; GDesktopAppInfo* _tmp3_; const gchar* _tmp4_ = NULL; gchar* _tmp5_; gchar* description; const gchar* _tmp6_ = NULL; const gchar* _tmp7_; const gchar* _tmp9_; gchar* _tmp10_; const gchar* _tmp11_; gchar* _tmp12_ = NULL; gchar* _tmp13_; const gchar* _tmp14_; gchar* _tmp15_ = NULL; gchar* _tmp16_; gchar* _tmp17_ = NULL; gchar* _tmp18_; g_return_val_if_fail (app_info != NULL, NULL); _tmp0_ = app_info; _tmp1_ = g_app_info_get_name ((GAppInfo*) _tmp0_); _tmp2_ = g_strdup (_tmp1_); app_name = _tmp2_; _tmp3_ = app_info; _tmp4_ = g_app_info_get_description ((GAppInfo*) _tmp3_); _tmp5_ = g_strdup (_tmp4_); description = _tmp5_; _tmp7_ = description; if (_tmp7_ != NULL) { const gchar* _tmp8_; _tmp8_ = description; _tmp6_ = _tmp8_; } else { _tmp6_ = "No description available"; } _tmp9_ = _tmp6_; _tmp10_ = g_strdup (_tmp9_); _g_free0 (description); description = _tmp10_; _tmp11_ = app_name; _tmp12_ = g_markup_escape_text (_tmp11_, (gssize) (-1)); _tmp13_ = _tmp12_; _tmp14_ = description; _tmp15_ = g_markup_escape_text (_tmp14_, (gssize) (-1)); _tmp16_ = _tmp15_; _tmp17_ = g_strdup_printf ("%s\n%s", _tmp13_, _tmp16_); _tmp18_ = _tmp17_; _g_free0 (_tmp16_); _g_free0 (_tmp13_); result = _tmp18_; _g_free0 (description); _g_free0 (app_name); return result; } static void alm_applications_widget_class_init (AlmApplicationsWidgetClass * klass) { alm_applications_widget_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (AlmApplicationsWidgetPrivate)); G_OBJECT_CLASS (klass)->finalize = alm_applications_widget_finalize; } static void alm_applications_widget_instance_init (AlmApplicationsWidget * self) { self->priv = ALM_APPLICATIONS_WIDGET_GET_PRIVATE (self); } static void alm_applications_widget_finalize (GObject* obj) { AlmApplicationsWidget * self; self = ALM_APPLICATIONS_WIDGET (obj); _alm_blacklist_unref0 (self->priv->blacklist_interface); _alm_application_blacklist_unref0 (self->priv->app_blacklist); _g_object_unref0 (self->priv->app_dialog); _g_object_unref0 (self->priv->app_treeview); _g_object_unref0 (self->priv->container_box); _g_hash_table_unref0 (self->priv->blocked_list); _g_hash_table_unref0 (self->priv->unblocked_list); G_OBJECT_CLASS (alm_applications_widget_parent_class)->finalize (obj); } GType alm_applications_widget_get_type (void) { static volatile gsize alm_applications_widget_type_id__volatile = 0; if (g_once_init_enter (&alm_applications_widget_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (AlmApplicationsWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_applications_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmApplicationsWidget), 0, (GInstanceInitFunc) alm_applications_widget_instance_init, NULL }; GType alm_applications_widget_type_id; alm_applications_widget_type_id = g_type_register_static (GTK_TYPE_BOX, "AlmApplicationsWidget", &g_define_type_info, 0); g_once_init_leave (&alm_applications_widget_type_id__volatile, alm_applications_widget_type_id); } return alm_applications_widget_type_id__volatile; } static void _alm_application_blacklist_on_blacklist_added_alm_blacklist_template_added (AlmBlacklist* _sender, const gchar* blacklist_id, ZeitgeistEvent* blacklist_template, gpointer self) { alm_application_blacklist_on_blacklist_added (self, blacklist_id, blacklist_template); } static void _alm_application_blacklist_on_blacklist_removed_alm_blacklist_template_removed (AlmBlacklist* _sender, const gchar* blacklist_id, ZeitgeistEvent* blacklist_template, gpointer self) { alm_application_blacklist_on_blacklist_removed (self, blacklist_id, blacklist_template); } AlmApplicationBlacklist* alm_application_blacklist_construct (GType object_type, AlmBlacklist* blacklist) { AlmApplicationBlacklist* self = NULL; AlmBlacklist* _tmp0_; AlmBlacklist* _tmp1_; AlmBlacklist* _tmp2_; AlmBlacklist* _tmp3_; GeeHashSet* _tmp4_ = NULL; GeeHashSet* _tmp5_; g_return_val_if_fail (blacklist != NULL, NULL); self = (AlmApplicationBlacklist*) g_type_create_instance (object_type); _tmp0_ = blacklist; _tmp1_ = _alm_blacklist_ref0 (_tmp0_); _alm_blacklist_unref0 (self->priv->blacklist_interface); self->priv->blacklist_interface = _tmp1_; _tmp2_ = self->priv->blacklist_interface; g_signal_connect (_tmp2_, "template-added", (GCallback) _alm_application_blacklist_on_blacklist_added_alm_blacklist_template_added, self); _tmp3_ = self->priv->blacklist_interface; g_signal_connect (_tmp3_, "template-removed", (GCallback) _alm_application_blacklist_on_blacklist_removed_alm_blacklist_template_removed, self); _tmp4_ = alm_application_blacklist_get_blocked_apps (self); _tmp5_ = _tmp4_; _g_object_unref0 (_tmp5_); return self; } AlmApplicationBlacklist* alm_application_blacklist_new (AlmBlacklist* blacklist) { return alm_application_blacklist_construct (ALM_TYPE_APPLICATION_BLACKLIST, blacklist); } void alm_application_blacklist_get_all_applications (AlmApplicationBlacklist* self, AlmApplicationsChooserDialog* dialog) { AlmBlacklist* _tmp0_; AlmApplicationsChooserDialog* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (dialog != NULL); _tmp0_ = self->priv->blacklist_interface; _tmp1_ = dialog; alm_blacklist_get_all_applications (_tmp0_, _tmp1_); } static glong string_strnlen (gchar* str, glong maxlen) { glong result = 0L; gchar* _tmp0_; glong _tmp1_; gchar* _tmp2_ = NULL; gchar* end; gchar* _tmp3_; _tmp0_ = str; _tmp1_ = maxlen; _tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_); end = _tmp2_; _tmp3_ = end; if (_tmp3_ == NULL) { glong _tmp4_; _tmp4_ = maxlen; result = _tmp4_; return result; } else { gchar* _tmp5_; gchar* _tmp6_; _tmp5_ = end; _tmp6_ = str; result = (glong) (_tmp5_ - _tmp6_); return result; } } static gchar* string_substring (const gchar* self, glong offset, glong len) { gchar* result = NULL; glong string_length = 0L; gboolean _tmp0_ = FALSE; glong _tmp1_; gboolean _tmp3_; glong _tmp9_; glong _tmp15_; glong _tmp18_; glong _tmp19_; glong _tmp20_; glong _tmp21_; glong _tmp22_; gchar* _tmp23_ = NULL; g_return_val_if_fail (self != NULL, NULL); _tmp1_ = offset; if (_tmp1_ >= ((glong) 0)) { glong _tmp2_; _tmp2_ = len; _tmp0_ = _tmp2_ >= ((glong) 0); } else { _tmp0_ = FALSE; } _tmp3_ = _tmp0_; if (_tmp3_) { glong _tmp4_; glong _tmp5_; glong _tmp6_ = 0L; _tmp4_ = offset; _tmp5_ = len; _tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_); string_length = _tmp6_; } else { gint _tmp7_; gint _tmp8_; _tmp7_ = strlen (self); _tmp8_ = _tmp7_; string_length = (glong) _tmp8_; } _tmp9_ = offset; if (_tmp9_ < ((glong) 0)) { glong _tmp10_; glong _tmp11_; glong _tmp12_; _tmp10_ = string_length; _tmp11_ = offset; offset = _tmp10_ + _tmp11_; _tmp12_ = offset; g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL); } else { glong _tmp13_; glong _tmp14_; _tmp13_ = offset; _tmp14_ = string_length; g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL); } _tmp15_ = len; if (_tmp15_ < ((glong) 0)) { glong _tmp16_; glong _tmp17_; _tmp16_ = string_length; _tmp17_ = offset; len = _tmp16_ - _tmp17_; } _tmp18_ = offset; _tmp19_ = len; _tmp20_ = string_length; g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL); _tmp21_ = offset; _tmp22_ = len; _tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_); result = _tmp23_; return result; } static GeeHashSet* alm_application_blacklist_get_blocked_apps (AlmApplicationBlacklist* self) { GeeHashSet* result = NULL; GeeHashSet* _tmp0_; AlmBlacklist* _tmp1_; GHashTable* _tmp2_; GHashTable* _tmp3_; GList* _tmp4_ = NULL; GeeHashSet* _tmp13_; GeeHashSet* _tmp14_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); _g_object_unref0 (self->priv->all_blocked_apps); self->priv->all_blocked_apps = _tmp0_; _tmp1_ = self->priv->blacklist_interface; _tmp2_ = alm_blacklist_get_all_templates (_tmp1_); _tmp3_ = _tmp2_; _tmp4_ = g_hash_table_get_keys (_tmp3_); { GList* key_collection = NULL; GList* key_it = NULL; key_collection = _tmp4_; for (key_it = key_collection; key_it != NULL; key_it = key_it->next) { gchar* _tmp5_; gchar* key = NULL; _tmp5_ = g_strdup ((const gchar*) key_it->data); key = _tmp5_; { const gchar* _tmp6_; const gchar* _tmp7_; gboolean _tmp8_ = FALSE; _tmp6_ = key; _tmp7_ = alm_application_blacklist_interpretation_prefix; _tmp8_ = g_str_has_prefix (_tmp6_, _tmp7_); if (_tmp8_) { const gchar* _tmp9_; gchar* _tmp10_ = NULL; gchar* app; GeeHashSet* _tmp11_; const gchar* _tmp12_; _tmp9_ = key; _tmp10_ = string_substring (_tmp9_, (glong) 4, (glong) (-1)); app = _tmp10_; _tmp11_ = self->priv->all_blocked_apps; _tmp12_ = app; gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, _tmp12_); _g_free0 (app); } _g_free0 (key); } } _g_list_free0 (key_collection); } _tmp13_ = self->priv->all_blocked_apps; _tmp14_ = _g_object_ref0 (_tmp13_); result = _tmp14_; return result; } static void alm_application_blacklist_on_blacklist_added (AlmApplicationBlacklist* self, const gchar* blacklist_id, ZeitgeistEvent* ev) { const gchar* _tmp0_; const gchar* _tmp1_; gboolean _tmp2_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (blacklist_id != NULL); g_return_if_fail (ev != NULL); _tmp0_ = blacklist_id; _tmp1_ = alm_application_blacklist_interpretation_prefix; _tmp2_ = g_str_has_prefix (_tmp0_, _tmp1_); if (_tmp2_) { const gchar* _tmp3_; gchar* _tmp4_ = NULL; gchar* app; const gchar* _tmp5_; ZeitgeistEvent* _tmp6_; GeeHashSet* _tmp7_; GeeHashSet* _tmp8_; const gchar* _tmp9_; gboolean _tmp10_ = FALSE; _tmp3_ = blacklist_id; _tmp4_ = string_substring (_tmp3_, (glong) 4, (glong) (-1)); app = _tmp4_; _tmp5_ = app; _tmp6_ = ev; g_signal_emit_by_name (self, "application-added", _tmp5_, _tmp6_); _tmp7_ = alm_application_blacklist_get_all_apps (self); _tmp8_ = _tmp7_; _tmp9_ = app; _tmp10_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, _tmp9_); if (!_tmp10_) { GeeHashSet* _tmp11_; GeeHashSet* _tmp12_; const gchar* _tmp13_; _tmp11_ = alm_application_blacklist_get_all_apps (self); _tmp12_ = _tmp11_; _tmp13_ = app; gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp13_); } _g_free0 (app); } } static void alm_application_blacklist_on_blacklist_removed (AlmApplicationBlacklist* self, const gchar* blacklist_id, ZeitgeistEvent* ev) { const gchar* _tmp0_; const gchar* _tmp1_; gboolean _tmp2_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (blacklist_id != NULL); g_return_if_fail (ev != NULL); _tmp0_ = blacklist_id; _tmp1_ = alm_application_blacklist_interpretation_prefix; _tmp2_ = g_str_has_prefix (_tmp0_, _tmp1_); if (_tmp2_) { const gchar* _tmp3_; gchar* _tmp4_ = NULL; gchar* app; const gchar* _tmp5_; ZeitgeistEvent* _tmp6_; GeeHashSet* _tmp7_; GeeHashSet* _tmp8_; const gchar* _tmp9_; gboolean _tmp10_ = FALSE; _tmp3_ = blacklist_id; _tmp4_ = string_substring (_tmp3_, (glong) 4, (glong) (-1)); app = _tmp4_; _tmp5_ = app; _tmp6_ = ev; g_signal_emit_by_name (self, "application-removed", _tmp5_, _tmp6_); _tmp7_ = alm_application_blacklist_get_all_apps (self); _tmp8_ = _tmp7_; _tmp9_ = app; _tmp10_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, _tmp9_); if (_tmp10_) { GeeHashSet* _tmp11_; GeeHashSet* _tmp12_; const gchar* _tmp13_; _tmp11_ = alm_application_blacklist_get_all_apps (self); _tmp12_ = _tmp11_; _tmp13_ = app; gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp12_, _tmp13_); } _g_free0 (app); } } void alm_application_blacklist_block (AlmApplicationBlacklist* self, const gchar* application) { ZeitgeistEvent* _tmp0_; ZeitgeistEvent* _tmp1_; ZeitgeistEvent* ev; ZeitgeistEvent* _tmp2_; const gchar* _tmp3_; gchar* _tmp4_ = NULL; gchar* _tmp5_; ZeitgeistSubject* _tmp6_; ZeitgeistSubject* _tmp7_; ZeitgeistSubject* sub; ZeitgeistEvent* _tmp8_; ZeitgeistSubject* _tmp9_; AlmBlacklist* _tmp10_; const gchar* _tmp11_; const gchar* _tmp12_; gchar* _tmp13_ = NULL; gchar* _tmp14_; ZeitgeistEvent* _tmp15_; GeeHashSet* _tmp16_; GeeHashSet* _tmp17_; const gchar* _tmp18_; gboolean _tmp19_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (application != NULL); _tmp0_ = zeitgeist_event_new (); _tmp1_ = g_object_ref_sink (_tmp0_); ev = _tmp1_; _tmp2_ = ev; _tmp3_ = application; _tmp4_ = g_strdup_printf ("application://%s", _tmp3_); _tmp5_ = _tmp4_; zeitgeist_event_set_actor (_tmp2_, _tmp5_); _g_free0 (_tmp5_); _tmp6_ = zeitgeist_subject_new (); _tmp7_ = g_object_ref_sink (_tmp6_); sub = _tmp7_; _tmp8_ = ev; _tmp9_ = sub; zeitgeist_event_add_subject (_tmp8_, _tmp9_); _tmp10_ = self->priv->blacklist_interface; _tmp11_ = alm_application_blacklist_interpretation_prefix; _tmp12_ = application; _tmp13_ = g_strdup_printf ("%s%s", _tmp11_, _tmp12_); _tmp14_ = _tmp13_; _tmp15_ = ev; alm_blacklist_add_template (_tmp10_, _tmp14_, _tmp15_); _g_free0 (_tmp14_); _tmp16_ = alm_application_blacklist_get_all_apps (self); _tmp17_ = _tmp16_; _tmp18_ = application; _tmp19_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp17_, _tmp18_); if (!_tmp19_) { GeeHashSet* _tmp20_; GeeHashSet* _tmp21_; const gchar* _tmp22_; _tmp20_ = alm_application_blacklist_get_all_apps (self); _tmp21_ = _tmp20_; _tmp22_ = application; gee_abstract_collection_add ((GeeAbstractCollection*) _tmp21_, _tmp22_); } _g_object_unref0 (sub); _g_object_unref0 (ev); } void alm_application_blacklist_unblock (AlmApplicationBlacklist* self, const gchar* application) { AlmBlacklist* _tmp0_; const gchar* _tmp1_; const gchar* _tmp2_; gchar* _tmp3_ = NULL; gchar* _tmp4_; GeeHashSet* _tmp5_; GeeHashSet* _tmp6_; const gchar* _tmp7_; gboolean _tmp8_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (application != NULL); _tmp0_ = self->priv->blacklist_interface; _tmp1_ = alm_application_blacklist_interpretation_prefix; _tmp2_ = application; _tmp3_ = g_strdup_printf ("%s%s", _tmp1_, _tmp2_); _tmp4_ = _tmp3_; alm_blacklist_remove_template (_tmp0_, _tmp4_); _g_free0 (_tmp4_); _tmp5_ = alm_application_blacklist_get_all_apps (self); _tmp6_ = _tmp5_; _tmp7_ = application; _tmp8_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp6_, _tmp7_); if (_tmp8_) { GeeHashSet* _tmp9_; GeeHashSet* _tmp10_; const gchar* _tmp11_; _tmp9_ = alm_application_blacklist_get_all_apps (self); _tmp10_ = _tmp9_; _tmp11_ = application; gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp10_, _tmp11_); } } GeeHashSet* alm_application_blacklist_get_all_apps (AlmApplicationBlacklist* self) { GeeHashSet* result; GeeHashSet* _tmp0_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->all_blocked_apps; result = _tmp0_; return result; } static void g_cclosure_user_marshal_VOID__STRING_OBJECT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__STRING_OBJECT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer data2); register GMarshalFunc_VOID__STRING_OBJECT callback; register GCClosure * cc; register gpointer data1; register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = param_values->data[0].v_pointer; } else { data1 = param_values->data[0].v_pointer; data2 = closure->data; } callback = (GMarshalFunc_VOID__STRING_OBJECT) (marshal_data ? marshal_data : cc->callback); callback (data1, g_value_get_string (param_values + 1), g_value_get_object (param_values + 2), data2); } static void alm_value_application_blacklist_init (GValue* value) { value->data[0].v_pointer = NULL; } static void alm_value_application_blacklist_free_value (GValue* value) { if (value->data[0].v_pointer) { alm_application_blacklist_unref (value->data[0].v_pointer); } } static void alm_value_application_blacklist_copy_value (const GValue* src_value, GValue* dest_value) { if (src_value->data[0].v_pointer) { dest_value->data[0].v_pointer = alm_application_blacklist_ref (src_value->data[0].v_pointer); } else { dest_value->data[0].v_pointer = NULL; } } static gpointer alm_value_application_blacklist_peek_pointer (const GValue* value) { return value->data[0].v_pointer; } static gchar* alm_value_application_blacklist_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { if (collect_values[0].v_pointer) { AlmApplicationBlacklist* object; object = collect_values[0].v_pointer; if (object->parent_instance.g_class == NULL) { return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); } value->data[0].v_pointer = alm_application_blacklist_ref (object); } else { value->data[0].v_pointer = NULL; } return NULL; } static gchar* alm_value_application_blacklist_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { AlmApplicationBlacklist** object_p; object_p = collect_values[0].v_pointer; if (!object_p) { return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); } if (!value->data[0].v_pointer) { *object_p = NULL; } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { *object_p = value->data[0].v_pointer; } else { *object_p = alm_application_blacklist_ref (value->data[0].v_pointer); } return NULL; } GParamSpec* alm_param_spec_application_blacklist (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { AlmParamSpecApplicationBlacklist* spec; g_return_val_if_fail (g_type_is_a (object_type, ALM_TYPE_APPLICATION_BLACKLIST), NULL); spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); G_PARAM_SPEC (spec)->value_type = object_type; return G_PARAM_SPEC (spec); } gpointer alm_value_get_application_blacklist (const GValue* value) { g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_APPLICATION_BLACKLIST), NULL); return value->data[0].v_pointer; } void alm_value_set_application_blacklist (GValue* value, gpointer v_object) { AlmApplicationBlacklist* old; g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_APPLICATION_BLACKLIST)); old = value->data[0].v_pointer; if (v_object) { g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_APPLICATION_BLACKLIST)); g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); value->data[0].v_pointer = v_object; alm_application_blacklist_ref (value->data[0].v_pointer); } else { value->data[0].v_pointer = NULL; } if (old) { alm_application_blacklist_unref (old); } } void alm_value_take_application_blacklist (GValue* value, gpointer v_object) { AlmApplicationBlacklist* old; g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_APPLICATION_BLACKLIST)); old = value->data[0].v_pointer; if (v_object) { g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_APPLICATION_BLACKLIST)); g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); value->data[0].v_pointer = v_object; } else { value->data[0].v_pointer = NULL; } if (old) { alm_application_blacklist_unref (old); } } static void alm_application_blacklist_class_init (AlmApplicationBlacklistClass * klass) { gchar* _tmp0_; alm_application_blacklist_parent_class = g_type_class_peek_parent (klass); ALM_APPLICATION_BLACKLIST_CLASS (klass)->finalize = alm_application_blacklist_finalize; g_type_class_add_private (klass, sizeof (AlmApplicationBlacklistPrivate)); g_signal_new ("application_added", ALM_TYPE_APPLICATION_BLACKLIST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_OBJECT, G_TYPE_NONE, 2, G_TYPE_STRING, ZEITGEIST_TYPE_EVENT); g_signal_new ("application_removed", ALM_TYPE_APPLICATION_BLACKLIST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_OBJECT, G_TYPE_NONE, 2, G_TYPE_STRING, ZEITGEIST_TYPE_EVENT); _tmp0_ = g_strdup ("app-"); alm_application_blacklist_interpretation_prefix = _tmp0_; } static void alm_application_blacklist_instance_init (AlmApplicationBlacklist * self) { self->priv = ALM_APPLICATION_BLACKLIST_GET_PRIVATE (self); self->ref_count = 1; } static void alm_application_blacklist_finalize (AlmApplicationBlacklist* obj) { AlmApplicationBlacklist * self; self = ALM_APPLICATION_BLACKLIST (obj); _alm_blacklist_unref0 (self->priv->blacklist_interface); _g_object_unref0 (self->priv->all_blocked_apps); } GType alm_application_blacklist_get_type (void) { static volatile gsize alm_application_blacklist_type_id__volatile = 0; if (g_once_init_enter (&alm_application_blacklist_type_id__volatile)) { static const GTypeValueTable g_define_type_value_table = { alm_value_application_blacklist_init, alm_value_application_blacklist_free_value, alm_value_application_blacklist_copy_value, alm_value_application_blacklist_peek_pointer, "p", alm_value_application_blacklist_collect_value, "p", alm_value_application_blacklist_lcopy_value }; static const GTypeInfo g_define_type_info = { sizeof (AlmApplicationBlacklistClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_application_blacklist_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmApplicationBlacklist), 0, (GInstanceInitFunc) alm_application_blacklist_instance_init, &g_define_type_value_table }; static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; GType alm_application_blacklist_type_id; alm_application_blacklist_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AlmApplicationBlacklist", &g_define_type_info, &g_define_type_fundamental_info, 0); g_once_init_leave (&alm_application_blacklist_type_id__volatile, alm_application_blacklist_type_id); } return alm_application_blacklist_type_id__volatile; } gpointer alm_application_blacklist_ref (gpointer instance) { AlmApplicationBlacklist* self; self = instance; g_atomic_int_inc (&self->ref_count); return instance; } void alm_application_blacklist_unref (gpointer instance) { AlmApplicationBlacklist* self; self = instance; if (g_atomic_int_dec_and_test (&self->ref_count)) { ALM_APPLICATION_BLACKLIST_GET_CLASS (self)->finalize (self); g_type_free_instance ((GTypeInstance *) self); } } static GType alm_applications_tree_view_tree_view_cols_get_type (void) { static volatile gsize alm_applications_tree_view_tree_view_cols_type_id__volatile = 0; if (g_once_init_enter (&alm_applications_tree_view_tree_view_cols_type_id__volatile)) { static const GEnumValue values[] = {{ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_APP_NAME, "ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_APP_NAME", "app-name"}, {ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_ICON, "ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_ICON", "icon"}, {ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_DESKTOP_FILE, "ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_DESKTOP_FILE", "desktop-file"}, {ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_N_COLS, "ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_N_COLS", "n-cols"}, {0, NULL, NULL}}; GType alm_applications_tree_view_tree_view_cols_type_id; alm_applications_tree_view_tree_view_cols_type_id = g_enum_register_static ("AlmApplicationsTreeViewTreeViewCols", values); g_once_init_leave (&alm_applications_tree_view_tree_view_cols_type_id__volatile, alm_applications_tree_view_tree_view_cols_type_id); } return alm_applications_tree_view_tree_view_cols_type_id__volatile; } static gpointer _alm_application_blacklist_ref0 (gpointer self) { return self ? alm_application_blacklist_ref (self) : NULL; } static gpointer _g_hash_table_ref0 (gpointer self) { return self ? g_hash_table_ref (self) : NULL; } AlmApplicationsTreeView* alm_applications_tree_view_construct (GType object_type, AlmApplicationBlacklist* app_blacklist, GHashTable* blocked, GHashTable* unblocked) { AlmApplicationsTreeView * self = NULL; AlmApplicationBlacklist* _tmp0_; AlmApplicationBlacklist* _tmp1_; GHashTable* _tmp2_; GHashTable* _tmp3_; GHashTable* _tmp4_; GHashTable* _tmp5_; GtkListStore* _tmp6_; GtkListStore* _tmp7_; GtkTreeView* _tmp8_; GtkTreeView* _tmp9_; GtkTreeView* _tmp10_; GtkTreeView* _tmp11_; g_return_val_if_fail (app_blacklist != NULL, NULL); g_return_val_if_fail (blocked != NULL, NULL); g_return_val_if_fail (unblocked != NULL, NULL); self = (AlmApplicationsTreeView*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, NULL); _tmp0_ = app_blacklist; _tmp1_ = _alm_application_blacklist_ref0 (_tmp0_); _alm_application_blacklist_unref0 (self->priv->app_blacklist); self->priv->app_blacklist = _tmp1_; _tmp2_ = blocked; _tmp3_ = _g_hash_table_ref0 (_tmp2_); _g_hash_table_unref0 (self->priv->blocked_apps); self->priv->blocked_apps = _tmp3_; _tmp4_ = unblocked; _tmp5_ = _g_hash_table_ref0 (_tmp4_); _g_hash_table_unref0 (self->priv->unblocked_apps); self->priv->unblocked_apps = _tmp5_; _tmp6_ = gtk_list_store_new ((gint) ALM_APPLICATIONS_TREE_VIEW_TREE_VIEW_COLS_N_COLS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING); _g_object_unref0 (self->priv->store); self->priv->store = _tmp6_; _tmp7_ = self->priv->store; _tmp8_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) _tmp7_); _tmp9_ = g_object_ref_sink (_tmp8_); _g_object_unref0 (self->priv->treeview); self->priv->treeview = _tmp9_; _tmp10_ = self->priv->treeview; gtk_tree_view_set_headers_visible (_tmp10_, FALSE); _tmp11_ = self->priv->treeview; gtk_tree_view_set_rules_hint (_tmp11_, TRUE); alm_applications_tree_view_set_up_ui (self); return self; } AlmApplicationsTreeView* alm_applications_tree_view_new (AlmApplicationBlacklist* app_blacklist, GHashTable* blocked, GHashTable* unblocked) { return alm_applications_tree_view_construct (ALM_TYPE_APPLICATIONS_TREE_VIEW, app_blacklist, blocked, unblocked); } static void alm_applications_tree_view_set_up_ui (AlmApplicationsTreeView* self) { GtkTreeViewColumn* _tmp0_; GtkTreeViewColumn* _tmp1_; GtkTreeViewColumn* column_pix_name; GtkTreeView* _tmp2_; GtkCellRendererPixbuf* _tmp3_; GtkCellRendererPixbuf* _tmp4_; GtkCellRendererPixbuf* pix_rend; GtkCellRendererText* _tmp5_; GtkCellRendererText* _tmp6_; GtkCellRendererText* name_rend; GValue _tmp7_ = {0}; GtkScrolledWindow* _tmp8_; GtkScrolledWindow* _tmp9_; GtkScrolledWindow* scroll; GtkTreeView* _tmp10_; g_return_if_fail (self != NULL); _tmp0_ = gtk_tree_view_column_new (); _tmp1_ = g_object_ref_sink (_tmp0_); column_pix_name = _tmp1_; gtk_tree_view_column_set_title (column_pix_name, "Name"); _tmp2_ = self->priv->treeview; gtk_tree_view_append_column (_tmp2_, column_pix_name); _tmp3_ = (GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new (); _tmp4_ = g_object_ref_sink (_tmp3_); pix_rend = _tmp4_; gtk_cell_layout_pack_start ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) pix_rend, FALSE); gtk_cell_layout_add_attribute ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) pix_rend, "pixbuf", 1); _tmp5_ = (GtkCellRendererText*) gtk_cell_renderer_text_new (); _tmp6_ = g_object_ref_sink (_tmp5_); name_rend = _tmp6_; g_value_init (&_tmp7_, PANGO_TYPE_ELLIPSIZE_MODE); g_value_set_enum (&_tmp7_, PANGO_ELLIPSIZE_END); g_object_set_property ((GObject*) name_rend, "ellipsize", &_tmp7_); G_IS_VALUE (&_tmp7_) ? (g_value_unset (&_tmp7_), NULL) : NULL; gtk_cell_layout_pack_start ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) name_rend, TRUE); gtk_cell_layout_add_attribute ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) name_rend, "markup", 0); gtk_tree_view_column_set_resizable (column_pix_name, TRUE); _tmp8_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL); _tmp9_ = g_object_ref_sink (_tmp8_); scroll = _tmp9_; _tmp10_ = self->priv->treeview; gtk_container_add ((GtkContainer*) scroll, (GtkWidget*) _tmp10_); gtk_scrolled_window_set_policy (scroll, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (scroll, GTK_SHADOW_IN); gtk_container_set_border_width ((GtkContainer*) scroll, (guint) 1); gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) scroll, TRUE, TRUE, (guint) 0); _g_object_unref0 (scroll); _g_object_unref0 (name_rend); _g_object_unref0 (pix_rend); _g_object_unref0 (column_pix_name); } GdkPixbuf* alm_applications_tree_view_get_pixbuf_from_gio_icon (GIcon* icon) { GdkPixbuf* result = NULL; GdkPixbuf* pix; GtkIconTheme* _tmp0_; GIcon* _tmp1_; GtkIconInfo* _tmp2_ = NULL; GtkIconInfo* icon_info; GtkIconInfo* _tmp3_; GError * _inner_error_ = NULL; g_return_val_if_fail (icon != NULL, NULL); pix = NULL; _tmp0_ = alm_applications_tree_view_icon_theme; _tmp1_ = icon; _tmp2_ = gtk_icon_theme_lookup_by_gicon (_tmp0_, _tmp1_, 32, GTK_ICON_LOOKUP_FORCE_SVG); icon_info = _tmp2_; _tmp3_ = icon_info; if (_tmp3_ != NULL) { { GtkIconInfo* _tmp4_; GdkPixbuf* _tmp5_ = NULL; GdkPixbuf* _tmp6_; _tmp4_ = icon_info; _tmp5_ = gtk_icon_info_load_icon (_tmp4_, &_inner_error_); _tmp6_ = _tmp5_; if (_inner_error_ != NULL) { goto __catch3_g_error; } _g_object_unref0 (pix); pix = _tmp6_; } goto __finally3; __catch3_g_error: { GError* e = NULL; e = _inner_error_; _inner_error_ = NULL; result = NULL; _g_error_free0 (e); _gtk_icon_info_free0 (icon_info); _g_object_unref0 (pix); return result; } __finally3: if (_inner_error_ != NULL) { _gtk_icon_info_free0 (icon_info); _g_object_unref0 (pix); 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; } } result = pix; _gtk_icon_info_free0 (icon_info); return result; } void alm_applications_tree_view_add_application_to_view (AlmApplicationsTreeView* self, const gchar* app) { const gchar* _tmp0_; GDesktopAppInfo* _tmp1_; GDesktopAppInfo* app_info; GDesktopAppInfo* _tmp2_; g_return_if_fail (self != NULL); g_return_if_fail (app != NULL); _tmp0_ = app; _tmp1_ = g_desktop_app_info_new (_tmp0_); app_info = _tmp1_; _tmp2_ = app_info; if (_tmp2_ != NULL) { GDesktopAppInfo* _tmp3_; GIcon* _tmp4_ = NULL; GdkPixbuf* _tmp5_ = NULL; GdkPixbuf* pix; GDesktopAppInfo* _tmp6_; gchar* _tmp7_ = NULL; gchar* markup; GtkTreeIter iter = {0}; GtkListStore* _tmp8_; GtkListStore* _tmp9_; GtkTreeIter _tmp10_ = {0}; GtkListStore* _tmp11_; GtkListStore* _tmp12_; GtkTreeIter _tmp13_; const gchar* _tmp14_; GdkPixbuf* _tmp15_; const gchar* _tmp16_; GHashTable* _tmp17_; const gchar* _tmp18_; gconstpointer _tmp19_ = NULL; _tmp3_ = app_info; _tmp4_ = g_app_info_get_icon ((GAppInfo*) _tmp3_); _tmp5_ = alm_applications_tree_view_get_pixbuf_from_gio_icon (_tmp4_); pix = _tmp5_; _tmp6_ = app_info; _tmp7_ = alm_applications_widget_markup_for_app (_tmp6_); markup = _tmp7_; _tmp8_ = alm_applications_tree_view_get_liststore (self); _tmp9_ = _tmp8_; gtk_list_store_append (_tmp9_, &_tmp10_); iter = _tmp10_; _tmp11_ = alm_applications_tree_view_get_liststore (self); _tmp12_ = _tmp11_; _tmp13_ = iter; _tmp14_ = markup; _tmp15_ = pix; _tmp16_ = app; gtk_list_store_set (_tmp12_, &_tmp13_, 0, _tmp14_, 1, _tmp15_, 2, _tmp16_, -1, -1); _tmp17_ = self->priv->blocked_apps; _tmp18_ = app; _tmp19_ = g_hash_table_lookup (_tmp17_, _tmp18_); if (((AlmAppChooseInfo*) _tmp19_) == NULL) { GHashTable* _tmp20_; const gchar* _tmp21_; gchar* _tmp22_; GDesktopAppInfo* _tmp23_; const gchar* _tmp24_ = NULL; GdkPixbuf* _tmp25_; AlmAppChooseInfo* _tmp26_; _tmp20_ = self->priv->blocked_apps; _tmp21_ = app; _tmp22_ = g_strdup (_tmp21_); _tmp23_ = app_info; _tmp24_ = g_app_info_get_name ((GAppInfo*) _tmp23_); _tmp25_ = pix; _tmp26_ = alm_app_choose_info_new (_tmp24_, _tmp25_, "", (guint) 0); g_hash_table_insert (_tmp20_, _tmp22_, _tmp26_); } _g_free0 (markup); _g_object_unref0 (pix); } _g_object_unref0 (app_info); } void alm_applications_tree_view_remove_app_from_view (AlmApplicationsTreeView* self, const gchar* app) { GtkTreeView* _tmp0_; GtkTreeModel* _tmp1_ = NULL; GtkTreeModel* _tmp2_; GtkTreeModel* model; GtkTreeIter iter = {0}; GtkTreeModel* _tmp3_; GtkTreeIter _tmp4_ = {0}; g_return_if_fail (self != NULL); g_return_if_fail (app != NULL); _tmp0_ = self->priv->treeview; _tmp1_ = gtk_tree_view_get_model (_tmp0_); _tmp2_ = _g_object_ref0 (_tmp1_); model = _tmp2_; _tmp3_ = model; gtk_tree_model_get_iter_first (_tmp3_, &_tmp4_); iter = _tmp4_; while (TRUE) { GValue can_app_value = {0}; GtkTreeModel* _tmp5_; GtkTreeIter _tmp6_; GValue _tmp7_ = {0}; const gchar* _tmp8_ = NULL; gchar* _tmp9_; gchar* can_app; const gchar* _tmp10_; const gchar* _tmp11_; GtkTreeModel* _tmp14_; gboolean _tmp15_ = FALSE; gboolean more_entires; gboolean _tmp16_; _tmp5_ = model; _tmp6_ = iter; gtk_tree_model_get_value (_tmp5_, &_tmp6_, 2, &_tmp7_); G_IS_VALUE (&can_app_value) ? (g_value_unset (&can_app_value), NULL) : NULL; can_app_value = _tmp7_; _tmp8_ = g_value_get_string (&can_app_value); _tmp9_ = g_strdup (_tmp8_); can_app = _tmp9_; _tmp10_ = app; _tmp11_ = can_app; if (g_strcmp0 (_tmp10_, _tmp11_) == 0) { GtkListStore* _tmp12_; GtkTreeIter _tmp13_; _tmp12_ = self->priv->store; _tmp13_ = iter; gtk_list_store_remove (_tmp12_, &_tmp13_); _g_free0 (can_app); G_IS_VALUE (&can_app_value) ? (g_value_unset (&can_app_value), NULL) : NULL; break; } _tmp14_ = model; _tmp15_ = gtk_tree_model_iter_next (_tmp14_, &iter); more_entires = _tmp15_; _tmp16_ = more_entires; if (!_tmp16_) { _g_free0 (can_app); G_IS_VALUE (&can_app_value) ? (g_value_unset (&can_app_value), NULL) : NULL; break; } _g_free0 (can_app); G_IS_VALUE (&can_app_value) ? (g_value_unset (&can_app_value), NULL) : NULL; } _g_object_unref0 (model); } gchar* alm_applications_tree_view_remove_selected_app (AlmApplicationsTreeView* self) { gchar* result = NULL; GtkTreeView* _tmp0_; GtkTreeSelection* _tmp1_ = NULL; GtkTreeSelection* _tmp2_; GtkTreeSelection* selection; GtkTreeModel* model = NULL; GtkTreeIter iter = {0}; gchar* app; GtkTreeSelection* _tmp3_; GtkTreeModel* _tmp4_ = NULL; GtkTreeIter _tmp5_ = {0}; gboolean _tmp6_ = FALSE; GtkTreeModel* _tmp7_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->treeview; _tmp1_ = gtk_tree_view_get_selection (_tmp0_); _tmp2_ = _g_object_ref0 (_tmp1_); selection = _tmp2_; app = NULL; _tmp3_ = selection; _tmp6_ = gtk_tree_selection_get_selected (_tmp3_, &_tmp4_, &_tmp5_); _g_object_unref0 (model); _tmp7_ = _g_object_ref0 (_tmp4_); model = _tmp7_; iter = _tmp5_; if (_tmp6_) { GtkTreeModel* _tmp8_; GtkTreeIter _tmp9_; GtkListStore* _tmp10_; GtkListStore* _tmp11_; GtkTreeIter _tmp12_; _tmp8_ = model; _tmp9_ = iter; gtk_tree_model_get (_tmp8_, &_tmp9_, 2, &app, -1); _tmp10_ = alm_applications_tree_view_get_liststore (self); _tmp11_ = _tmp10_; _tmp12_ = iter; gtk_list_store_remove (_tmp11_, &_tmp12_); } result = app; _g_object_unref0 (model); _g_object_unref0 (selection); return result; } GtkListStore* alm_applications_tree_view_get_liststore (AlmApplicationsTreeView* self) { GtkListStore* result; GtkListStore* _tmp0_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->store; result = _tmp0_; return result; } static void alm_applications_tree_view_class_init (AlmApplicationsTreeViewClass * klass) { GtkIconTheme* _tmp0_ = NULL; GtkIconTheme* _tmp1_; alm_applications_tree_view_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (AlmApplicationsTreeViewPrivate)); G_OBJECT_CLASS (klass)->get_property = _vala_alm_applications_tree_view_get_property; G_OBJECT_CLASS (klass)->finalize = alm_applications_tree_view_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), ALM_APPLICATIONS_TREE_VIEW_LISTSTORE, g_param_spec_object ("liststore", "liststore", "liststore", GTK_TYPE_LIST_STORE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); _tmp0_ = gtk_icon_theme_get_default (); _tmp1_ = _g_object_ref0 (_tmp0_); alm_applications_tree_view_icon_theme = _tmp1_; } static void alm_applications_tree_view_instance_init (AlmApplicationsTreeView * self) { self->priv = ALM_APPLICATIONS_TREE_VIEW_GET_PRIVATE (self); } static void alm_applications_tree_view_finalize (GObject* obj) { AlmApplicationsTreeView * self; self = ALM_APPLICATIONS_TREE_VIEW (obj); _alm_application_blacklist_unref0 (self->priv->app_blacklist); _g_object_unref0 (self->priv->store); _g_object_unref0 (self->priv->treeview); _g_hash_table_unref0 (self->priv->blocked_apps); _g_hash_table_unref0 (self->priv->unblocked_apps); G_OBJECT_CLASS (alm_applications_tree_view_parent_class)->finalize (obj); } GType alm_applications_tree_view_get_type (void) { static volatile gsize alm_applications_tree_view_type_id__volatile = 0; if (g_once_init_enter (&alm_applications_tree_view_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (AlmApplicationsTreeViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_applications_tree_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmApplicationsTreeView), 0, (GInstanceInitFunc) alm_applications_tree_view_instance_init, NULL }; GType alm_applications_tree_view_type_id; alm_applications_tree_view_type_id = g_type_register_static (GTK_TYPE_BOX, "AlmApplicationsTreeView", &g_define_type_info, 0); g_once_init_leave (&alm_applications_tree_view_type_id__volatile, alm_applications_tree_view_type_id); } return alm_applications_tree_view_type_id__volatile; } static void _vala_alm_applications_tree_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { AlmApplicationsTreeView * self; self = ALM_APPLICATIONS_TREE_VIEW (object); switch (property_id) { case ALM_APPLICATIONS_TREE_VIEW_LISTSTORE: g_value_set_object (value, alm_applications_tree_view_get_liststore (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static GType alm_app_selection_tree_view_tree_view_cols_get_type (void) { static volatile gsize alm_app_selection_tree_view_tree_view_cols_type_id__volatile = 0; if (g_once_init_enter (&alm_app_selection_tree_view_tree_view_cols_type_id__volatile)) { static const GEnumValue values[] = {{ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_APP_NAME, "ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_APP_NAME", "app-name"}, {ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_ICON, "ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_ICON", "icon"}, {ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_DESKTOP_FILE, "ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_DESKTOP_FILE", "desktop-file"}, {ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_N_COLS, "ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_N_COLS", "n-cols"}, {0, NULL, NULL}}; GType alm_app_selection_tree_view_tree_view_cols_type_id; alm_app_selection_tree_view_tree_view_cols_type_id = g_enum_register_static ("AlmAppSelectionTreeViewTreeViewCols", values); g_once_init_leave (&alm_app_selection_tree_view_tree_view_cols_type_id__volatile, alm_app_selection_tree_view_tree_view_cols_type_id); } return alm_app_selection_tree_view_tree_view_cols_type_id__volatile; } AlmAppSelectionTreeView* alm_app_selection_tree_view_construct (GType object_type, AlmApplicationBlacklist* app_blacklist) { AlmAppSelectionTreeView * self = NULL; AlmApplicationBlacklist* _tmp0_; AlmApplicationBlacklist* _tmp1_; GtkListStore* _tmp2_; GtkListStore* _tmp3_; GtkTreeView* _tmp4_; GtkTreeView* _tmp5_; GtkTreeView* _tmp6_; GtkTreeView* _tmp7_; g_return_val_if_fail (app_blacklist != NULL, NULL); self = (AlmAppSelectionTreeView*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, NULL); _tmp0_ = app_blacklist; _tmp1_ = _alm_application_blacklist_ref0 (_tmp0_); _alm_application_blacklist_unref0 (self->priv->app_blacklist); self->priv->app_blacklist = _tmp1_; _tmp2_ = gtk_list_store_new ((gint) ALM_APP_SELECTION_TREE_VIEW_TREE_VIEW_COLS_N_COLS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); _g_object_unref0 (self->priv->store); self->priv->store = _tmp2_; _tmp3_ = self->priv->store; _tmp4_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) _tmp3_); _tmp5_ = g_object_ref_sink (_tmp4_); _g_object_unref0 (self->priv->treeview); self->priv->treeview = _tmp5_; _tmp6_ = self->priv->treeview; gtk_tree_view_set_headers_visible (_tmp6_, TRUE); _tmp7_ = self->priv->treeview; gtk_tree_view_set_rules_hint (_tmp7_, TRUE); alm_app_selection_tree_view_set_up_ui (self); return self; } AlmAppSelectionTreeView* alm_app_selection_tree_view_new (AlmApplicationBlacklist* app_blacklist) { return alm_app_selection_tree_view_construct (ALM_TYPE_APP_SELECTION_TREE_VIEW, app_blacklist); } static void alm_app_selection_tree_view_set_up_ui (AlmAppSelectionTreeView* self) { GtkTreeViewColumn* _tmp0_; GtkTreeViewColumn* _tmp1_; GtkTreeViewColumn* column_pix_name; GtkTreeView* _tmp2_; GtkCellRendererPixbuf* _tmp3_; GtkCellRendererPixbuf* _tmp4_; GtkCellRendererPixbuf* pix_rend; GtkCellRendererText* _tmp5_; GtkCellRendererText* _tmp6_; GtkCellRendererText* name_rend; GValue _tmp7_ = {0}; GtkScrolledWindow* _tmp8_; GtkScrolledWindow* _tmp9_; GtkScrolledWindow* scroll; GtkTreeView* _tmp10_; g_return_if_fail (self != NULL); _tmp0_ = gtk_tree_view_column_new (); _tmp1_ = g_object_ref_sink (_tmp0_); column_pix_name = _tmp1_; gtk_tree_view_column_set_title (column_pix_name, "Name"); _tmp2_ = self->priv->treeview; gtk_tree_view_append_column (_tmp2_, column_pix_name); _tmp3_ = (GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new (); _tmp4_ = g_object_ref_sink (_tmp3_); pix_rend = _tmp4_; gtk_cell_layout_pack_start ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) pix_rend, FALSE); gtk_cell_layout_add_attribute ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) pix_rend, "pixbuf", 1); _tmp5_ = (GtkCellRendererText*) gtk_cell_renderer_text_new (); _tmp6_ = g_object_ref_sink (_tmp5_); name_rend = _tmp6_; g_value_init (&_tmp7_, PANGO_TYPE_ELLIPSIZE_MODE); g_value_set_enum (&_tmp7_, PANGO_ELLIPSIZE_END); g_object_set_property ((GObject*) name_rend, "ellipsize", &_tmp7_); G_IS_VALUE (&_tmp7_) ? (g_value_unset (&_tmp7_), NULL) : NULL; gtk_cell_layout_pack_start ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) name_rend, TRUE); gtk_cell_layout_add_attribute ((GtkCellLayout*) column_pix_name, (GtkCellRenderer*) name_rend, "markup", 0); gtk_tree_view_column_set_resizable (column_pix_name, TRUE); _tmp8_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL); _tmp9_ = g_object_ref_sink (_tmp8_); scroll = _tmp9_; _tmp10_ = self->priv->treeview; gtk_container_add ((GtkContainer*) scroll, (GtkWidget*) _tmp10_); gtk_scrolled_window_set_policy (scroll, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (scroll, GTK_SHADOW_IN); gtk_container_set_border_width ((GtkContainer*) scroll, (guint) 1); gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) scroll, TRUE, TRUE, (guint) 0); _g_object_unref0 (scroll); _g_object_unref0 (name_rend); _g_object_unref0 (pix_rend); _g_object_unref0 (column_pix_name); } GtkTreeView* alm_app_selection_tree_view_get_tree (AlmAppSelectionTreeView* self) { GtkTreeView* result; GtkTreeView* _tmp0_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->treeview; result = _tmp0_; return result; } GtkListStore* alm_app_selection_tree_view_get_liststore (AlmAppSelectionTreeView* self) { GtkListStore* result; GtkListStore* _tmp0_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->store; result = _tmp0_; return result; } static void alm_app_selection_tree_view_class_init (AlmAppSelectionTreeViewClass * klass) { alm_app_selection_tree_view_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (AlmAppSelectionTreeViewPrivate)); G_OBJECT_CLASS (klass)->get_property = _vala_alm_app_selection_tree_view_get_property; G_OBJECT_CLASS (klass)->finalize = alm_app_selection_tree_view_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), ALM_APP_SELECTION_TREE_VIEW_TREE, g_param_spec_object ("tree", "tree", "tree", GTK_TYPE_TREE_VIEW, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ALM_APP_SELECTION_TREE_VIEW_LISTSTORE, g_param_spec_object ("liststore", "liststore", "liststore", GTK_TYPE_LIST_STORE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); } static void alm_app_selection_tree_view_instance_init (AlmAppSelectionTreeView * self) { self->priv = ALM_APP_SELECTION_TREE_VIEW_GET_PRIVATE (self); } static void alm_app_selection_tree_view_finalize (GObject* obj) { AlmAppSelectionTreeView * self; self = ALM_APP_SELECTION_TREE_VIEW (obj); _alm_application_blacklist_unref0 (self->priv->app_blacklist); _g_object_unref0 (self->priv->store); _g_object_unref0 (self->priv->treeview); G_OBJECT_CLASS (alm_app_selection_tree_view_parent_class)->finalize (obj); } GType alm_app_selection_tree_view_get_type (void) { static volatile gsize alm_app_selection_tree_view_type_id__volatile = 0; if (g_once_init_enter (&alm_app_selection_tree_view_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (AlmAppSelectionTreeViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_app_selection_tree_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmAppSelectionTreeView), 0, (GInstanceInitFunc) alm_app_selection_tree_view_instance_init, NULL }; GType alm_app_selection_tree_view_type_id; alm_app_selection_tree_view_type_id = g_type_register_static (GTK_TYPE_BOX, "AlmAppSelectionTreeView", &g_define_type_info, 0); g_once_init_leave (&alm_app_selection_tree_view_type_id__volatile, alm_app_selection_tree_view_type_id); } return alm_app_selection_tree_view_type_id__volatile; } static void _vala_alm_app_selection_tree_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { AlmAppSelectionTreeView * self; self = ALM_APP_SELECTION_TREE_VIEW (object); switch (property_id) { case ALM_APP_SELECTION_TREE_VIEW_TREE: g_value_set_object (value, alm_app_selection_tree_view_get_tree (self)); break; case ALM_APP_SELECTION_TREE_VIEW_LISTSTORE: g_value_set_object (value, alm_app_selection_tree_view_get_liststore (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } AlmApplicationsChooserDialog* alm_applications_chooser_dialog_construct (GType object_type, AlmApplicationBlacklist* app_blacklist, GHashTable* blocked_list, GHashTable* unblocked_list) { AlmApplicationsChooserDialog * self = NULL; AlmApplicationBlacklist* _tmp0_; AlmApplicationBlacklist* _tmp1_; GHashTable* _tmp2_; GHashTable* _tmp3_; GHashTable* _tmp4_; GHashTable* _tmp5_; AlmApplicationBlacklist* _tmp6_; g_return_val_if_fail (app_blacklist != NULL, NULL); g_return_val_if_fail (blocked_list != NULL, NULL); g_return_val_if_fail (unblocked_list != NULL, NULL); self = (AlmApplicationsChooserDialog*) g_object_new (object_type, NULL); _tmp0_ = app_blacklist; _tmp1_ = _alm_application_blacklist_ref0 (_tmp0_); _alm_application_blacklist_unref0 (self->priv->app_blacklist); self->priv->app_blacklist = _tmp1_; _tmp2_ = blocked_list; _tmp3_ = _g_hash_table_ref0 (_tmp2_); _g_hash_table_unref0 (self->priv->blocked_apps); self->priv->blocked_apps = _tmp3_; _tmp4_ = unblocked_list; _tmp5_ = _g_hash_table_ref0 (_tmp4_); _g_hash_table_unref0 (self->priv->unblocked_apps); self->priv->unblocked_apps = _tmp5_; gtk_window_set_title ((GtkWindow*) self, "Select Application"); gtk_window_set_destroy_with_parent ((GtkWindow*) self, TRUE); gtk_widget_set_size_request ((GtkWidget*) self, 600, 400); gtk_window_set_skip_taskbar_hint ((GtkWindow*) self, TRUE); gtk_container_set_border_width ((GtkContainer*) self, (guint) 12); gtk_window_set_resizable ((GtkWindow*) self, FALSE); alm_applications_chooser_dialog_set_up_ui (self); _tmp6_ = self->priv->app_blacklist; alm_application_blacklist_get_all_applications (_tmp6_, self); return self; } AlmApplicationsChooserDialog* alm_applications_chooser_dialog_new (AlmApplicationBlacklist* app_blacklist, GHashTable* blocked_list, GHashTable* unblocked_list) { return alm_applications_chooser_dialog_construct (ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, app_blacklist, blocked_list, unblocked_list); } static gint64* _int64_dup (gint64* self) { gint64* dup; dup = g_new0 (gint64, 1); memcpy (dup, self, sizeof (gint64)); return dup; } static gpointer __int64_dup0 (gpointer self) { return self ? _int64_dup (self) : NULL; } static void _g_object_unref0_ (gpointer var) { (var == NULL) ? NULL : (var = (g_object_unref (var), NULL)); } static void _g_list_free__g_object_unref0_ (GList* self) { g_list_foreach (self, (GFunc) _g_object_unref0_, NULL); g_list_free (self); } void alm_applications_chooser_dialog_handle_app_population (AlmApplicationsChooserDialog* self, GHashTable* all_actors) { GHashTable* _tmp0_; GHashTable* _tmp1_; GList* _tmp2_ = NULL; GList* all_infos; GHashTable* _tmp3_; guint _tmp4_ = 0U; guint size_actors; gfloat current_state; gfloat _tmp5_; guint _tmp6_; gfloat step_dec; GList* other_appinfo; GList* _tmp7_; GList* _tmp30_; g_return_if_fail (self != NULL); g_return_if_fail (all_actors != NULL); _tmp0_ = all_actors; _tmp1_ = _g_hash_table_ref0 (_tmp0_); _g_hash_table_unref0 (self->priv->all_actors_list); self->priv->all_actors_list = _tmp1_; _tmp2_ = g_app_info_get_all (); all_infos = _tmp2_; _tmp3_ = all_actors; _tmp4_ = g_hash_table_size (_tmp3_); size_actors = _tmp4_; current_state = (gfloat) 10; _tmp5_ = current_state; _tmp6_ = size_actors; step_dec = _tmp5_ / _tmp6_; other_appinfo = NULL; _tmp7_ = all_infos; { GList* app_info_collection = NULL; GList* app_info_it = NULL; app_info_collection = _tmp7_; for (app_info_it = app_info_collection; app_info_it != NULL; app_info_it = app_info_it->next) { GAppInfo* _tmp8_; GAppInfo* app_info = NULL; _tmp8_ = _g_object_ref0 ((GAppInfo*) app_info_it->data); app_info = _tmp8_; { GAppInfo* _tmp9_; const gchar* _tmp10_ = NULL; gchar* _tmp11_; gchar* id; GHashTable* _tmp12_; const gchar* _tmp13_; gconstpointer _tmp14_ = NULL; gint64* _tmp15_; gint64* last_accessed_time; gint64* _tmp16_; _tmp9_ = app_info; _tmp10_ = g_app_info_get_id (_tmp9_); _tmp11_ = g_strdup (_tmp10_); id = _tmp11_; _tmp12_ = all_actors; _tmp13_ = id; _tmp14_ = g_hash_table_lookup (_tmp12_, _tmp13_); _tmp15_ = __int64_dup0 ((gint64*) _tmp14_); last_accessed_time = _tmp15_; _tmp16_ = last_accessed_time; if (_tmp16_ != NULL) { gint64* _tmp17_; GDateTime* _tmp18_; GDateTime* time; GDateTime* _tmp19_; gchar* _tmp20_ = NULL; gchar* last_accessed; gfloat _tmp21_; gdouble _tmp22_ = 0.0; guint usage; gfloat _tmp23_; gfloat _tmp24_; GAppInfo* _tmp25_; const gchar* _tmp26_; guint _tmp27_; _tmp17_ = last_accessed_time; _tmp18_ = g_date_time_new_from_unix_local ((*_tmp17_) / 1000); time = _tmp18_; _tmp19_ = time; _tmp20_ = g_date_time_format (_tmp19_, "%e %B %Y %R"); last_accessed = _tmp20_; _tmp21_ = current_state; _tmp22_ = ceil ((gdouble) _tmp21_); usage = (guint) _tmp22_; _tmp23_ = current_state; _tmp24_ = step_dec; current_state = _tmp23_ - _tmp24_; _tmp25_ = app_info; _tmp26_ = last_accessed; _tmp27_ = usage; alm_applications_chooser_dialog_insert_liststore (self, _tmp25_, _tmp26_, _tmp27_); _g_free0 (last_accessed); _g_date_time_unref0 (time); } else { GAppInfo* _tmp28_; GAppInfo* _tmp29_; _tmp28_ = app_info; _tmp29_ = _g_object_ref0 (_tmp28_); other_appinfo = g_list_append (other_appinfo, _tmp29_); } _g_free0 (last_accessed_time); _g_free0 (id); _g_object_unref0 (app_info); } } } _tmp30_ = other_appinfo; { GList* app_info_collection = NULL; GList* app_info_it = NULL; app_info_collection = _tmp30_; for (app_info_it = app_info_collection; app_info_it != NULL; app_info_it = app_info_it->next) { GAppInfo* _tmp31_; GAppInfo* app_info = NULL; _tmp31_ = _g_object_ref0 ((GAppInfo*) app_info_it->data); app_info = _tmp31_; { GAppInfo* _tmp32_; _tmp32_ = app_info; alm_applications_chooser_dialog_insert_liststore (self, _tmp32_, "", (guint) 0); _g_object_unref0 (app_info); } } } __g_list_free__g_object_unref0_0 (other_appinfo); __g_list_free__g_object_unref0_0 (all_infos); } void alm_applications_chooser_dialog_insert_liststore (AlmApplicationsChooserDialog* self, GAppInfo* app_info, const gchar* last_accessed, guint usage) { GAppInfo* _tmp0_; const gchar* _tmp1_ = NULL; gchar* _tmp2_; gchar* id; GAppInfo* _tmp3_; const gchar* _tmp4_ = NULL; gchar* _tmp5_; gchar* name; GAppInfo* _tmp6_; GIcon* _tmp7_ = NULL; GIcon* _tmp8_; GIcon* icon; GdkPixbuf* pix; GIcon* _tmp9_; GHashTable* _tmp12_; const gchar* _tmp13_; gconstpointer _tmp14_ = NULL; AlmAppChooseInfo* _tmp15_; AlmAppChooseInfo* app_choose_info; AlmAppChooseInfo* _tmp16_; g_return_if_fail (self != NULL); g_return_if_fail (app_info != NULL); g_return_if_fail (last_accessed != NULL); _tmp0_ = app_info; _tmp1_ = g_app_info_get_id (_tmp0_); _tmp2_ = g_strdup (_tmp1_); id = _tmp2_; _tmp3_ = app_info; _tmp4_ = g_app_info_get_name (_tmp3_); _tmp5_ = g_strdup (_tmp4_); name = _tmp5_; _tmp6_ = app_info; _tmp7_ = g_app_info_get_icon (_tmp6_); _tmp8_ = _g_object_ref0 (_tmp7_); icon = _tmp8_; pix = NULL; _tmp9_ = icon; if (_tmp9_ != NULL) { GIcon* _tmp10_; GdkPixbuf* _tmp11_ = NULL; _tmp10_ = icon; _tmp11_ = alm_applications_tree_view_get_pixbuf_from_gio_icon (_tmp10_); _g_object_unref0 (pix); pix = _tmp11_; } _tmp12_ = self->priv->blocked_apps; _tmp13_ = id; _tmp14_ = g_hash_table_lookup (_tmp12_, _tmp13_); _tmp15_ = _alm_app_choose_info_ref0 ((AlmAppChooseInfo*) _tmp14_); app_choose_info = _tmp15_; _tmp16_ = app_choose_info; if (_tmp16_ == NULL) { GtkTreeIter iter = {0}; AlmAppSelectionTreeView* _tmp17_; GtkListStore* _tmp18_; GtkListStore* _tmp19_; GtkTreeIter _tmp20_ = {0}; AlmAppSelectionTreeView* _tmp21_; GtkListStore* _tmp22_; GtkListStore* _tmp23_; GtkTreeIter _tmp24_; const gchar* _tmp25_; GdkPixbuf* _tmp26_; const gchar* _tmp27_; const gchar* _tmp28_; guint _tmp29_; GHashTable* _tmp30_; const gchar* _tmp31_; gchar* _tmp32_; const gchar* _tmp33_; GdkPixbuf* _tmp34_; const gchar* _tmp35_; guint _tmp36_; AlmAppChooseInfo* _tmp37_; _tmp17_ = self->priv->treeview; _tmp18_ = alm_app_selection_tree_view_get_liststore (_tmp17_); _tmp19_ = _tmp18_; gtk_list_store_append (_tmp19_, &_tmp20_); iter = _tmp20_; _tmp21_ = self->priv->treeview; _tmp22_ = alm_app_selection_tree_view_get_liststore (_tmp21_); _tmp23_ = _tmp22_; _tmp24_ = iter; _tmp25_ = name; _tmp26_ = pix; _tmp27_ = id; _tmp28_ = last_accessed; _tmp29_ = usage; gtk_list_store_set (_tmp23_, &_tmp24_, 0, _tmp25_, 1, _tmp26_, 2, _tmp27_, 3, _tmp28_, 4, _tmp29_, -1, -1); _tmp30_ = self->priv->blocked_apps; _tmp31_ = id; _tmp32_ = g_strdup (_tmp31_); _tmp33_ = name; _tmp34_ = pix; _tmp35_ = last_accessed; _tmp36_ = usage; _tmp37_ = alm_app_choose_info_new (_tmp33_, _tmp34_, _tmp35_, _tmp36_); g_hash_table_insert (_tmp30_, _tmp32_, _tmp37_); } else { AlmAppChooseInfo* _tmp38_; const gchar* _tmp39_; AlmAppChooseInfo* _tmp40_; guint _tmp41_; _tmp38_ = app_choose_info; _tmp39_ = last_accessed; alm_app_choose_info_set_last_accessed (_tmp38_, _tmp39_); _tmp40_ = app_choose_info; _tmp41_ = usage; alm_app_choose_info_set_usage (_tmp40_, _tmp41_); } _alm_app_choose_info_unref0 (app_choose_info); _g_object_unref0 (pix); _g_object_unref0 (icon); _g_free0 (name); _g_free0 (id); } void alm_applications_chooser_dialog_insert_app_liststore (AlmApplicationsChooserDialog* self, const gchar* app) { GHashTable* _tmp0_; const gchar* _tmp1_; gconstpointer _tmp2_ = NULL; AlmAppChooseInfo* _tmp3_; AlmAppChooseInfo* app_choose_info; AlmAppChooseInfo* _tmp4_; g_return_if_fail (self != NULL); g_return_if_fail (app != NULL); _tmp0_ = self->priv->unblocked_apps; _tmp1_ = app; _tmp2_ = g_hash_table_lookup (_tmp0_, _tmp1_); _tmp3_ = _alm_app_choose_info_ref0 ((AlmAppChooseInfo*) _tmp2_); app_choose_info = _tmp3_; _tmp4_ = app_choose_info; if (_tmp4_ != NULL) { GtkTreeIter iter = {0}; AlmAppSelectionTreeView* _tmp5_; GtkListStore* _tmp6_; GtkListStore* _tmp7_; GtkTreeIter _tmp8_ = {0}; AlmAppSelectionTreeView* _tmp9_; GtkListStore* _tmp10_; GtkListStore* _tmp11_; GtkTreeIter _tmp12_; AlmAppChooseInfo* _tmp13_; const gchar* _tmp14_; const gchar* _tmp15_; AlmAppChooseInfo* _tmp16_; GdkPixbuf* _tmp17_; GdkPixbuf* _tmp18_; const gchar* _tmp19_; AlmAppChooseInfo* _tmp20_; const gchar* _tmp21_; const gchar* _tmp22_; AlmAppChooseInfo* _tmp23_; guint _tmp24_; guint _tmp25_; _tmp5_ = self->priv->treeview; _tmp6_ = alm_app_selection_tree_view_get_liststore (_tmp5_); _tmp7_ = _tmp6_; gtk_list_store_insert (_tmp7_, &_tmp8_, 1); iter = _tmp8_; _tmp9_ = self->priv->treeview; _tmp10_ = alm_app_selection_tree_view_get_liststore (_tmp9_); _tmp11_ = _tmp10_; _tmp12_ = iter; _tmp13_ = app_choose_info; _tmp14_ = alm_app_choose_info_get_name (_tmp13_); _tmp15_ = _tmp14_; _tmp16_ = app_choose_info; _tmp17_ = alm_app_choose_info_get_icon (_tmp16_); _tmp18_ = _tmp17_; _tmp19_ = app; _tmp20_ = app_choose_info; _tmp21_ = alm_app_choose_info_get_last_accessed (_tmp20_); _tmp22_ = _tmp21_; _tmp23_ = app_choose_info; _tmp24_ = alm_app_choose_info_get_usage (_tmp23_); _tmp25_ = _tmp24_; gtk_list_store_set (_tmp11_, &_tmp12_, 0, _tmp15_, 1, _tmp18_, 2, _tmp19_, 3, _tmp22_, 4, _tmp25_, -1, -1); } _alm_app_choose_info_unref0 (app_choose_info); } static void alm_applications_chooser_dialog_set_up_ui (AlmApplicationsChooserDialog* self) { AlmApplicationBlacklist* _tmp0_; AlmAppSelectionTreeView* _tmp1_; AlmAppSelectionTreeView* _tmp2_; GtkBox* _tmp3_ = NULL; GtkBox* _tmp4_; GtkBox* area; AlmAppSelectionTreeView* _tmp5_; AlmAppSelectionTreeView* _tmp6_; g_return_if_fail (self != NULL); _tmp0_ = self->priv->app_blacklist; _tmp1_ = alm_app_selection_tree_view_new (_tmp0_); _tmp2_ = g_object_ref_sink (_tmp1_); _g_object_unref0 (self->priv->treeview); self->priv->treeview = _tmp2_; _tmp3_ = gtk_dialog_get_content_area ((GtkDialog*) self); _tmp4_ = _g_object_ref0 (GTK_IS_BOX (_tmp3_) ? ((GtkBox*) _tmp3_) : NULL); area = _tmp4_; _tmp5_ = self->priv->treeview; gtk_box_pack_start (area, (GtkWidget*) _tmp5_, TRUE, TRUE, (guint) 0); gtk_dialog_add_buttons ((GtkDialog*) self, GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); _tmp6_ = self->priv->treeview; gtk_widget_show_all ((GtkWidget*) _tmp6_); _g_object_unref0 (area); } GtkTreeView* alm_applications_chooser_dialog_get_tree (AlmApplicationsChooserDialog* self) { GtkTreeView* result; AlmAppSelectionTreeView* _tmp0_; GtkTreeView* _tmp1_; GtkTreeView* _tmp2_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->treeview; _tmp1_ = alm_app_selection_tree_view_get_tree (_tmp0_); _tmp2_ = _tmp1_; result = _tmp2_; return result; } GtkListStore* alm_applications_chooser_dialog_get_liststore (AlmApplicationsChooserDialog* self) { GtkListStore* result; AlmAppSelectionTreeView* _tmp0_; GtkListStore* _tmp1_; GtkListStore* _tmp2_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->treeview; _tmp1_ = alm_app_selection_tree_view_get_liststore (_tmp0_); _tmp2_ = _tmp1_; result = _tmp2_; return result; } static void alm_applications_chooser_dialog_class_init (AlmApplicationsChooserDialogClass * klass) { alm_applications_chooser_dialog_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (AlmApplicationsChooserDialogPrivate)); G_OBJECT_CLASS (klass)->get_property = _vala_alm_applications_chooser_dialog_get_property; G_OBJECT_CLASS (klass)->finalize = alm_applications_chooser_dialog_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), ALM_APPLICATIONS_CHOOSER_DIALOG_TREE, g_param_spec_object ("tree", "tree", "tree", GTK_TYPE_TREE_VIEW, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ALM_APPLICATIONS_CHOOSER_DIALOG_LISTSTORE, g_param_spec_object ("liststore", "liststore", "liststore", GTK_TYPE_LIST_STORE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); } static void alm_applications_chooser_dialog_instance_init (AlmApplicationsChooserDialog * self) { self->priv = ALM_APPLICATIONS_CHOOSER_DIALOG_GET_PRIVATE (self); } static void alm_applications_chooser_dialog_finalize (GObject* obj) { AlmApplicationsChooserDialog * self; self = ALM_APPLICATIONS_CHOOSER_DIALOG (obj); _alm_application_blacklist_unref0 (self->priv->app_blacklist); _g_object_unref0 (self->priv->treeview); _g_hash_table_unref0 (self->priv->all_actors_list); _g_hash_table_unref0 (self->priv->blocked_apps); _g_hash_table_unref0 (self->priv->unblocked_apps); G_OBJECT_CLASS (alm_applications_chooser_dialog_parent_class)->finalize (obj); } GType alm_applications_chooser_dialog_get_type (void) { static volatile gsize alm_applications_chooser_dialog_type_id__volatile = 0; if (g_once_init_enter (&alm_applications_chooser_dialog_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (AlmApplicationsChooserDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_applications_chooser_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmApplicationsChooserDialog), 0, (GInstanceInitFunc) alm_applications_chooser_dialog_instance_init, NULL }; GType alm_applications_chooser_dialog_type_id; alm_applications_chooser_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "AlmApplicationsChooserDialog", &g_define_type_info, 0); g_once_init_leave (&alm_applications_chooser_dialog_type_id__volatile, alm_applications_chooser_dialog_type_id); } return alm_applications_chooser_dialog_type_id__volatile; } static void _vala_alm_applications_chooser_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { AlmApplicationsChooserDialog * self; self = ALM_APPLICATIONS_CHOOSER_DIALOG (object); switch (property_id) { case ALM_APPLICATIONS_CHOOSER_DIALOG_TREE: g_value_set_object (value, alm_applications_chooser_dialog_get_tree (self)); break; case ALM_APPLICATIONS_CHOOSER_DIALOG_LISTSTORE: g_value_set_object (value, alm_applications_chooser_dialog_get_liststore (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } AlmAppChooseInfo* alm_app_choose_info_construct (GType object_type, const gchar* app_name, GdkPixbuf* app_icon, const gchar* last_accessed_time, guint usage_rating) { AlmAppChooseInfo* self = NULL; const gchar* _tmp0_; gchar* _tmp1_; GdkPixbuf* _tmp2_; GdkPixbuf* _tmp3_; const gchar* _tmp4_; gchar* _tmp5_; guint _tmp6_; g_return_val_if_fail (app_name != NULL, NULL); g_return_val_if_fail (last_accessed_time != NULL, NULL); self = (AlmAppChooseInfo*) g_type_create_instance (object_type); _tmp0_ = app_name; _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->app_name); self->priv->app_name = _tmp1_; _tmp2_ = app_icon; _tmp3_ = _g_object_ref0 (_tmp2_); _g_object_unref0 (self->priv->app_icon); self->priv->app_icon = _tmp3_; _tmp4_ = last_accessed_time; _tmp5_ = g_strdup (_tmp4_); _g_free0 (self->priv->last_accessed_time); self->priv->last_accessed_time = _tmp5_; _tmp6_ = usage_rating; self->priv->usage_rating = _tmp6_; return self; } AlmAppChooseInfo* alm_app_choose_info_new (const gchar* app_name, GdkPixbuf* app_icon, const gchar* last_accessed_time, guint usage_rating) { return alm_app_choose_info_construct (ALM_TYPE_APP_CHOOSE_INFO, app_name, app_icon, last_accessed_time, usage_rating); } const gchar* alm_app_choose_info_get_name (AlmAppChooseInfo* self) { const gchar* result; const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->app_name; result = _tmp0_; return result; } void alm_app_choose_info_set_name (AlmAppChooseInfo* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; g_return_if_fail (self != NULL); _tmp0_ = value; _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->app_name); self->priv->app_name = _tmp1_; } GdkPixbuf* alm_app_choose_info_get_icon (AlmAppChooseInfo* self) { GdkPixbuf* result; GdkPixbuf* _tmp0_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->app_icon; result = _tmp0_; return result; } void alm_app_choose_info_set_icon (AlmAppChooseInfo* self, GdkPixbuf* value) { GdkPixbuf* _tmp0_; GdkPixbuf* _tmp1_; g_return_if_fail (self != NULL); _tmp0_ = value; _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->app_icon); self->priv->app_icon = _tmp1_; } const gchar* alm_app_choose_info_get_last_accessed (AlmAppChooseInfo* self) { const gchar* result; const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->last_accessed_time; result = _tmp0_; return result; } void alm_app_choose_info_set_last_accessed (AlmAppChooseInfo* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; g_return_if_fail (self != NULL); _tmp0_ = value; _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->last_accessed_time); self->priv->last_accessed_time = _tmp1_; } guint alm_app_choose_info_get_usage (AlmAppChooseInfo* self) { guint result; guint _tmp0_; g_return_val_if_fail (self != NULL, 0U); _tmp0_ = self->priv->usage_rating; result = _tmp0_; return result; } void alm_app_choose_info_set_usage (AlmAppChooseInfo* self, guint value) { guint _tmp0_; g_return_if_fail (self != NULL); _tmp0_ = value; self->priv->usage_rating = _tmp0_; } static void alm_value_app_choose_info_init (GValue* value) { value->data[0].v_pointer = NULL; } static void alm_value_app_choose_info_free_value (GValue* value) { if (value->data[0].v_pointer) { alm_app_choose_info_unref (value->data[0].v_pointer); } } static void alm_value_app_choose_info_copy_value (const GValue* src_value, GValue* dest_value) { if (src_value->data[0].v_pointer) { dest_value->data[0].v_pointer = alm_app_choose_info_ref (src_value->data[0].v_pointer); } else { dest_value->data[0].v_pointer = NULL; } } static gpointer alm_value_app_choose_info_peek_pointer (const GValue* value) { return value->data[0].v_pointer; } static gchar* alm_value_app_choose_info_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { if (collect_values[0].v_pointer) { AlmAppChooseInfo* object; object = collect_values[0].v_pointer; if (object->parent_instance.g_class == NULL) { return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); } value->data[0].v_pointer = alm_app_choose_info_ref (object); } else { value->data[0].v_pointer = NULL; } return NULL; } static gchar* alm_value_app_choose_info_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { AlmAppChooseInfo** object_p; object_p = collect_values[0].v_pointer; if (!object_p) { return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); } if (!value->data[0].v_pointer) { *object_p = NULL; } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { *object_p = value->data[0].v_pointer; } else { *object_p = alm_app_choose_info_ref (value->data[0].v_pointer); } return NULL; } GParamSpec* alm_param_spec_app_choose_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { AlmParamSpecAppChooseInfo* spec; g_return_val_if_fail (g_type_is_a (object_type, ALM_TYPE_APP_CHOOSE_INFO), NULL); spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); G_PARAM_SPEC (spec)->value_type = object_type; return G_PARAM_SPEC (spec); } gpointer alm_value_get_app_choose_info (const GValue* value) { g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_APP_CHOOSE_INFO), NULL); return value->data[0].v_pointer; } void alm_value_set_app_choose_info (GValue* value, gpointer v_object) { AlmAppChooseInfo* old; g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_APP_CHOOSE_INFO)); old = value->data[0].v_pointer; if (v_object) { g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_APP_CHOOSE_INFO)); g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); value->data[0].v_pointer = v_object; alm_app_choose_info_ref (value->data[0].v_pointer); } else { value->data[0].v_pointer = NULL; } if (old) { alm_app_choose_info_unref (old); } } void alm_value_take_app_choose_info (GValue* value, gpointer v_object) { AlmAppChooseInfo* old; g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_APP_CHOOSE_INFO)); old = value->data[0].v_pointer; if (v_object) { g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_APP_CHOOSE_INFO)); g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); value->data[0].v_pointer = v_object; } else { value->data[0].v_pointer = NULL; } if (old) { alm_app_choose_info_unref (old); } } static void alm_app_choose_info_class_init (AlmAppChooseInfoClass * klass) { alm_app_choose_info_parent_class = g_type_class_peek_parent (klass); ALM_APP_CHOOSE_INFO_CLASS (klass)->finalize = alm_app_choose_info_finalize; g_type_class_add_private (klass, sizeof (AlmAppChooseInfoPrivate)); } static void alm_app_choose_info_instance_init (AlmAppChooseInfo * self) { self->priv = ALM_APP_CHOOSE_INFO_GET_PRIVATE (self); self->ref_count = 1; } static void alm_app_choose_info_finalize (AlmAppChooseInfo* obj) { AlmAppChooseInfo * self; self = ALM_APP_CHOOSE_INFO (obj); _g_free0 (self->priv->app_name); _g_object_unref0 (self->priv->app_icon); _g_free0 (self->priv->last_accessed_time); } GType alm_app_choose_info_get_type (void) { static volatile gsize alm_app_choose_info_type_id__volatile = 0; if (g_once_init_enter (&alm_app_choose_info_type_id__volatile)) { static const GTypeValueTable g_define_type_value_table = { alm_value_app_choose_info_init, alm_value_app_choose_info_free_value, alm_value_app_choose_info_copy_value, alm_value_app_choose_info_peek_pointer, "p", alm_value_app_choose_info_collect_value, "p", alm_value_app_choose_info_lcopy_value }; static const GTypeInfo g_define_type_info = { sizeof (AlmAppChooseInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_app_choose_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmAppChooseInfo), 0, (GInstanceInitFunc) alm_app_choose_info_instance_init, &g_define_type_value_table }; static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; GType alm_app_choose_info_type_id; alm_app_choose_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AlmAppChooseInfo", &g_define_type_info, &g_define_type_fundamental_info, 0); g_once_init_leave (&alm_app_choose_info_type_id__volatile, alm_app_choose_info_type_id); } return alm_app_choose_info_type_id__volatile; } gpointer alm_app_choose_info_ref (gpointer instance) { AlmAppChooseInfo* self; self = instance; g_atomic_int_inc (&self->ref_count); return instance; } void alm_app_choose_info_unref (gpointer instance) { AlmAppChooseInfo* self; self = instance; if (g_atomic_int_dec_and_test (&self->ref_count)) { ALM_APP_CHOOSE_INFO_GET_CLASS (self)->finalize (self); g_type_free_instance ((GTypeInstance *) self); } }