forked from enlightenment/enlightenment
Put the packagekit module inside the E tree.
The now old emodules/pacakgekit will be removed soon. Note that you need to update elm as the theme is there.
This commit is contained in:
parent
ec8424fb16
commit
d5a89ca177
1
AUTHORS
1
AUTHORS
|
@ -53,3 +53,4 @@ Lucas Jóia <lucasjoia@profusion.mobi>
|
|||
PrinceAMD (Deon Thomas) <deon.thomas.gy@gmail.com>
|
||||
Dieter Roelants <dieter.e@bsdusr.net>
|
||||
Stefan Schmidt <stefan@datenfreihafen.org>
|
||||
DaveMDS (Davide Andreoli) <dave@gurumeditation.it>
|
||||
|
|
|
@ -664,6 +664,12 @@ define([CHECK_MODULE_MUSIC_CONTROL],
|
|||
AC_E_CHECK_PKG(MUSIC_CONTROL, [ ecore >= $efl_version eina >= $efl_version eldbus ], [], [MUSIC_CONTROL=false])
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(HAVE_PACKAGEKIT, false)
|
||||
define([CHECK_MODULE_PACKAGEKIT],
|
||||
[
|
||||
AC_E_CHECK_PKG(PACKAGEKIT, [ ecore >= $efl_version eina >= $efl_version eldbus efreet ], [], [PACKAGEKIT=false])
|
||||
])
|
||||
|
||||
##have_exchange=no
|
||||
##AC_ARG_ENABLE(exchange,
|
||||
## AS_HELP_STRING([--disable-exchange], [disable Exchange support @<:@default=detect@:>@]),
|
||||
|
@ -901,6 +907,7 @@ AC_E_OPTIONAL_MODULE([xkbswitch], true, $ecore_x)
|
|||
AC_E_OPTIONAL_MODULE([tiling], true)
|
||||
AC_E_OPTIONAL_MODULE([access], false, $ecore_x)
|
||||
AC_E_OPTIONAL_MODULE([music_control], true, [CHECK_MODULE_MUSIC_CONTROL])
|
||||
AC_E_OPTIONAL_MODULE([packagekit], true, [CHECK_MODULE_PACKAGEKIT])
|
||||
AC_E_OPTIONAL_MODULE([contact], false)
|
||||
AC_E_OPTIONAL_MODULE([wl_desktop_shell], true, [CHECK_MODULE_WL_DESKTOP_SHELL])
|
||||
AC_E_OPTIONAL_MODULE([wl_x11], $have_wayland, $wl_x11)
|
||||
|
@ -1012,6 +1019,7 @@ src/modules/xkbswitch/module.desktop
|
|||
src/modules/tiling/module.desktop
|
||||
src/modules/access/module.desktop
|
||||
src/modules/music-control/module.desktop
|
||||
src/modules/packagekit/module.desktop
|
||||
src/modules/contact/module.desktop
|
||||
src/modules/wl_desktop_shell/module.desktop
|
||||
src/modules/wl_screenshot/module.desktop
|
||||
|
|
|
@ -218,6 +218,10 @@ if USE_MODULE_MUSIC_CONTROL
|
|||
include src/modules/Makefile_music_control.mk
|
||||
endif
|
||||
|
||||
if USE_MODULE_PACKAGEKIT
|
||||
include src/modules/Makefile_packagekit.mk
|
||||
endif
|
||||
|
||||
if USE_MODULE_CONTACT
|
||||
include src/modules/Makefile_contact.mk
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
packagekitdir = $(MDIR)/packagekit
|
||||
packagekit_DATA = src/modules/packagekit/e-module-packagekit.edj \
|
||||
src/modules/packagekit/module.desktop
|
||||
|
||||
EXTRA_DIST += $(packagekit_DATA)
|
||||
|
||||
packagekitpkgdir = $(MDIR)/packagekit/$(MODULE_ARCH)
|
||||
packagekitpkg_LTLIBRARIES = src/modules/packagekit/module.la
|
||||
|
||||
src_modules_packagekit_module_la_LIBADD = $(MOD_LIBS)
|
||||
src_modules_packagekit_module_la_CPPFLAGS = $(MOD_CPPFLAGS)
|
||||
src_modules_packagekit_module_la_LDFLAGS = $(MOD_LDFLAGS)
|
||||
src_modules_packagekit_module_la_SOURCES = \
|
||||
src/modules/packagekit/e_mod_main.c \
|
||||
src/modules/packagekit/e_mod_main.h \
|
||||
src/modules/packagekit/e_mod_packagekit.c \
|
||||
src/modules/packagekit/e_mod_packagekit.h
|
||||
|
||||
PHONIES += packagekit install-packagekit
|
||||
packagekit: $(packagekitpkg_LTLIBRARIES) $(packagekit_DATA)
|
||||
install-packagekit: install-packagekitDATA install-packagekitpkgLTLIBRARIES
|
Binary file not shown.
|
@ -0,0 +1,346 @@
|
|||
#include <e.h>
|
||||
#include <Eldbus.h>
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_packagekit.h"
|
||||
|
||||
#define PACKAGEKIT_DOMAIN "module.packagekit"
|
||||
|
||||
static E_Module *packagekit_mod = NULL;
|
||||
|
||||
|
||||
/* Module Configuration */
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
int update_interval;
|
||||
char *manager_command;
|
||||
int show_description;
|
||||
};
|
||||
|
||||
static void *
|
||||
_cfg_data_create(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = cfd->data;
|
||||
|
||||
E_Config_Dialog_Data *cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
cfdata->update_interval = ctxt->config->update_interval;
|
||||
cfdata->show_description = ctxt->config->show_description;
|
||||
if (ctxt->config->manager_command)
|
||||
cfdata->manager_command = strdup(ctxt->config->manager_command);
|
||||
else
|
||||
cfdata->manager_command = strdup("");
|
||||
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_cfg_data_free(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_FREE(cfdata->manager_command);
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_cfg_widgets_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *list, *of, *ob;
|
||||
E_Radio_Group *rg;
|
||||
|
||||
list = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Refresh Packages"), 0);
|
||||
rg = e_widget_radio_group_new(&(cfdata->update_interval));
|
||||
ob = e_widget_radio_add(evas, _("Never"), 0, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Hourly"), 60, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Daily"), 60 * 24, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Weekly"), 60 * 24 * 7, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(list, of, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Package list"), 0);
|
||||
rg = e_widget_radio_group_new(&(cfdata->show_description));
|
||||
ob = e_widget_radio_add(evas, _("Show package name"), 0, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Show package description"), 1, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Package Manager"), 0);
|
||||
ob = e_widget_entry_add(evas, &(cfdata->manager_command), NULL, NULL, NULL);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(list, of, 1, 0, 0.5);
|
||||
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static int
|
||||
_cfg_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = cfd->data;
|
||||
|
||||
if (ctxt->config->update_interval != cfdata->update_interval)
|
||||
return 1;
|
||||
|
||||
if (ctxt->config->show_description != cfdata->show_description)
|
||||
return 1;
|
||||
|
||||
if ((ctxt->config->manager_command) && (cfdata->manager_command) &&
|
||||
(strcmp(ctxt->config->manager_command, cfdata->manager_command)))
|
||||
return 1;
|
||||
|
||||
if ((!ctxt->config->manager_command) && (cfdata->manager_command[0]))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_cfg_data_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = cfd->data;
|
||||
|
||||
ctxt->config->update_interval = cfdata->update_interval;
|
||||
ctxt->config->show_description = cfdata->show_description;
|
||||
|
||||
if (ctxt->config->manager_command)
|
||||
eina_stringshare_replace(&ctxt->config->manager_command, cfdata->manager_command);
|
||||
else
|
||||
ctxt->config->manager_command = eina_stringshare_add(cfdata->manager_command);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_cfg_menu_cb(void *data, E_Menu *m, E_Menu_Item *mi EINA_UNUSED)
|
||||
{
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _cfg_data_create;
|
||||
v->free_cfdata = _cfg_data_free;
|
||||
v->basic.create_widgets = _cfg_widgets_create;
|
||||
v->basic.apply_cfdata = _cfg_data_apply;
|
||||
v->basic.check_changed = _cfg_check_changed;
|
||||
|
||||
e_config_dialog_new(e_util_comp_current_get(), _("System Updates Settings"),
|
||||
"E", "_e_mod_packagekit_dialog", NULL, 0, v, data);
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_mouse_down_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
{
|
||||
E_PackageKit_Instance *inst = data;
|
||||
E_PackageKit_Module_Context *ctxt = packagekit_mod->data;
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (inst->popup)
|
||||
packagekit_popup_del(inst);
|
||||
else
|
||||
packagekit_popup_new(inst);
|
||||
}
|
||||
else if (ev->button == 2)
|
||||
{
|
||||
packagekit_create_transaction_and_exec(ctxt, packagekit_get_updates);
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
E_Menu *m;
|
||||
E_Menu_Item *mi;
|
||||
E_Zone *zone = e_util_zone_current_get(e_manager_current_get());
|
||||
int x, y;
|
||||
|
||||
if (inst->popup)
|
||||
packagekit_popup_del(inst);
|
||||
|
||||
m = e_menu_new();
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Settings"));
|
||||
e_util_menu_item_theme_icon_set(mi, "configure");
|
||||
e_menu_item_callback_set(mi, _cfg_menu_cb, inst->ctxt);
|
||||
|
||||
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
|
||||
|
||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, NULL, NULL);
|
||||
e_menu_activate_mouse(m, zone, (x + ev->output.x),(y + ev->output.y),
|
||||
1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
||||
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
|
||||
EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Gadcon Api Functions */
|
||||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||
{
|
||||
E_PackageKit_Instance *inst;
|
||||
E_PackageKit_Module_Context *ctxt = packagekit_mod->data;
|
||||
|
||||
inst = E_NEW(E_PackageKit_Instance, 1);
|
||||
inst->ctxt = ctxt;
|
||||
inst->gadget = edje_object_add(gc->evas);
|
||||
e_theme_edje_object_set(inst->gadget, "base/theme/modules/packagekit",
|
||||
"e/modules/packagekit/main");
|
||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->gadget);
|
||||
inst->gcc->data = inst;
|
||||
evas_object_event_callback_add(inst->gadget, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
packagekit_mouse_down_cb, inst);
|
||||
ctxt->instances = eina_list_append(ctxt->instances, inst);
|
||||
return inst->gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
E_PackageKit_Instance *inst = gcc->data;
|
||||
E_PackageKit_Module_Context *ctxt = packagekit_mod->data;
|
||||
|
||||
E_FREE_FUNC(inst->gadget, evas_object_del);
|
||||
if (inst->popup) packagekit_popup_del(inst);
|
||||
ctxt->instances = eina_list_remove(ctxt->instances, inst);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
||||
{
|
||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_label(const E_Gadcon_Client_Class *client_class)
|
||||
{
|
||||
return _("System Updates");
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(const E_Gadcon_Client_Class *client_class, Evas *evas)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
Evas_Object *o;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(packagekit_mod, NULL);
|
||||
snprintf(buf, sizeof(buf), "%s/e-module-packagekit.edj",
|
||||
e_module_dir_get(packagekit_mod));
|
||||
o = edje_object_add(evas);
|
||||
edje_object_file_set(o, buf, "icon");
|
||||
return o;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_gc_id_new(const E_Gadcon_Client_Class *client_class)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = packagekit_mod->data;
|
||||
static char buf[64];
|
||||
snprintf(buf, sizeof(buf), "packagekit.%d", eina_list_count(ctxt->instances));
|
||||
return buf;
|
||||
}
|
||||
|
||||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION, "PackageKit",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
||||
e_gadcon_site_is_not_toolbar
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
|
||||
|
||||
/* E Module Api Functions */
|
||||
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "PackageKit" };
|
||||
|
||||
Eina_Bool
|
||||
_timer_cb(void *data)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
double elapsed;
|
||||
|
||||
if (ctxt->config->update_interval == 0)
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
elapsed = (ecore_time_unix_get() - ctxt->config->last_update) / 60;
|
||||
if (elapsed > ctxt->config->update_interval)
|
||||
{
|
||||
ctxt->config->last_update = ecore_time_unix_get();
|
||||
packagekit_create_transaction_and_exec(ctxt, packagekit_refresh_cache);
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt;
|
||||
|
||||
ctxt = E_NEW(E_PackageKit_Module_Context, 1);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ctxt, NULL);
|
||||
ctxt->v_maj = ctxt->v_min = ctxt->v_mic = -1;
|
||||
|
||||
ctxt->conf_edd = E_CONFIG_DD_NEW("packagekit_config", PackageKit_Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T PackageKit_Config
|
||||
#define D ctxt->conf_edd
|
||||
E_CONFIG_VAL(D, T, update_interval, INT);
|
||||
E_CONFIG_VAL(D, T, last_update, INT);
|
||||
E_CONFIG_VAL(D, T, manager_command, STR);
|
||||
E_CONFIG_VAL(D, T, show_description, INT);
|
||||
ctxt->config = e_config_domain_load(PACKAGEKIT_DOMAIN, ctxt->conf_edd);
|
||||
if (!ctxt->config)
|
||||
ctxt->config = E_NEW(PackageKit_Config, 1);
|
||||
|
||||
ctxt->module = m;
|
||||
packagekit_mod = m;
|
||||
e_gadcon_provider_register(&_gc_class);
|
||||
packagekit_dbus_connect(ctxt);
|
||||
ctxt->refresh_timer = ecore_timer_add(60.0, _timer_cb, ctxt);
|
||||
return ctxt;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = m->data;
|
||||
|
||||
packagekit_dbus_disconnect(ctxt);
|
||||
|
||||
E_FREE_FUNC(ctxt->refresh_timer, ecore_timer_del);
|
||||
E_FREE_FUNC(ctxt->error, eina_stringshare_del);
|
||||
|
||||
E_FREE_FUNC(ctxt->config->manager_command, eina_stringshare_del);
|
||||
E_FREE(ctxt->config);
|
||||
E_CONFIG_DD_FREE(ctxt->conf_edd);
|
||||
|
||||
e_gadcon_provider_unregister(&_gc_class);
|
||||
|
||||
E_PackageKit_Package *pkg;
|
||||
EINA_LIST_FREE(ctxt->packages, pkg)
|
||||
{
|
||||
E_FREE_FUNC(pkg->name, eina_stringshare_del);
|
||||
E_FREE_FUNC(pkg->version, eina_stringshare_del);
|
||||
E_FREE_FUNC(pkg->summary, eina_stringshare_del);
|
||||
}
|
||||
|
||||
E_FREE(ctxt);
|
||||
packagekit_mod = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = m->data;
|
||||
e_config_domain_save(PACKAGEKIT_DOMAIN, ctxt->conf_edd, ctxt->config);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef E_MOD_MAIN_H
|
||||
#define E_MOD_MAIN_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
EAPI void *e_modapi_init(E_Module *m);
|
||||
EAPI int e_modapi_shutdown(E_Module *m);
|
||||
EAPI int e_modapi_save(E_Module *m);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,554 @@
|
|||
#include <e.h>
|
||||
#include <Eldbus.h>
|
||||
#include <Efreet.h>
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_packagekit.h"
|
||||
|
||||
|
||||
/* GUI */
|
||||
void
|
||||
packagekit_icon_update(E_PackageKit_Module_Context *ctxt, const char *state, unsigned num)
|
||||
{
|
||||
E_PackageKit_Instance *inst;
|
||||
char buf[16];
|
||||
Eina_List *l;
|
||||
|
||||
if (num) snprintf(buf, sizeof(buf), "%d", num);
|
||||
EINA_LIST_FOREACH(ctxt->instances, l, inst)
|
||||
{
|
||||
edje_object_signal_emit(inst->gadget, state, "e");
|
||||
edje_object_part_text_set(inst->gadget, "num_updates", num ? buf : "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_update_button_cb(void *data, void *data2 EINA_UNUSED)
|
||||
{
|
||||
E_PackageKit_Instance *inst = data;
|
||||
packagekit_popup_del(inst);
|
||||
packagekit_create_transaction_and_exec(inst->ctxt, packagekit_refresh_cache);
|
||||
}
|
||||
|
||||
static void
|
||||
_run_button_cb(void *data, void *data2 EINA_UNUSED)
|
||||
{
|
||||
E_PackageKit_Instance *inst = data;
|
||||
E_PackageKit_Module_Context *ctxt = inst->ctxt;
|
||||
packagekit_popup_del(inst);
|
||||
|
||||
if (ctxt->config->manager_command && ctxt->config->manager_command[0])
|
||||
e_exec(NULL, NULL, inst->ctxt->config->manager_command, NULL, NULL);
|
||||
else
|
||||
e_util_dialog_show(_("No package manager configured"),
|
||||
_("You need to set your preferred package manager.<br>"
|
||||
"Please open the module configuration and set<br>"
|
||||
"the program to run.<br>"));
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_popup_update(E_PackageKit_Instance *inst)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = inst->ctxt;
|
||||
E_PackageKit_Package *pkg;
|
||||
Eina_List *l;
|
||||
unsigned num_updates = 0;
|
||||
const char *emblem_name;
|
||||
Efreet_Desktop *desktop;
|
||||
Evas *evas = e_comp_get(inst->popup)->evas;
|
||||
Evas_Object *icon, *end;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (ctxt->error)
|
||||
{
|
||||
e_widget_label_text_set(inst->popup_label, _("No information available"));
|
||||
e_widget_ilist_append(inst->popup_ilist, NULL, ctxt->error, NULL, NULL, NULL);
|
||||
if ((ctxt->v_maj != -1) && (ctxt->v_min != -1) && (ctxt->v_mic != -1))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "PackageKit version: %d.%d.%d",
|
||||
ctxt->v_maj, ctxt->v_min, ctxt->v_mic);
|
||||
e_widget_ilist_append(inst->popup_ilist, NULL, buf, NULL, NULL, NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(ctxt->packages, l, pkg)
|
||||
{
|
||||
switch (pkg->info)
|
||||
{
|
||||
case PK_INFO_ENUM_LOW:
|
||||
emblem_name = "e/modules/packagekit/icon/low"; break;
|
||||
case PK_INFO_ENUM_ENHANCEMENT:
|
||||
emblem_name = "e/modules/packagekit/icon/enhancement"; break;
|
||||
case PK_INFO_ENUM_NORMAL:
|
||||
emblem_name = "e/modules/packagekit/icon/normal"; break;
|
||||
case PK_INFO_ENUM_BUGFIX:
|
||||
emblem_name = "e/modules/packagekit/icon/bugfix"; break;
|
||||
case PK_INFO_ENUM_IMPORTANT:
|
||||
emblem_name = "e/modules/packagekit/icon/important"; break;
|
||||
case PK_INFO_ENUM_SECURITY:
|
||||
emblem_name = "e/modules/packagekit/icon/security"; break;
|
||||
default:
|
||||
emblem_name = NULL; break;
|
||||
}
|
||||
if (emblem_name)
|
||||
{
|
||||
// try to find a desktop file that match the executable or the name
|
||||
desktop = efreet_util_desktop_exec_find(pkg->name);
|
||||
if (!desktop)
|
||||
desktop = efreet_util_desktop_name_find(pkg->name);
|
||||
|
||||
if (desktop && desktop->icon)
|
||||
{
|
||||
icon = e_icon_add(evas);
|
||||
e_icon_fdo_icon_set(icon, desktop->icon);
|
||||
efreet_desktop_free(desktop);
|
||||
}
|
||||
else
|
||||
icon = NULL;
|
||||
|
||||
// get the priority icon from the theme
|
||||
end = edje_object_add(evas);
|
||||
e_theme_edje_object_set(end, "base/theme/modules/packagekit", emblem_name);
|
||||
|
||||
e_widget_ilist_append_full(inst->popup_ilist, icon, end,
|
||||
ctxt->config->show_description ? pkg->summary : pkg->name,
|
||||
NULL, NULL, NULL);
|
||||
num_updates++;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_updates == 1)
|
||||
snprintf(buf, sizeof(buf), "%s", _("One update available"));
|
||||
else if (num_updates > 1)
|
||||
snprintf(buf, sizeof(buf), _("%d updates available"), num_updates);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s", _("Your system is updated"));
|
||||
e_widget_label_text_set(inst->popup_label, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
_popup_del_cb(void *obj)
|
||||
{
|
||||
packagekit_popup_del(e_object_data_get(obj));
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_popup_new(E_PackageKit_Instance *inst)
|
||||
{
|
||||
Evas_Object *table, *bt;
|
||||
Evas *evas;
|
||||
|
||||
inst->popup = e_gadcon_popup_new(inst->gcc, EINA_FALSE);
|
||||
evas = e_comp_get(inst->popup)->evas;
|
||||
|
||||
table = e_widget_table_add(evas, 0);
|
||||
|
||||
inst->popup_label = e_widget_label_add(evas, NULL);
|
||||
e_widget_table_object_append(table, inst->popup_label, 0,0, 1,1, 1,0,1,0);
|
||||
|
||||
bt = e_widget_button_add(evas, NULL, "view-refresh",
|
||||
_update_button_cb, inst, NULL);
|
||||
e_widget_table_object_append(table, bt, 1,0, 1,1, 0,0,0,0);
|
||||
|
||||
inst->popup_ilist = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
e_widget_size_min_set(inst->popup_ilist, 240, 200);
|
||||
e_widget_table_object_append(table, inst->popup_ilist, 0,1, 2,1, 1,1,0,0);
|
||||
|
||||
bt = e_widget_button_add(evas, _("Run the package manager"), NULL,
|
||||
_run_button_cb, inst, NULL);
|
||||
e_widget_table_object_append(table, bt, 0,3, 2,1, 1,0,0,0);
|
||||
|
||||
packagekit_popup_update(inst);
|
||||
|
||||
e_gadcon_popup_content_set(inst->popup, table);
|
||||
e_comp_object_util_autoclose(inst->popup->comp_object, NULL, NULL, NULL);
|
||||
e_gadcon_popup_show(inst->popup);
|
||||
e_object_data_set(E_OBJECT(inst->popup), inst);
|
||||
E_OBJECT_DEL_SET(inst->popup, _popup_del_cb);
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_popup_del(E_PackageKit_Instance *inst)
|
||||
{
|
||||
E_FREE_FUNC(inst->popup, e_object_del);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_store_error(E_PackageKit_Module_Context *ctxt, const char *err)
|
||||
{
|
||||
ERR("PKGKIT ERROR: %s", err);
|
||||
packagekit_icon_update(ctxt, "packagekit,state,error", 0);
|
||||
if (ctxt->error)
|
||||
eina_stringshare_replace(&ctxt->error, err);
|
||||
else
|
||||
ctxt->error = eina_stringshare_add(err);
|
||||
}
|
||||
|
||||
/* RefreshCache() */
|
||||
static void
|
||||
null_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
const char *error, *error_msg;
|
||||
if (eldbus_message_error_get(msg, &error, &error_msg))
|
||||
_store_error(ctxt, error_msg);
|
||||
}
|
||||
|
||||
static void
|
||||
signal_repo_detail_cb(void *data, const Eldbus_Message *msg)
|
||||
{ /* RepoDetail ('s'repo_id, 's'description, 'b'enabled) */
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
const char *error, *error_msg, *repo_id, *desc;
|
||||
Eina_Bool enabled;
|
||||
|
||||
if (eldbus_message_error_get(msg, &error, &error_msg))
|
||||
{
|
||||
_store_error(ctxt, error_msg);
|
||||
return;
|
||||
}
|
||||
if (!eldbus_message_arguments_get(msg, "ssb", &repo_id, &desc, &enabled))
|
||||
{
|
||||
_store_error(ctxt, "could not get arguments (ssb)");
|
||||
return;
|
||||
}
|
||||
DBG("PKGKIT: RepoDetail: (%d) %s [ %s ]", enabled, repo_id, desc);
|
||||
}
|
||||
|
||||
static void
|
||||
signal_cache_finished_cb(void *data, const Eldbus_Message *msg)
|
||||
{ /* Finished ('u'exit, 'u'runtime) */
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
const char *error, *error_msg;
|
||||
|
||||
DBG("PKGKIT: Cache Finished CB");
|
||||
|
||||
if (eldbus_message_error_get(msg, &error, &error_msg))
|
||||
{
|
||||
_store_error(ctxt, error_msg);
|
||||
return;
|
||||
}
|
||||
|
||||
Eldbus_Object *obj = eldbus_proxy_object_get(ctxt->transaction);
|
||||
E_FREE_FUNC(ctxt->transaction, eldbus_proxy_unref);
|
||||
E_FREE_FUNC(obj, eldbus_object_unref);
|
||||
|
||||
packagekit_create_transaction_and_exec(ctxt, packagekit_get_updates);
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_refresh_cache(E_PackageKit_Module_Context *ctxt, const char *transaction)
|
||||
{
|
||||
Eldbus_Object *obj;
|
||||
Eldbus_Proxy *proxy;
|
||||
Eldbus_Pending *pending;
|
||||
|
||||
ctxt->config->last_update = ecore_time_unix_get();
|
||||
|
||||
obj = eldbus_object_get(ctxt->conn, "org.freedesktop.PackageKit", transaction);
|
||||
proxy = eldbus_proxy_get(obj, "org.freedesktop.PackageKit.Transaction");
|
||||
pending = eldbus_proxy_call(proxy, "RefreshCache", null_cb, NULL, -1, "b", 1);
|
||||
if (!pending)
|
||||
{
|
||||
_store_error(ctxt, "could not call RefreshCache()");
|
||||
return;
|
||||
}
|
||||
eldbus_proxy_signal_handler_add(proxy, "Finished", signal_cache_finished_cb, ctxt);
|
||||
eldbus_proxy_signal_handler_add(proxy, "RepoDetail", signal_repo_detail_cb, ctxt);
|
||||
ctxt->transaction = proxy;
|
||||
}
|
||||
|
||||
|
||||
/* GetUpdates() */
|
||||
static void
|
||||
_signal_package_cb(void *data, const Eldbus_Message *msg)
|
||||
{ /* Package ('u'info, 's'package_id, 's'summary) */
|
||||
const char *error, *error_msg, *pkg_id, *summary, *info_str;
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
PackageKit_Package_Info info;
|
||||
unsigned num_elements = 0;
|
||||
char **splitted;
|
||||
Eina_Bool ret;
|
||||
|
||||
if (eldbus_message_error_get(msg, &error, &error_msg))
|
||||
{
|
||||
_store_error(ctxt, error_msg);
|
||||
return;
|
||||
}
|
||||
if (PKITV07)
|
||||
ret = eldbus_message_arguments_get(msg, "sss", &info_str, &pkg_id, &summary);
|
||||
else
|
||||
ret = eldbus_message_arguments_get(msg, "uss", &info, &pkg_id, &summary);
|
||||
if (!ret)
|
||||
{
|
||||
_store_error(ctxt, "could not get package arguments");
|
||||
return;
|
||||
}
|
||||
if (PKITV07)
|
||||
{ DBG("PKGKIT: Package: (%s) %s [ %s ]", info_str, pkg_id, summary); }
|
||||
else
|
||||
{ DBG("PKGKIT: Package: (%d) %s [ %s ]", info, pkg_id, summary); }
|
||||
|
||||
splitted = eina_str_split_full(pkg_id, ";", 2, &num_elements);
|
||||
if (num_elements == 2)
|
||||
{
|
||||
E_PackageKit_Package *pkg = E_NEW(E_PackageKit_Package, 1);
|
||||
pkg->name = eina_stringshare_add(splitted[0]);
|
||||
pkg->version = eina_stringshare_add(splitted[1]);
|
||||
pkg->summary = eina_stringshare_add(summary);
|
||||
if (PKITV07)
|
||||
{
|
||||
if (!info_str) pkg->info = PK_INFO_ENUM_NORMAL;
|
||||
else if (!strcmp(info_str, "normal")) pkg->info = PK_INFO_ENUM_NORMAL;
|
||||
else if (!strcmp(info_str, "security")) pkg->info = PK_INFO_ENUM_SECURITY;
|
||||
else if (!strcmp(info_str, "blocked")) pkg->info = PK_INFO_ENUM_BLOCKED;
|
||||
else if (!strcmp(info_str, "low")) pkg->info = PK_INFO_ENUM_LOW;
|
||||
else if (!strcmp(info_str, "enhancement")) pkg->info = PK_INFO_ENUM_ENHANCEMENT;
|
||||
else if (!strcmp(info_str, "bugfix")) pkg->info = PK_INFO_ENUM_BUGFIX;
|
||||
else if (!strcmp(info_str, "important")) pkg->info = PK_INFO_ENUM_IMPORTANT;
|
||||
else pkg->info = PK_INFO_ENUM_UNKNOWN;
|
||||
}
|
||||
else
|
||||
pkg->info = info;
|
||||
ctxt->packages = eina_list_append(ctxt->packages, pkg);
|
||||
}
|
||||
if (splitted)
|
||||
{
|
||||
free(splitted[0]);
|
||||
free(splitted);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_finished_cb(void *data, const Eldbus_Message *msg)
|
||||
{ /* Finished ('u'exit, 'u'runtime) */
|
||||
const char *error, *error_msg;
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
E_PackageKit_Package *pkg;
|
||||
unsigned num_updates = 0;
|
||||
Eina_List *l;
|
||||
|
||||
if (eldbus_message_error_get(msg, &error, &error_msg))
|
||||
{
|
||||
_store_error(ctxt, error_msg);
|
||||
return;
|
||||
}
|
||||
|
||||
Eldbus_Object *obj = eldbus_proxy_object_get(ctxt->transaction);
|
||||
E_FREE_FUNC(ctxt->transaction, eldbus_proxy_unref);
|
||||
E_FREE_FUNC(obj, eldbus_object_unref);
|
||||
E_FREE_FUNC(ctxt->error, eina_stringshare_del);
|
||||
|
||||
EINA_LIST_FOREACH(ctxt->packages, l, pkg)
|
||||
{
|
||||
switch (pkg->info)
|
||||
{
|
||||
case PK_INFO_ENUM_LOW:
|
||||
case PK_INFO_ENUM_ENHANCEMENT:
|
||||
case PK_INFO_ENUM_NORMAL:
|
||||
case PK_INFO_ENUM_BUGFIX:
|
||||
case PK_INFO_ENUM_IMPORTANT:
|
||||
case PK_INFO_ENUM_SECURITY:
|
||||
num_updates++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
DBG("PKGKIT: PackageFinished, %d updates available", num_updates);
|
||||
if (num_updates > 0)
|
||||
packagekit_icon_update(ctxt, "packagekit,state,updates", num_updates);
|
||||
else
|
||||
packagekit_icon_update(ctxt, "packagekit,state,updated", 0);
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_get_updates(E_PackageKit_Module_Context *ctxt, const char *transaction)
|
||||
{
|
||||
Eldbus_Object *obj;
|
||||
Eldbus_Proxy *proxy;
|
||||
Eldbus_Pending *pending;
|
||||
E_PackageKit_Package *pkg;
|
||||
|
||||
obj = eldbus_object_get(ctxt->conn, "org.freedesktop.PackageKit", transaction);
|
||||
proxy = eldbus_proxy_get(obj, "org.freedesktop.PackageKit.Transaction");
|
||||
if (PKITV07)
|
||||
pending = eldbus_proxy_call(proxy, "GetUpdates", null_cb, NULL, -1, "s", "none");
|
||||
else
|
||||
pending = eldbus_proxy_call(proxy, "GetUpdates", null_cb, NULL, -1, "t", 1);
|
||||
if (!pending)
|
||||
{
|
||||
_store_error(ctxt, "could not call GetUpdates()");
|
||||
return;
|
||||
}
|
||||
|
||||
eldbus_proxy_signal_handler_add(proxy, "Package", _signal_package_cb, ctxt);
|
||||
eldbus_proxy_signal_handler_add(proxy, "Finished", _signal_finished_cb, ctxt);
|
||||
ctxt->transaction = proxy;
|
||||
|
||||
EINA_LIST_FREE(ctxt->packages, pkg)
|
||||
{
|
||||
E_FREE_FUNC(pkg->name, eina_stringshare_del);
|
||||
E_FREE_FUNC(pkg->version, eina_stringshare_del);
|
||||
E_FREE_FUNC(pkg->summary, eina_stringshare_del);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* CreateTransaction() */
|
||||
static void
|
||||
_transaction_created_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
|
||||
{
|
||||
const char *error, *error_msg, *trans_path;
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
E_PackageKit_Transaction_Func func;
|
||||
Eina_Bool ret;
|
||||
|
||||
if (eldbus_message_error_get(msg, &error, &error_msg))
|
||||
{
|
||||
_store_error(ctxt, error_msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (PKITV07)
|
||||
ret = eldbus_message_arguments_get(msg, "s", &trans_path);
|
||||
else
|
||||
ret = eldbus_message_arguments_get(msg, "o", &trans_path);
|
||||
if (!ret)
|
||||
{
|
||||
_store_error(ctxt, "could not get transaction path");
|
||||
return;
|
||||
}
|
||||
|
||||
func = eldbus_pending_data_get(pending, "func");
|
||||
func(ctxt, trans_path);
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_create_transaction_and_exec(E_PackageKit_Module_Context *ctxt,
|
||||
E_PackageKit_Transaction_Func func)
|
||||
{
|
||||
Eldbus_Pending *pending;
|
||||
|
||||
DBG("*****************");
|
||||
DBG("PKGKIT Version: %d . %d . %d", ctxt->v_maj, ctxt->v_min, ctxt->v_mic);
|
||||
DBG("*****************");
|
||||
|
||||
if (ctxt->transaction)
|
||||
{
|
||||
WRN("PKGKIT: Another transaction in progress...");
|
||||
return;
|
||||
}
|
||||
|
||||
pending = eldbus_proxy_call(ctxt->packagekit,
|
||||
PKITV07 ? "GetTid" : "CreateTransaction",
|
||||
_transaction_created_cb, ctxt, -1, "");
|
||||
if (!pending)
|
||||
{
|
||||
_store_error(ctxt, "could not call CreateTransaction()");
|
||||
return;
|
||||
}
|
||||
eldbus_pending_data_set(pending, "func", func);
|
||||
|
||||
packagekit_icon_update(ctxt, "packagekit,state,working", 0);
|
||||
}
|
||||
|
||||
|
||||
/* PackageKit DBus */
|
||||
static void
|
||||
_signal_updates_changed_cb(void *data, const Eldbus_Message *msg)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
packagekit_create_transaction_and_exec(ctxt, packagekit_get_updates);
|
||||
}
|
||||
|
||||
static void
|
||||
_iterate_dict(void *data, const void *key, Eldbus_Message_Iter *var)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
|
||||
if (!strcmp(key, "VersionMajor"))
|
||||
eldbus_message_iter_arguments_get(var, "u", &(ctxt->v_maj));
|
||||
else if (!strcmp(key, "VersionMinor"))
|
||||
eldbus_message_iter_arguments_get(var, "u", &(ctxt->v_min));
|
||||
else if (!strcmp(key, "VersionMicro"))
|
||||
eldbus_message_iter_arguments_get(var, "u", &(ctxt->v_mic));
|
||||
else return;
|
||||
|
||||
if ((ctxt->v_maj != -1) && (ctxt->v_min != -1) && (ctxt->v_mic != -1))
|
||||
packagekit_create_transaction_and_exec(ctxt, packagekit_get_updates);
|
||||
}
|
||||
|
||||
static void
|
||||
_prop_get_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt = data;
|
||||
Eldbus_Message_Iter *array;
|
||||
const char *error, *error_msg;
|
||||
|
||||
if (eldbus_message_error_get(msg, &error, &error_msg))
|
||||
{
|
||||
_store_error(ctxt, error_msg);
|
||||
return;
|
||||
}
|
||||
if (!eldbus_message_arguments_get(msg, "a{sv}", &array))
|
||||
{
|
||||
_store_error(ctxt, "could not get arguments (a{sv})");
|
||||
return;
|
||||
}
|
||||
eldbus_message_iter_dict_iterate(array, "sv", _iterate_dict, ctxt);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
packagekit_dbus_connect(E_PackageKit_Module_Context *ctxt)
|
||||
{
|
||||
Eldbus_Object *obj;
|
||||
|
||||
DBG("PKGKIT: dbus_init()");
|
||||
eldbus_init();
|
||||
|
||||
ctxt->conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
|
||||
if (!ctxt->conn)
|
||||
{
|
||||
_store_error(ctxt, "could not connect to system bus");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
obj = eldbus_object_get(ctxt->conn, "org.freedesktop.PackageKit",
|
||||
"/org/freedesktop/PackageKit");
|
||||
ctxt->packagekit = eldbus_proxy_get(obj, "org.freedesktop.PackageKit");
|
||||
if (!ctxt->packagekit)
|
||||
{
|
||||
_store_error(ctxt, "could not connect to PackageKit");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
eldbus_proxy_property_get_all(ctxt->packagekit, _prop_get_cb, ctxt);
|
||||
eldbus_proxy_signal_handler_add(ctxt->packagekit, "UpdatesChanged",
|
||||
_signal_updates_changed_cb, ctxt);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
packagekit_dbus_disconnect(E_PackageKit_Module_Context *ctxt)
|
||||
{
|
||||
Eldbus_Object *obj;
|
||||
|
||||
DBG("PKGKIT: dbus_shutdown()");
|
||||
|
||||
if (ctxt->transaction)
|
||||
{
|
||||
// TODO abort the transaction ???
|
||||
obj = eldbus_proxy_object_get(ctxt->transaction);
|
||||
E_FREE_FUNC(ctxt->transaction, eldbus_proxy_unref);
|
||||
E_FREE_FUNC(obj, eldbus_object_unref);
|
||||
}
|
||||
|
||||
obj = eldbus_proxy_object_get(ctxt->packagekit);
|
||||
E_FREE_FUNC(ctxt->packagekit, eldbus_proxy_unref);
|
||||
E_FREE_FUNC(obj, eldbus_object_unref);
|
||||
|
||||
eldbus_connection_unref(ctxt->conn);
|
||||
eldbus_shutdown();
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
#ifndef PACKAGEKIT_H
|
||||
#define PACKAGEKIT_H
|
||||
|
||||
#include <Eldbus.h>
|
||||
|
||||
|
||||
#define PKITV07 (ctxt->v_maj == 0) && (ctxt->v_min == 7)
|
||||
#define PKITV08 (ctxt->v_maj == 0) && (ctxt->v_min == 8)
|
||||
|
||||
typedef enum {
|
||||
PK_INFO_ENUM_UNKNOWN,
|
||||
PK_INFO_ENUM_INSTALLED,
|
||||
PK_INFO_ENUM_AVAILABLE,
|
||||
PK_INFO_ENUM_LOW,
|
||||
PK_INFO_ENUM_ENHANCEMENT,
|
||||
PK_INFO_ENUM_NORMAL,
|
||||
PK_INFO_ENUM_BUGFIX,
|
||||
PK_INFO_ENUM_IMPORTANT,
|
||||
PK_INFO_ENUM_SECURITY,
|
||||
PK_INFO_ENUM_BLOCKED,
|
||||
PK_INFO_ENUM_DOWNLOADING,
|
||||
PK_INFO_ENUM_UPDATING,
|
||||
PK_INFO_ENUM_INSTALLING,
|
||||
PK_INFO_ENUM_REMOVING,
|
||||
PK_INFO_ENUM_CLEANUP,
|
||||
PK_INFO_ENUM_OBSOLETING,
|
||||
PK_INFO_ENUM_COLLECTION_INSTALLED,
|
||||
PK_INFO_ENUM_COLLECTION_AVAILABLE,
|
||||
PK_INFO_ENUM_FINISHED,
|
||||
PK_INFO_ENUM_REINSTALLING,
|
||||
PK_INFO_ENUM_DOWNGRADING,
|
||||
PK_INFO_ENUM_PREPARING,
|
||||
PK_INFO_ENUM_DECOMPRESSING,
|
||||
PK_INFO_ENUM_UNTRUSTED,
|
||||
PK_INFO_ENUM_TRUSTED,
|
||||
PK_INFO_ENUM_LAST,
|
||||
} PackageKit_Package_Info;
|
||||
|
||||
typedef struct _PackageKit_Config
|
||||
{
|
||||
int update_interval;
|
||||
int last_update;
|
||||
const char *manager_command;
|
||||
int show_description;
|
||||
} PackageKit_Config;
|
||||
|
||||
typedef struct _E_PackageKit_Module_Context
|
||||
{
|
||||
E_Module *module;
|
||||
Eina_List *instances;
|
||||
Eina_List *packages;
|
||||
Ecore_Timer *refresh_timer;
|
||||
const char *error;
|
||||
int v_maj;
|
||||
int v_min;
|
||||
int v_mic;
|
||||
|
||||
Eldbus_Connection *conn;
|
||||
Eldbus_Proxy *packagekit;
|
||||
Eldbus_Proxy *transaction;
|
||||
|
||||
E_Config_DD *conf_edd;
|
||||
PackageKit_Config *config;
|
||||
|
||||
} E_PackageKit_Module_Context;
|
||||
|
||||
typedef struct _E_PackageKit_Instance
|
||||
{
|
||||
E_PackageKit_Module_Context *ctxt;
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *gadget;
|
||||
E_Gadcon_Popup *popup;
|
||||
Evas_Object *popup_ilist;
|
||||
Evas_Object *popup_label;
|
||||
} E_PackageKit_Instance;
|
||||
|
||||
typedef struct _E_PackageKit_Package
|
||||
{
|
||||
const char *name;
|
||||
const char *summary;
|
||||
const char *version;
|
||||
PackageKit_Package_Info info;
|
||||
} E_PackageKit_Package;
|
||||
|
||||
|
||||
typedef void (*E_PackageKit_Transaction_Func)(E_PackageKit_Module_Context *ctxt,
|
||||
const char *transaction);
|
||||
|
||||
|
||||
Eina_Bool packagekit_dbus_connect(E_PackageKit_Module_Context *ctxt);
|
||||
void packagekit_dbus_disconnect(E_PackageKit_Module_Context *ctxt);
|
||||
void packagekit_create_transaction_and_exec(E_PackageKit_Module_Context *ctxt,
|
||||
E_PackageKit_Transaction_Func func);
|
||||
void packagekit_get_updates(E_PackageKit_Module_Context *ctxt, const char *transaction);
|
||||
void packagekit_refresh_cache(E_PackageKit_Module_Context *ctxt, const char *transaction);
|
||||
|
||||
void packagekit_icon_update(E_PackageKit_Module_Context *ctxt, const char *state, unsigned num);
|
||||
void packagekit_popup_new(E_PackageKit_Instance *inst);
|
||||
void packagekit_popup_del(E_PackageKit_Instance *inst);
|
||||
void packagekit_popup_update(E_PackageKit_Instance *inst);
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,17 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Link
|
||||
Name=System updates
|
||||
Name[es]=Actualizaciones del sistema
|
||||
Name[fi]=Järjestelmän päivitykset
|
||||
Name[gl]=Actualizacións do sistema
|
||||
Name[it]=Aggiornamenti di sistema
|
||||
Name[pt]=Atualizações do sistema
|
||||
Comment=Control system update status
|
||||
Comment[es]=Contrala el estado de las actualizaciones del sistema
|
||||
Comment[fi]=Hallinnoi järjestelmän päivitysten tilaa
|
||||
Comment[gl]=Controla o estado das actualizacións do sistema
|
||||
Comment[it]=Controlla lo stato degli aggiornamenti del sistema
|
||||
Comment[pt]=Controlar o estado das atualizações do sistema
|
||||
Icon=e-module-packagekit
|
||||
X-Enlightenment-ModuleType=system
|
Loading…
Reference in New Issue