1. jjacky
  2. kalu


jjacky  committed 747778b

kalu could crash on sysupgrade under certain circumstances, fixed. Couple minor changes.

- When performing a sysupgrade through kalu's updater, when (new) optionnal dependencies were to be listed, kalu would crash. Note that "only" kalu (aka the GUI) would crash, the updater part would still run fine and complete the upgrade, as the log (pacman.log) would show. Still pretty bad, and fixed.
- When starting a sysupgrade, the message in the log (pacman.log) is now "starting sysupgrade" to be more consistent with the message upon completion ("sysupgrade completed")
- Now using a mark in the GtkTextBuffer to scroll down when adding stuff to the log, as that seems to work better.

  • Participants
  • Parent commits 71c37d6
  • Branches default
  • Tags 0.0.6

Comments (0)

Files changed (4)

File kalu-dbus.c

View file
  • Ignore whitespace
     if (event == ALPM_EVENT_ADD_DONE)
-        printf("installed: %s %s\n", alpm_pkg_get_name (data1), alpm_pkg_get_version (data1));
         alpm_logaction (handle, "kalu: installed %s (%s)\n",
             alpm_pkg_get_name (data1),
             alpm_pkg_get_version (data1));
     else if (event == ALPM_EVENT_REMOVE_DONE)
-        printf("removed: %s %s\n", alpm_pkg_get_name (data1), alpm_pkg_get_version (data1));
         alpm_logaction (handle, "kalu: removed %s (%s)\n",
             alpm_pkg_get_name (data1),
             alpm_pkg_get_version (data1));
     else if (event == ALPM_EVENT_UPGRADE_DONE)
-        printf("upgraded: %s %s -> %s\n", alpm_pkg_get_name (data1), alpm_pkg_get_version (data2),
-            alpm_pkg_get_version (data1));
         alpm_logaction (handle, "kalu: upgraded %s (%s -> %s)\n",
             alpm_pkg_get_name (data1),
             alpm_pkg_get_version (data2),
     else if (event == ALPM_EVENT_CHECKDEPS_START)
         /* checking dependencies */
-        printf("check dep\n");
         emit_signal ("Event", "i", EVENT_CHECKING_DEPS);
     else if (event == ALPM_EVENT_RESOLVEDEPS_START)
         /* resolving dependencies */
-        printf("resolv dep\n");
         emit_signal ("Event", "i", EVENT_RESOLVING_DEPS);
     else if (event == ALPM_EVENT_SCRIPTLET_INFO)
-        printf("script; %s\n", (const char *) data1);
         emit_signal ("EventScriptlet", "s", data1);
     else if (event == ALPM_EVENT_DELTA_INTEGRITY_START)
     g_variant_unref (parameters);
-    alpm_logaction (handle, "kalu: upgrading system...\n");
+    alpm_logaction (handle, "kalu: starting sysupgrade...\n");
     alpm_list_t *alpm_data = NULL;
     if (alpm_trans_commit (handle, &alpm_data) == -1)

File kalu-updater.c

View file
  • Ignore whitespace
         g_variant_get (parameters, "(ssas)", &pkg, &version, &iter);
         while (g_variant_iter_loop (iter, "s", &dep))
-            optdeps = alpm_list_add (optdeps, dep);
+            optdeps = alpm_list_add (optdeps, strdup (dep));
         g_variant_iter_free (iter);
         g_signal_emit (kupdater, signals[SIGNAL_EVENT_INSTALLED], 0, pkg, version,
         g_variant_get (parameters, "(sssas)", &pkg, &old_version, &new_version, &iter);
         while (g_variant_iter_loop (iter, "s", &dep))
-            newoptdeps = alpm_list_add (newoptdeps, dep);
+            newoptdeps = alpm_list_add (newoptdeps, strdup (dep));
         g_variant_iter_free (iter);
         g_signal_emit (kupdater, signals[SIGNAL_EVENT_UPGRADED], 0, pkg,
         g_variant_get (parameters, "(as)", &iter);
         while (g_variant_iter_loop (iter, "s", &pkg))
-            pkgs = alpm_list_add (pkgs, pkg);
+            pkgs = alpm_list_add (pkgs, strdup (pkg));
         g_variant_iter_free (iter);

File kalu.h

View file
  • Ignore whitespace
 #define _UNUSED_            __attribute__ ((unused)) 
-#define KALU_VERSION       "0.0.5"
+#define KALU_VERSION       "0.0.6"
 #define KALU_TAG            "Keeping Arch Linux Up-to-date"
 #define MAX_PATH            255

File updater.c

View file
  • Ignore whitespace
 static void
 add_log (logtype_t type, const gchar *fmt, ...)
+    GtkTextMark *mark;
     GtkTextIter iter;
     gchar buffer[1024];
     const char *tag;
         gtk_expander_set_expanded (GTK_EXPANDER (updater->expander), TRUE);
-    gtk_text_buffer_get_end_iter (updater->buffer, &iter);
+    mark = gtk_text_buffer_get_mark (updater->buffer, "end-mark");
+    gtk_text_buffer_get_iter_at_mark (updater->buffer, &iter, mark);
     gtk_text_buffer_insert_with_tags_by_name (updater->buffer, &iter,
         buffer, -1, tag, NULL);
     /* scrolling to the end using gtk_text_view_scroll_to_iter doesn't work;
-     * using a mark like so does (insert mark is always at the end for us,
-     * with a read-only text-view) */
-    GtkTextMark *mark = gtk_text_buffer_get_insert (updater->buffer);
+     * using a mark like so seems to work better... */
     gtk_text_view_scroll_mark_onscreen ( GTK_TEXT_VIEW (updater->text_view), mark);
     gtk_label_set_text (GTK_LABEL (updater->lbl_action), buffer);
     gtk_widget_show (updater->lbl_action);
     gtk_widget_hide (updater->pbar_action);
-    //show_error (msg, buffer, GTK_WINDOW (updater->window));
     gtk_widget_set_sensitive (updater->btn_close, TRUE);
     if (is_first)
-        GtkTextIter iter;
-        gtk_text_buffer_get_end_iter (updater->buffer, &iter);
-        gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (updater->text_view),
-            &iter, 0, FALSE, 0, 0);
+        GtkTextMark *mark;
+        mark = gtk_text_buffer_get_mark (updater->buffer, "end-mark");
+        gtk_text_view_scroll_mark_onscreen ( GTK_TEXT_VIEW (updater->text_view), mark);
         is_first = FALSE;
     gtk_expander_set_resize_toplevel (GTK_EXPANDER (expander), TRUE);
     gtk_paned_pack2 (GTK_PANED (paned), expander, FALSE, FALSE);
     gtk_widget_show (expander);
-//gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
-//gtk_window_set_default_size (GTK_WINDOW (window), w, h + 230);
     /* text view */
     GtkWidget *text_view;
     gtk_text_buffer_create_tag (updater->buffer, "info", "foreground", "blue", NULL);
     gtk_text_buffer_create_tag (updater->buffer, "warning", "foreground", "green", NULL);
     gtk_text_buffer_create_tag (updater->buffer, "error", "foreground", "red", NULL);
+    /* create mark at the end, where we'll insert stuff/scroll to */
+    GtkTextIter iter;
+    gtk_text_buffer_get_end_iter (updater->buffer, &iter);
+    gtk_text_buffer_create_mark (updater->buffer, "end-mark", &iter, FALSE);
     /* scrolledwindow for text view */
     scrolled_window = gtk_scrolled_window_new (