Merge lp:~cjcurran/indicator-session/migrate-to-new-apt-api into lp:indicator-session/0.4
- migrate-to-new-apt-api
- Merge into trunk.0.4
Proposed by
Conor Curran
on 2012-02-08
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 237 | ||||
| Proposed branch: | lp:~cjcurran/indicator-session/migrate-to-new-apt-api | ||||
| Merge into: | lp:indicator-session/0.4 | ||||
| Diff against target: |
1020 lines (+190/-715) 7 files modified
configure.ac (+4/-2) src/Makefile.am (+1/-3) src/apt-transaction.c (+0/-263) src/apt-transaction.h (+0/-49) src/apt-watcher.c (+183/-397) src/apt-watcher.h (+0/-1) src/user-widget.c (+2/-0) |
||||
| To merge this branch: | bzr merge lp:~cjcurran/indicator-session/migrate-to-new-apt-api | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Ted Gould (community) | 2012-02-08 | Approve on 2012-02-08 | |
|
Review via email:
|
|||
This proposal supersedes a proposal from 2012-02-08.
Commit Message
Description of the Change
Brings correctness to the apt menuitem.
To post a comment you must log in.
lp:~cjcurran/indicator-session/migrate-to-new-apt-api
updated
on 2012-02-08
- 243. By Conor Curran on 2012-02-08
-
merge request comments acted upon
| Conor Curran (cjcurran) wrote : | # |
fixed in rev 243
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'configure.ac' |
| 2 | --- configure.ac 2012-02-07 22:46:27 +0000 |
| 3 | +++ configure.ac 2012-02-08 18:29:24 +0000 |
| 4 | @@ -63,7 +63,8 @@ |
| 5 | dbus-glib-1 |
| 6 | gudev-1.0 |
| 7 | gio-unix-2.0 |
| 8 | - indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION) |
| 9 | + indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION |
| 10 | + packagekit-glib2) |
| 11 | ], |
| 12 | [test "x$with_gtk" = x2], |
| 13 | [PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION |
| 14 | @@ -71,7 +72,8 @@ |
| 15 | gudev-1.0 |
| 16 | dbus-glib-1 |
| 17 | gio-unix-2.0 |
| 18 | - indicator-0.4 >= $INDICATOR_REQUIRED_VERSION) |
| 19 | + indicator-0.4 >= $INDICATOR_REQUIRED_VERSION |
| 20 | + packagekit-glib2) |
| 21 | ] |
| 22 | ) |
| 23 | |
| 24 | |
| 25 | === modified file 'src/Makefile.am' |
| 26 | --- src/Makefile.am 2011-11-23 21:59:19 +0000 |
| 27 | +++ src/Makefile.am 2012-02-08 18:29:24 +0000 |
| 28 | @@ -114,9 +114,7 @@ |
| 29 | if BUILD_APT |
| 30 | indicator_session_service_SOURCES += \ |
| 31 | apt-watcher.h \ |
| 32 | - apt-watcher.c \ |
| 33 | - apt-transaction.h \ |
| 34 | - apt-transaction.c |
| 35 | + apt-watcher.c |
| 36 | endif |
| 37 | |
| 38 | indicator_session_service_CFLAGS = \ |
| 39 | |
| 40 | === removed file 'src/apt-transaction.c' |
| 41 | --- src/apt-transaction.c 2011-10-09 14:39:05 +0000 |
| 42 | +++ src/apt-transaction.c 1970-01-01 00:00:00 +0000 |
| 43 | @@ -1,263 +0,0 @@ |
| 44 | -/* |
| 45 | -Copyright 2011 Canonical Ltd. |
| 46 | - |
| 47 | -Authors: |
| 48 | - Conor Curran <conor.curran@canonical.com> |
| 49 | - |
| 50 | -This program is free software: you can redistribute it and/or modify it |
| 51 | -under the terms of the GNU General Public License version 3, as published |
| 52 | -by the Free Software Foundation. |
| 53 | - |
| 54 | -This program is distributed in the hope that it will be useful, but |
| 55 | -WITHOUT ANY WARRANTY; without even the implied warranties of |
| 56 | -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 57 | -PURPOSE. See the GNU General Public License for more details. |
| 58 | - |
| 59 | -You should have received a copy of the GNU General Public License along |
| 60 | -with this program. If not, see <http://www.gnu.org/licenses/>. |
| 61 | -*/ |
| 62 | - |
| 63 | -#include <gio/gio.h> |
| 64 | - |
| 65 | -#include "apt-transaction.h" |
| 66 | -#include "dbus-shared-names.h" |
| 67 | - |
| 68 | -static void apt_transaction_investigate (AptTransaction* self); |
| 69 | -static void apt_transaction_simulate_transaction_cb (GObject * obj, |
| 70 | - GAsyncResult * res, |
| 71 | - gpointer user_data); |
| 72 | -static void apt_transaction_receive_signal (GDBusProxy * proxy, |
| 73 | - gchar * sender_name, |
| 74 | - gchar * signal_name, |
| 75 | - GVariant * parameters, |
| 76 | - gpointer user_data); |
| 77 | -static void apt_transaction_finish_proxy_setup (GObject *source_object, |
| 78 | - GAsyncResult *res, |
| 79 | - gpointer user_data); |
| 80 | - |
| 81 | -struct _AptTransaction |
| 82 | -{ |
| 83 | - GObject parent_instance; |
| 84 | - GDBusProxy * proxy; |
| 85 | - GCancellable * proxy_cancel; |
| 86 | - gchar* id; |
| 87 | - TransactionType type; |
| 88 | -}; |
| 89 | - |
| 90 | -enum { |
| 91 | - UPDATE, |
| 92 | - LAST_SIGNAL |
| 93 | -}; |
| 94 | - |
| 95 | -static guint signals[LAST_SIGNAL] = { 0 }; |
| 96 | - |
| 97 | -G_DEFINE_TYPE (AptTransaction, apt_transaction, G_TYPE_OBJECT); |
| 98 | - |
| 99 | -static void |
| 100 | -apt_transaction_init (AptTransaction *self) |
| 101 | -{ |
| 102 | - self->proxy = NULL; |
| 103 | - self->id = NULL; |
| 104 | - self->proxy_cancel = g_cancellable_new(); |
| 105 | -} |
| 106 | - |
| 107 | -static void |
| 108 | -apt_transaction_finalize (GObject *object) |
| 109 | -{ |
| 110 | - AptTransaction* self = APT_TRANSACTION(object); |
| 111 | - g_signal_handlers_disconnect_by_func (G_OBJECT (self->proxy), |
| 112 | - G_CALLBACK (apt_transaction_receive_signal), |
| 113 | - self); |
| 114 | - if (self->proxy != NULL){ |
| 115 | - g_object_unref (self->proxy); |
| 116 | - self->proxy = NULL; |
| 117 | - } |
| 118 | - g_free (self->id); |
| 119 | - G_OBJECT_CLASS (apt_transaction_parent_class)->finalize (object); |
| 120 | -} |
| 121 | - |
| 122 | -static void |
| 123 | -apt_transaction_class_init (AptTransactionClass *klass) |
| 124 | -{ |
| 125 | - GObjectClass* object_class = G_OBJECT_CLASS (klass); |
| 126 | - object_class->finalize = apt_transaction_finalize; |
| 127 | - |
| 128 | - signals[UPDATE] = g_signal_new("state-update", |
| 129 | - G_TYPE_FROM_CLASS (klass), |
| 130 | - G_SIGNAL_RUN_LAST, |
| 131 | - 0, |
| 132 | - NULL, NULL, |
| 133 | - g_cclosure_marshal_VOID__INT, |
| 134 | - G_TYPE_NONE, 1, G_TYPE_INT); |
| 135 | -} |
| 136 | - |
| 137 | -// TODO: you don't need this additional helper |
| 138 | -// Just GObject properties properly |
| 139 | -static void |
| 140 | -apt_transaction_investigate (AptTransaction* self) |
| 141 | -{ |
| 142 | - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, |
| 143 | - G_DBUS_PROXY_FLAGS_NONE, |
| 144 | - NULL, |
| 145 | - "org.debian.apt", |
| 146 | - self->id, |
| 147 | - "org.debian.apt.transaction", |
| 148 | - self->proxy_cancel, |
| 149 | - apt_transaction_finish_proxy_setup, |
| 150 | - self); |
| 151 | -} |
| 152 | - |
| 153 | -static void |
| 154 | -apt_transaction_finish_proxy_setup (GObject *source_object, |
| 155 | - GAsyncResult *res, |
| 156 | - gpointer user_data) |
| 157 | -{ |
| 158 | - g_return_if_fail (APT_IS_TRANSACTION (user_data)); |
| 159 | - AptTransaction* self = APT_TRANSACTION(user_data); |
| 160 | - GError * error = NULL; |
| 161 | - |
| 162 | - GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error); |
| 163 | - |
| 164 | - if (self->proxy_cancel != NULL) { |
| 165 | - g_object_unref(self->proxy_cancel); |
| 166 | - self->proxy_cancel = NULL; |
| 167 | - } |
| 168 | - |
| 169 | - if (error != NULL) { |
| 170 | - g_warning("Could not grab DBus proxy for %s: %s", |
| 171 | - "org.debian.apt", error->message); |
| 172 | - g_error_free(error); |
| 173 | - return; |
| 174 | - } |
| 175 | - |
| 176 | - self->proxy = proxy; |
| 177 | - |
| 178 | - g_signal_connect (G_OBJECT(self->proxy), |
| 179 | - "g-signal", |
| 180 | - G_CALLBACK (apt_transaction_receive_signal), |
| 181 | - self); |
| 182 | - |
| 183 | - if (self->type == SIMULATION){ |
| 184 | - g_dbus_proxy_call (self->proxy, |
| 185 | - "Simulate", |
| 186 | - NULL, |
| 187 | - G_DBUS_CALL_FLAGS_NONE, |
| 188 | - -1, |
| 189 | - NULL, |
| 190 | - apt_transaction_simulate_transaction_cb, |
| 191 | - self); |
| 192 | - } |
| 193 | -} |
| 194 | - |
| 195 | -static void |
| 196 | -apt_transaction_receive_signal (GDBusProxy * proxy, |
| 197 | - gchar * sender_name, |
| 198 | - gchar * signal_name, |
| 199 | - GVariant * parameters, |
| 200 | - gpointer user_data) |
| 201 | -{ |
| 202 | - g_return_if_fail (APT_IS_TRANSACTION (user_data)); |
| 203 | - AptTransaction* self = APT_TRANSACTION(user_data); |
| 204 | - AptState current_state = DONT_KNOW; |
| 205 | - |
| 206 | - if (g_strcmp0(signal_name, "PropertyChanged") == 0) |
| 207 | - { |
| 208 | - gchar* prop_name= NULL; |
| 209 | - GVariant* value = NULL; |
| 210 | - g_variant_get (parameters, "(sv)", &prop_name, &value); |
| 211 | - g_debug ("transaction prop update - prop = %s", prop_name); |
| 212 | - |
| 213 | - if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING) == TRUE){ |
| 214 | - gchar* key = NULL; |
| 215 | - g_variant_get (value, "s", &key); |
| 216 | - g_debug ("transaction prop update - value = %s", key); |
| 217 | - } |
| 218 | - |
| 219 | - if (g_strcmp0 (prop_name, "Dependencies") == 0){ |
| 220 | - |
| 221 | - gchar** install = NULL; |
| 222 | - gchar** reinstall = NULL; |
| 223 | - gchar** remove = NULL; |
| 224 | - gchar** purge = NULL; |
| 225 | - gchar** upgrade = NULL; |
| 226 | - gchar** downgrade = NULL; |
| 227 | - gchar** keep = NULL; |
| 228 | - g_variant_get (value, "(asasasasasasas)", &install, |
| 229 | - &reinstall, &remove, &purge, &upgrade, &downgrade, |
| 230 | - &keep); |
| 231 | - /* |
| 232 | - g_debug ("upgrade package length %i", g_strv_length(upgrade)); |
| 233 | - g_debug ("install package length %i", g_strv_length(install)); |
| 234 | - g_debug ("reinstall package length %i", g_strv_length(reinstall)); |
| 235 | - g_debug ("remove package length %i", g_strv_length(remove)); |
| 236 | - g_debug ("purge package length %i", g_strv_length(purge)); |
| 237 | - */ |
| 238 | - gboolean upgrade_needed = (g_strv_length(upgrade) > 1) || |
| 239 | - (g_strv_length(install) > 1) || |
| 240 | - (g_strv_length(reinstall) > 1) || |
| 241 | - (g_strv_length(remove) > 1) || |
| 242 | - (g_strv_length(purge) > 1); |
| 243 | - if (upgrade_needed == TRUE){ |
| 244 | - current_state = UPDATES_AVAILABLE; |
| 245 | - } |
| 246 | - else{ |
| 247 | - current_state = UP_TO_DATE; |
| 248 | - } |
| 249 | - } |
| 250 | - if (self->type == REAL) |
| 251 | - { |
| 252 | - GVariant* role = g_dbus_proxy_get_cached_property (self->proxy, |
| 253 | - "Role"); |
| 254 | - if (g_variant_is_of_type (role, G_VARIANT_TYPE_STRING) == TRUE){ |
| 255 | - gchar* current_role = NULL; |
| 256 | - g_variant_get (role, "s", ¤t_role); |
| 257 | - //g_debug ("Current transaction role = %s", current_role); |
| 258 | - if (g_strcmp0 (current_role, "role-commit-packages") == 0 || |
| 259 | - g_strcmp0 (current_role, "role-upgrade-system") == 0){ |
| 260 | - g_debug ("UPGRADE IN PROGRESS"); |
| 261 | - current_state = UPGRADE_IN_PROGRESS; |
| 262 | - } |
| 263 | - } |
| 264 | - } |
| 265 | - } |
| 266 | - else if (g_strcmp0(signal_name, "Finished") == 0) |
| 267 | - { |
| 268 | - g_debug ("TRANSACTION Finished"); |
| 269 | - current_state = FINISHED; |
| 270 | - } |
| 271 | - // Finally send out the state update |
| 272 | - if (current_state != DONT_KNOW){ |
| 273 | - g_signal_emit (self, |
| 274 | - signals[UPDATE], |
| 275 | - 0, |
| 276 | - current_state); |
| 277 | - } |
| 278 | -} |
| 279 | - |
| 280 | -static void |
| 281 | -apt_transaction_simulate_transaction_cb (GObject * obj, |
| 282 | - GAsyncResult * res, |
| 283 | - gpointer user_data) |
| 284 | -{ |
| 285 | - GError * error = NULL; |
| 286 | - if (error != NULL) { |
| 287 | - g_warning ("unable to complete the simulate call"); |
| 288 | - g_error_free (error); |
| 289 | - return; |
| 290 | - } |
| 291 | -} |
| 292 | -TransactionType |
| 293 | -apt_transaction_get_transaction_type (AptTransaction* self) |
| 294 | -{ |
| 295 | - return self->type; |
| 296 | -} |
| 297 | - |
| 298 | -AptTransaction* apt_transaction_new (gchar* transaction_id, TransactionType t) |
| 299 | -{ |
| 300 | - AptTransaction* tr = g_object_new (APT_TYPE_TRANSACTION, NULL); |
| 301 | - tr->id = transaction_id; |
| 302 | - tr->type = t; |
| 303 | - g_debug ("Apt transaction new id = %s", tr->id); |
| 304 | - apt_transaction_investigate (tr); |
| 305 | - return tr; |
| 306 | -} |
| 307 | |
| 308 | === removed file 'src/apt-transaction.h' |
| 309 | --- src/apt-transaction.h 2011-07-22 14:36:59 +0000 |
| 310 | +++ src/apt-transaction.h 1970-01-01 00:00:00 +0000 |
| 311 | @@ -1,49 +0,0 @@ |
| 312 | -/* |
| 313 | -Copyright 2011 Canonical Ltd. |
| 314 | - |
| 315 | -Authors: |
| 316 | - Conor Curran <conor.curran@canonical.com> |
| 317 | - |
| 318 | -This program is free software: you can redistribute it and/or modify it |
| 319 | -under the terms of the GNU General Public License version 3, as published |
| 320 | -by the Free Software Foundation. |
| 321 | - |
| 322 | -This program is distributed in the hope that it will be useful, but |
| 323 | -WITHOUT ANY WARRANTY; without even the implied warranties of |
| 324 | -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 325 | -PURPOSE. See the GNU General Public License for more details. |
| 326 | - |
| 327 | -You should have received a copy of the GNU General Public License along |
| 328 | -with this program. If not, see <http://www.gnu.org/licenses/>. |
| 329 | -*/ |
| 330 | - |
| 331 | -#ifndef _APT_TRANSACTION_H_ |
| 332 | -#define _APT_TRANSACTION_H_ |
| 333 | - |
| 334 | -#include <glib-object.h> |
| 335 | -#include "dbus-shared-names.h" |
| 336 | - |
| 337 | -G_BEGIN_DECLS |
| 338 | - |
| 339 | -#define APT_TYPE_TRANSACTION (apt_transaction_get_type ()) |
| 340 | -#define APT_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APT_TYPE_TRANSACTION, AptTransaction)) |
| 341 | -#define APT_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APT_TYPE_TRANSACTION, AptTransactionClass)) |
| 342 | -#define APT_IS_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APT_TYPE_TRANSACTION)) |
| 343 | -#define APT_IS_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APT_TYPE_TRANSACTION)) |
| 344 | -#define APT_TRANSACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APT_TYPE_TRANSACTION, AptTransactionClass)) |
| 345 | - |
| 346 | -typedef struct _AptTransactionClass AptTransactionClass; |
| 347 | -typedef struct _AptTransaction AptTransaction; |
| 348 | - |
| 349 | -struct _AptTransactionClass |
| 350 | -{ |
| 351 | - GObjectClass parent_class; |
| 352 | -}; |
| 353 | - |
| 354 | -AptTransaction* apt_transaction_new (gchar* transaction_id, TransactionType t); |
| 355 | -TransactionType apt_transaction_get_transaction_type (AptTransaction* self); |
| 356 | -GType apt_transaction_get_type (void) G_GNUC_CONST; |
| 357 | - |
| 358 | -G_END_DECLS |
| 359 | - |
| 360 | -#endif /* _APT_TRANSACTION_H_ */ |
| 361 | |
| 362 | === modified file 'src/apt-watcher.c' |
| 363 | --- src/apt-watcher.c 2011-10-09 14:37:46 +0000 |
| 364 | +++ src/apt-watcher.c 2012-02-08 18:29:24 +0000 |
| 365 | @@ -17,217 +17,196 @@ |
| 366 | with this program. If not, see <http://www.gnu.org/licenses/>. |
| 367 | */ |
| 368 | |
| 369 | -#include <gio/gio.h> |
| 370 | +// Conor - 6/2/2012 |
| 371 | +// Please pull in packagekit's client lib |
| 372 | +// using apt-get install --no-install-recommends libpackagekit-glib2-dev |
| 373 | +// make sure you don't install package-kit |
| 374 | +#define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE |
| 375 | + |
| 376 | #include <glib/gi18n.h> |
| 377 | +#include <packagekit-glib2/packagekit.h> |
| 378 | #include "apt-watcher.h" |
| 379 | -#include "apt-transaction.h" |
| 380 | +#include "dbus-shared-names.h" |
| 381 | |
| 382 | static guint watcher_id; |
| 383 | |
| 384 | struct _AptWatcher |
| 385 | { |
| 386 | GObject parent_instance; |
| 387 | - guint reboot_query; |
| 388 | - GCancellable * proxy_cancel; |
| 389 | - GDBusProxy * proxy; |
| 390 | SessionDbus* session_dbus_interface; |
| 391 | DbusmenuMenuitem* apt_item; |
| 392 | AptState current_state; |
| 393 | - AptTransaction* current_transaction; |
| 394 | + GCancellable * proxy_cancel; |
| 395 | + GDBusProxy * proxy; |
| 396 | }; |
| 397 | - |
| 398 | -static void |
| 399 | -apt_watcher_on_name_appeared (GDBusConnection *connection, |
| 400 | - const gchar *name, |
| 401 | - const gchar *name_owner, |
| 402 | - gpointer user_data); |
| 403 | -static void |
| 404 | -apt_watcher_on_name_vanished (GDBusConnection *connection, |
| 405 | - const gchar *name, |
| 406 | - gpointer user_data); |
| 407 | -static void fetch_proxy_cb (GObject * object, |
| 408 | - GAsyncResult * res, |
| 409 | - gpointer user_data); |
| 410 | - |
| 411 | -static void apt_watcher_upgrade_system_cb (GObject * obj, |
| 412 | - GAsyncResult * res, |
| 413 | - gpointer user_data); |
| 414 | - |
| 415 | - |
| 416 | -static void apt_watcher_show_apt_dialog (DbusmenuMenuitem* mi, |
| 417 | - guint timestamp, |
| 418 | - gpointer userdata); |
| 419 | - |
| 420 | -static void apt_watcher_signal_cb (GDBusProxy* proxy, |
| 421 | - gchar* sender_name, |
| 422 | - gchar* signal_name, |
| 423 | - GVariant* parameters, |
| 424 | - gpointer user_data); |
| 425 | -static void apt_watcher_manage_transactions (AptWatcher* self, |
| 426 | - gchar* transaction_id); |
| 427 | -static gboolean apt_watcher_query_reboot_status (gpointer self); |
| 428 | -static void apt_watcher_transaction_state_simulation_update_cb (AptTransaction* trans, |
| 429 | - gint update, |
| 430 | - gpointer user_data); |
| 431 | -static void apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, |
| 432 | - gint update, |
| 433 | - gpointer user_data); |
| 434 | -static gboolean apt_watcher_start_apt_interaction (gpointer data); |
| 435 | - |
| 436 | + |
| 437 | G_DEFINE_TYPE (AptWatcher, apt_watcher, G_TYPE_OBJECT); |
| 438 | |
| 439 | -static void |
| 440 | -apt_watcher_init (AptWatcher *self) |
| 441 | -{ |
| 442 | - self->current_state = UP_TO_DATE; |
| 443 | - self->proxy_cancel = g_cancellable_new(); |
| 444 | - self->proxy = NULL; |
| 445 | - self->reboot_query = 0; |
| 446 | - self->current_transaction = NULL; |
| 447 | - g_timeout_add_seconds (60, |
| 448 | - apt_watcher_start_apt_interaction, |
| 449 | - self); |
| 450 | -} |
| 451 | - |
| 452 | -static gboolean |
| 453 | -apt_watcher_start_apt_interaction (gpointer data) |
| 454 | -{ |
| 455 | - g_return_val_if_fail (APT_IS_WATCHER (data), FALSE); |
| 456 | - AptWatcher* self = APT_WATCHER (data); |
| 457 | - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, |
| 458 | - G_DBUS_PROXY_FLAGS_NONE, |
| 459 | - NULL, |
| 460 | - "org.debian.apt", |
| 461 | - "/org/debian/apt", |
| 462 | - "org.debian.apt", |
| 463 | - self->proxy_cancel, |
| 464 | - fetch_proxy_cb, |
| 465 | - self); |
| 466 | - return FALSE; |
| 467 | -} |
| 468 | - |
| 469 | -static void |
| 470 | -apt_watcher_finalize (GObject *object) |
| 471 | -{ |
| 472 | - g_bus_unwatch_name (watcher_id); |
| 473 | - AptWatcher* self = APT_WATCHER (object); |
| 474 | - |
| 475 | - if (self->proxy != NULL) |
| 476 | - g_object_unref (self->proxy); |
| 477 | - |
| 478 | - G_OBJECT_CLASS (apt_watcher_parent_class)->finalize (object); |
| 479 | -} |
| 480 | - |
| 481 | -static void |
| 482 | -apt_watcher_class_init (AptWatcherClass *klass) |
| 483 | -{ |
| 484 | - GObjectClass* object_class = G_OBJECT_CLASS (klass); |
| 485 | - object_class->finalize = apt_watcher_finalize; |
| 486 | + |
| 487 | +static void |
| 488 | +get_updates_complete (GObject *source_object, |
| 489 | + GAsyncResult *res, |
| 490 | + gpointer user_data) |
| 491 | +{ |
| 492 | + g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 493 | + AptWatcher* self = APT_WATCHER (user_data); |
| 494 | + |
| 495 | + PkResults *results; |
| 496 | + GError *error = NULL; |
| 497 | + results = pk_client_generic_finish (PK_CLIENT(source_object), res, &error); |
| 498 | + |
| 499 | + if (error != NULL){ |
| 500 | + g_warning ("Unable to query for updates - error - %s", error->message); |
| 501 | + return; |
| 502 | + } |
| 503 | + |
| 504 | + GPtrArray *packages; |
| 505 | + packages = pk_results_get_package_array (results); |
| 506 | + |
| 507 | + const gchar* disposition; |
| 508 | + disposition = dbusmenu_menuitem_property_get (self->apt_item, |
| 509 | + DBUSMENU_MENUITEM_PROP_DISPOSITION); |
| 510 | + gboolean do_update; |
| 511 | + do_update = g_strcmp0 (disposition, DBUSMENU_MENUITEM_DISPOSITION_ALERT) != 0; |
| 512 | + |
| 513 | + if (packages->len > 0){ |
| 514 | + g_print ("Apparently we have updates available - change dbmitem %i", do_update); |
| 515 | + if (do_update) |
| 516 | + dbusmenu_menuitem_property_set (self->apt_item, |
| 517 | + DBUSMENU_MENUITEM_PROP_LABEL, |
| 518 | + _("Updates Available…")); |
| 519 | + } |
| 520 | + else{ |
| 521 | + g_print ("No updates available - change dbmitem - %i", do_update); |
| 522 | + if (do_update) |
| 523 | + dbusmenu_menuitem_property_set (self->apt_item, |
| 524 | + DBUSMENU_MENUITEM_PROP_LABEL, |
| 525 | + _("Software Up to Date")); |
| 526 | + } |
| 527 | + g_ptr_array_unref (packages); |
| 528 | + g_object_unref (results); |
| 529 | + g_object_unref (source_object); |
| 530 | +} |
| 531 | + |
| 532 | +static void |
| 533 | +apt_watcher_check_for_updates (AptWatcher* self) |
| 534 | +{ |
| 535 | + PkClient* client; |
| 536 | + client = pk_client_new (); |
| 537 | + |
| 538 | + pk_client_get_updates_async (client, |
| 539 | + PK_FILTER_ENUM_NONE, |
| 540 | + NULL, NULL, NULL, |
| 541 | + (GAsyncReadyCallback)get_updates_complete, |
| 542 | + self); |
| 543 | +} |
| 544 | + |
| 545 | +static void apt_watcher_signal_cb ( GDBusProxy* proxy, |
| 546 | + gchar* sender_name, |
| 547 | + gchar* signal_name, |
| 548 | + GVariant* parameters, |
| 549 | + gpointer user_data) |
| 550 | +{ |
| 551 | + g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 552 | + AptWatcher* self = APT_WATCHER (user_data); |
| 553 | + |
| 554 | + g_debug ("apt-watcher-signal cb signal name - %s", signal_name); |
| 555 | + if (g_strcmp0(signal_name, "UpdatesChanged") == 0){ |
| 556 | + g_debug ("updates changed signal received"); |
| 557 | + apt_watcher_check_for_updates (self); |
| 558 | + } |
| 559 | + else if (g_strcmp0(signal_name, "RestartScheduled") == 0) { |
| 560 | + g_debug ("RestartScheduled signal received"); |
| 561 | + dbusmenu_menuitem_property_set (self->apt_item, |
| 562 | + DBUSMENU_MENUITEM_PROP_LABEL, |
| 563 | + _("Restart to Complete Updates…")); |
| 564 | + dbusmenu_menuitem_property_set (self->apt_item, |
| 565 | + DBUSMENU_MENUITEM_PROP_DISPOSITION, |
| 566 | + DBUSMENU_MENUITEM_DISPOSITION_ALERT); |
| 567 | + } |
| 568 | +} |
| 569 | + |
| 570 | +static void |
| 571 | +apt_watcher_on_name_appeared (GDBusConnection *connection, |
| 572 | + const gchar *name, |
| 573 | + const gchar *name_owner, |
| 574 | + gpointer user_data) |
| 575 | +{ |
| 576 | + g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 577 | + // AptWatcher* watcher = APT_WATCHER (user_data); |
| 578 | + |
| 579 | + g_print ("Name %s on %s is owned by %s\n", |
| 580 | + name, |
| 581 | + "the system bus", |
| 582 | + name_owner); |
| 583 | +} |
| 584 | + |
| 585 | + |
| 586 | +static void |
| 587 | +apt_watcher_on_name_vanished (GDBusConnection *connection, |
| 588 | + const gchar *name, |
| 589 | + gpointer user_data) |
| 590 | +{ |
| 591 | + g_debug ("Name %s does not exist or has just vanished", |
| 592 | + name); |
| 593 | + g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 594 | } |
| 595 | |
| 596 | static void |
| 597 | fetch_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) |
| 598 | { |
| 599 | - GError * error = NULL; |
| 600 | - |
| 601 | - AptWatcher* self = APT_WATCHER(user_data); |
| 602 | - g_return_if_fail(self != NULL); |
| 603 | - |
| 604 | - GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error); |
| 605 | - |
| 606 | - if (self->proxy_cancel != NULL) { |
| 607 | - g_object_unref(self->proxy_cancel); |
| 608 | - self->proxy_cancel = NULL; |
| 609 | - } |
| 610 | - |
| 611 | - if (error != NULL) { |
| 612 | - g_warning("Could not grab DBus proxy for %s: %s", |
| 613 | + GError * error = NULL; |
| 614 | + |
| 615 | + AptWatcher* self = APT_WATCHER(user_data); |
| 616 | + g_return_if_fail(self != NULL); |
| 617 | + |
| 618 | + GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish (res, &error); |
| 619 | + |
| 620 | + if (self->proxy_cancel != NULL) { |
| 621 | + g_object_unref (self->proxy_cancel); |
| 622 | + self->proxy_cancel = NULL; |
| 623 | + } |
| 624 | + |
| 625 | + if (error != NULL) { |
| 626 | + g_warning("Could not grab DBus proxy for %s: %s", |
| 627 | "org.debian.apt", error->message); |
| 628 | - g_error_free(error); |
| 629 | - return; |
| 630 | - } |
| 631 | + g_error_free(error); |
| 632 | + return; |
| 633 | + } |
| 634 | |
| 635 | - self->proxy = proxy; |
| 636 | + self->proxy = proxy; |
| 637 | // Set up the watch. |
| 638 | watcher_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM, |
| 639 | - "org.debian.apt", |
| 640 | + "org.freedesktop.PackageKit", |
| 641 | G_BUS_NAME_WATCHER_FLAGS_NONE, |
| 642 | apt_watcher_on_name_appeared, |
| 643 | apt_watcher_on_name_vanished, |
| 644 | self, |
| 645 | - NULL); |
| 646 | - |
| 647 | - g_signal_connect (self->proxy, |
| 648 | + NULL); |
| 649 | + g_signal_connect (self->proxy, |
| 650 | "g-signal", |
| 651 | G_CALLBACK(apt_watcher_signal_cb), |
| 652 | self); |
| 653 | } |
| 654 | |
| 655 | -static void |
| 656 | -apt_watcher_on_name_appeared (GDBusConnection *connection, |
| 657 | - const gchar *name, |
| 658 | - const gchar *name_owner, |
| 659 | - gpointer user_data) |
| 660 | -{ |
| 661 | - g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 662 | - AptWatcher* watcher = APT_WATCHER (user_data); |
| 663 | - |
| 664 | - g_print ("Name %s on %s is owned by %s\n", |
| 665 | - name, |
| 666 | - "the system bus", |
| 667 | - name_owner); |
| 668 | - |
| 669 | - g_dbus_proxy_call (watcher->proxy, |
| 670 | - "UpgradeSystem", |
| 671 | - g_variant_new("(b)", TRUE), |
| 672 | - G_DBUS_CALL_FLAGS_NONE, |
| 673 | - -1, |
| 674 | - NULL, |
| 675 | - apt_watcher_upgrade_system_cb, |
| 676 | - user_data); |
| 677 | -} |
| 678 | - |
| 679 | - |
| 680 | -static void |
| 681 | -apt_watcher_on_name_vanished (GDBusConnection *connection, |
| 682 | - const gchar *name, |
| 683 | - gpointer user_data) |
| 684 | -{ |
| 685 | - g_debug ("Name %s does not exist or has just vanished", |
| 686 | - name); |
| 687 | - g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 688 | -} |
| 689 | - |
| 690 | -static void |
| 691 | -apt_watcher_upgrade_system_cb (GObject * obj, |
| 692 | - GAsyncResult * res, |
| 693 | - gpointer user_data) |
| 694 | -{ |
| 695 | - g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 696 | - AptWatcher* self = APT_WATCHER (user_data); |
| 697 | - |
| 698 | - GError * error = NULL; |
| 699 | - GVariant * result; |
| 700 | - |
| 701 | - result = g_dbus_proxy_call_finish(self->proxy, res, &error); |
| 702 | - |
| 703 | - if (error != NULL) { |
| 704 | - g_warning ("unable to complete the UpgradeSystem apt call"); |
| 705 | - g_error_free (error); |
| 706 | - return; |
| 707 | - } |
| 708 | - |
| 709 | - gchar* transaction_id = NULL; |
| 710 | - g_variant_get (result, "(s)", &transaction_id); |
| 711 | - |
| 712 | - if (transaction_id == NULL){ |
| 713 | - g_warning ("apt_watcher_upgrade_system_cb - transaction id is null"); |
| 714 | - return; |
| 715 | - } |
| 716 | - |
| 717 | - apt_watcher_manage_transactions (self, transaction_id); |
| 718 | - |
| 719 | -} |
| 720 | +static gboolean |
| 721 | +apt_watcher_start_apt_interaction (gpointer data) |
| 722 | +{ |
| 723 | + g_return_val_if_fail (APT_IS_WATCHER (data), FALSE); |
| 724 | + AptWatcher* self = APT_WATCHER (data); |
| 725 | + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, |
| 726 | + G_DBUS_PROXY_FLAGS_NONE, |
| 727 | + NULL, |
| 728 | + "org.freedesktop.PackageKit", |
| 729 | + "/org/freedesktop/PackageKit", |
| 730 | + "org.freedesktop.PackageKit", |
| 731 | + self->proxy_cancel, |
| 732 | + fetch_proxy_cb, |
| 733 | + self); |
| 734 | + apt_watcher_check_for_updates (self); |
| 735 | + return FALSE; |
| 736 | +} |
| 737 | + |
| 738 | |
| 739 | static void |
| 740 | apt_watcher_show_apt_dialog (DbusmenuMenuitem * mi, |
| 741 | @@ -261,224 +240,31 @@ |
| 742 | } |
| 743 | |
| 744 | static void |
| 745 | -apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, |
| 746 | - gint update, |
| 747 | - gpointer user_data) |
| 748 | -{ |
| 749 | - g_debug ("apt-watcher -transaction update %i", update); |
| 750 | - g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 751 | - AptWatcher* self = APT_WATCHER (user_data); |
| 752 | - |
| 753 | - AptState state = (AptState)update; |
| 754 | - if (self->current_state != RESTART_NEEDED) |
| 755 | - { |
| 756 | - if (state == UP_TO_DATE){ |
| 757 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 758 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 759 | - _("Software Up to Date")); |
| 760 | - self->current_state = state; |
| 761 | - } |
| 762 | - else if (state == UPDATES_AVAILABLE){ |
| 763 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 764 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 765 | - _("Updates Available…")); |
| 766 | - self->current_state = state; |
| 767 | - } |
| 768 | - else if (state == UPGRADE_IN_PROGRESS){ |
| 769 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 770 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 771 | - _("Updates Installing…")); |
| 772 | - self->current_state = state; |
| 773 | - } |
| 774 | - else if (state == FINISHED){ |
| 775 | - gboolean query_again = FALSE; |
| 776 | - |
| 777 | - // Only query if the previous state was an upgrade. |
| 778 | - if (self->current_state != UPGRADE_IN_PROGRESS){ |
| 779 | - query_again = TRUE; |
| 780 | - } |
| 781 | - else{ |
| 782 | - if (self->reboot_query != 0){ |
| 783 | - g_source_remove (self->reboot_query); |
| 784 | - self->reboot_query = 0; |
| 785 | - } |
| 786 | - self->reboot_query = g_timeout_add_seconds (1, |
| 787 | - apt_watcher_query_reboot_status, |
| 788 | - self); |
| 789 | - } |
| 790 | - self->current_state = state; |
| 791 | - |
| 792 | - g_object_unref (G_OBJECT(self->current_transaction)); |
| 793 | - self->current_transaction = NULL; |
| 794 | - |
| 795 | - // It is impossible to determine from a 'real' transaction whether |
| 796 | - // updates are available therefore it is necessary to check again via a |
| 797 | - // simulation whether there are updates available. |
| 798 | - if (query_again){ |
| 799 | - g_dbus_proxy_call (self->proxy, |
| 800 | - "UpgradeSystem", |
| 801 | - g_variant_new("(b)", TRUE), |
| 802 | - G_DBUS_CALL_FLAGS_NONE, |
| 803 | - -1, |
| 804 | - NULL, |
| 805 | - apt_watcher_upgrade_system_cb, |
| 806 | - self); |
| 807 | - } |
| 808 | - } |
| 809 | - } |
| 810 | -} |
| 811 | - |
| 812 | - |
| 813 | -static void |
| 814 | -apt_watcher_transaction_state_simulation_update_cb (AptTransaction* trans, |
| 815 | - gint update, |
| 816 | - gpointer user_data) |
| 817 | -{ |
| 818 | - g_debug ("apt-watcher -transaction update %i", update); |
| 819 | - g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 820 | - AptWatcher* self = APT_WATCHER (user_data); |
| 821 | - |
| 822 | - AptState state = (AptState)update; |
| 823 | - if (self->current_state != RESTART_NEEDED) |
| 824 | - { |
| 825 | - if (state == UP_TO_DATE){ |
| 826 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 827 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 828 | - _("Software Up to Date")); |
| 829 | - if (self->reboot_query != 0){ |
| 830 | - g_source_remove (self->reboot_query); |
| 831 | - self->reboot_query = 0; |
| 832 | - } |
| 833 | - self->reboot_query = g_timeout_add_seconds (1, |
| 834 | - apt_watcher_query_reboot_status, |
| 835 | - self); |
| 836 | - } |
| 837 | - else if (state == UPDATES_AVAILABLE){ |
| 838 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 839 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 840 | - _("Updates Available…")); |
| 841 | - } |
| 842 | - else if (state == UPGRADE_IN_PROGRESS){ |
| 843 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 844 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 845 | - _("Updates Installing…")); |
| 846 | - } |
| 847 | - self->current_state = state; |
| 848 | - } |
| 849 | - if (self->current_state != UPGRADE_IN_PROGRESS){ |
| 850 | - g_object_unref (G_OBJECT(self->current_transaction)); |
| 851 | - self->current_transaction = NULL; |
| 852 | - } |
| 853 | -} |
| 854 | - |
| 855 | -static void |
| 856 | -apt_watcher_manage_transactions (AptWatcher* self, gchar* transaction_id) |
| 857 | -{ |
| 858 | - if (self->current_transaction == NULL){ |
| 859 | - self->current_transaction = apt_transaction_new (transaction_id, SIMULATION); |
| 860 | - g_signal_connect (G_OBJECT(self->current_transaction), |
| 861 | - "state-update", |
| 862 | - G_CALLBACK(apt_watcher_transaction_state_simulation_update_cb), self); |
| 863 | - } |
| 864 | -} |
| 865 | - |
| 866 | -static gboolean |
| 867 | -apt_watcher_query_reboot_status (gpointer data) |
| 868 | -{ |
| 869 | - g_return_val_if_fail (APT_IS_WATCHER (data), FALSE); |
| 870 | - AptWatcher* self = APT_WATCHER (data); |
| 871 | - |
| 872 | - GVariant* reboot_result = g_dbus_proxy_get_cached_property (self->proxy, |
| 873 | - "RebootRequired"); |
| 874 | - gboolean reboot = FALSE; |
| 875 | - g_variant_get (reboot_result, "b", &reboot); |
| 876 | - g_debug ("apt_watcher_query_reboot_status: reboot prop = %i", reboot); |
| 877 | - if (reboot == FALSE){ |
| 878 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 879 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 880 | - _("Software Up to Date")); |
| 881 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 882 | - DBUSMENU_MENUITEM_PROP_DISPOSITION, |
| 883 | - DBUSMENU_MENUITEM_DISPOSITION_NORMAL); |
| 884 | - |
| 885 | - } |
| 886 | - else{ |
| 887 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 888 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 889 | - _("Restart to Complete Updates…")); |
| 890 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 891 | - DBUSMENU_MENUITEM_PROP_DISPOSITION, |
| 892 | - DBUSMENU_MENUITEM_DISPOSITION_ALERT); |
| 893 | - session_dbus_restart_required (self->session_dbus_interface); |
| 894 | - self->current_state = RESTART_NEEDED; |
| 895 | - } |
| 896 | - self->reboot_query = 0; |
| 897 | - return FALSE; |
| 898 | -} |
| 899 | - |
| 900 | -static void apt_watcher_signal_cb ( GDBusProxy* proxy, |
| 901 | - gchar* sender_name, |
| 902 | - gchar* signal_name, |
| 903 | - GVariant* parameters, |
| 904 | - gpointer user_data) |
| 905 | -{ |
| 906 | - g_return_if_fail (APT_IS_WATCHER (user_data)); |
| 907 | - AptWatcher* self = APT_WATCHER (user_data); |
| 908 | - |
| 909 | - g_variant_ref_sink (parameters); |
| 910 | - GVariant *value = g_variant_get_child_value (parameters, 0); |
| 911 | - |
| 912 | - if (g_strcmp0(signal_name, "ActiveTransactionsChanged") == 0){ |
| 913 | - gchar* current = NULL; |
| 914 | - g_debug ("ActiveTransactionsChanged"); |
| 915 | - |
| 916 | - g_variant_get(value, "s", ¤t); |
| 917 | - |
| 918 | - if (g_str_has_prefix (current, "/org/debian/apt/transaction/") == TRUE){ |
| 919 | - g_debug ("ActiveTransactionsChanged - current is %s", current); |
| 920 | - |
| 921 | - // Cancel all existing operations. |
| 922 | - if (self->reboot_query != 0){ |
| 923 | - g_source_remove (self->reboot_query); |
| 924 | - self->reboot_query = 0; |
| 925 | - } |
| 926 | - |
| 927 | - if (self->current_transaction != NULL) |
| 928 | - { |
| 929 | - g_object_unref (G_OBJECT(self->current_transaction)); |
| 930 | - self->current_transaction = NULL; |
| 931 | - } |
| 932 | - |
| 933 | - self->current_transaction = apt_transaction_new (current, REAL); |
| 934 | - g_signal_connect (G_OBJECT(self->current_transaction), |
| 935 | - "state-update", |
| 936 | - G_CALLBACK(apt_watcher_transaction_state_real_update_cb), self); |
| 937 | - } |
| 938 | - } |
| 939 | - else if (g_strcmp0(signal_name, "PropertyChanged") == 0) |
| 940 | - { |
| 941 | - gchar* prop_name= NULL; |
| 942 | - GVariant* value = NULL; |
| 943 | - g_variant_get (parameters, "(sv)", &prop_name, &value); |
| 944 | - g_debug ("transaction prop update - prop = %s", prop_name); |
| 945 | - |
| 946 | - if (g_strcmp0 (prop_name, "RebootRequired") == 0){ |
| 947 | - gboolean reboot_required = FALSE; |
| 948 | - g_variant_get (value, "(b)", &reboot_required); |
| 949 | - if (reboot_required){ |
| 950 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 951 | - DBUSMENU_MENUITEM_PROP_LABEL, |
| 952 | - _("Restart to Complete Updates…")); |
| 953 | - dbusmenu_menuitem_property_set (self->apt_item, |
| 954 | - DBUSMENU_MENUITEM_PROP_DISPOSITION, |
| 955 | - DBUSMENU_MENUITEM_DISPOSITION_ALERT); |
| 956 | - self->current_state = RESTART_NEEDED; |
| 957 | - } |
| 958 | - } |
| 959 | - } |
| 960 | - |
| 961 | - g_variant_unref (value); |
| 962 | - g_variant_unref (parameters); |
| 963 | +apt_watcher_init (AptWatcher *self) |
| 964 | +{ |
| 965 | + self->current_state = UP_TO_DATE; |
| 966 | + g_timeout_add_seconds (60, |
| 967 | + apt_watcher_start_apt_interaction, |
| 968 | + self); |
| 969 | +} |
| 970 | + |
| 971 | +static void |
| 972 | +apt_watcher_finalize (GObject *object) |
| 973 | +{ |
| 974 | + g_bus_unwatch_name (watcher_id); |
| 975 | + AptWatcher* self = APT_WATCHER (object); |
| 976 | + |
| 977 | + if (self->proxy != NULL) |
| 978 | + g_object_unref (self->proxy); |
| 979 | + |
| 980 | + G_OBJECT_CLASS (apt_watcher_parent_class)->finalize (object); |
| 981 | +} |
| 982 | + |
| 983 | +static void |
| 984 | +apt_watcher_class_init (AptWatcherClass *klass) |
| 985 | +{ |
| 986 | + GObjectClass* object_class = G_OBJECT_CLASS (klass); |
| 987 | + object_class->finalize = apt_watcher_finalize; |
| 988 | } |
| 989 | |
| 990 | AptWatcher* apt_watcher_new (SessionDbus* session_dbus, |
| 991 | |
| 992 | === modified file 'src/apt-watcher.h' |
| 993 | --- src/apt-watcher.h 2012-02-01 03:21:26 +0000 |
| 994 | +++ src/apt-watcher.h 2012-02-08 18:29:24 +0000 |
| 995 | @@ -50,7 +50,6 @@ |
| 996 | |
| 997 | AptWatcher* apt_watcher_new (SessionDbus* session_dbus, |
| 998 | DbusmenuMenuitem* apt_item); |
| 999 | - |
| 1000 | G_END_DECLS |
| 1001 | |
| 1002 | #endif /* _APT_WATCHER_H_ */ |
| 1003 | |
| 1004 | === modified file 'src/user-widget.c' |
| 1005 | --- src/user-widget.c 2012-02-07 17:11:52 +0000 |
| 1006 | +++ src/user-widget.c 2012-02-08 18:29:24 +0000 |
| 1007 | @@ -136,11 +136,13 @@ |
| 1008 | gtk_misc_set_padding (GTK_MISC(priv->user_image),0, 4.0); |
| 1009 | |
| 1010 | priv->user_name = gtk_label_new (""); |
| 1011 | + |
| 1012 | #if HAVE_GTK3 |
| 1013 | priv->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); |
| 1014 | #else |
| 1015 | priv->container = gtk_hbox_new (FALSE, 0); |
| 1016 | #endif |
| 1017 | + |
| 1018 | priv->tick_icon = gtk_image_new_from_icon_name ("account-logged-in", |
| 1019 | GTK_ICON_SIZE_MENU); |
| 1020 | gtk_misc_set_alignment(GTK_MISC(priv->tick_icon), 1.0, 0.5); |

Some little things, nothing major:
* pk_client_ generic_ finish, should really use the error parameter to get a cleaner error signal_ name, "TransactionLis tChanged" ) == 0) { get_child_ value (parameters, 0); on_name_ appeared and apt_watcher_ on_name_ vanished as well names.h"
* Should probably just drop this code:
569 + else if (g_strcmp0(
570 + GVariant *value = g_variant_
571 + g_variant_unref (value);
572 +
573 + }
* I think we can drop apt_watcher_
* This should probably be in the C file instead of the H
+#include "dbus-shared-