Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fun.git;a=commitdiff;h=7452a9b2ab982f91eddb4dd7747dfb571e033425

commit 7452a9b2ab982f91eddb4dd7747dfb571e033425
Author: Priyank <[EMAIL PROTECTED]>
Date:   Mon Nov 19 01:13:56 2007 +0530

fun-dbus: implemented fun_dbus_perform_service() for GET_PACKAGE_VERSION and 
GET_PACKAGE_DESCRIPTION
fun-ui: populate the updates list and details when updates are available

diff --git a/src/fun-dbus.c b/src/fun-dbus.c
index d1670f9..a97484d 100644
--- a/src/fun-dbus.c
+++ b/src/fun-dbus.c
@@ -103,7 +103,62 @@ fun_dbus_perform_service (guint service, gchar *ip_arg, 
gchar **op_arg)
dbus_message_unref (message);
break;
}
-
+               case GET_PACKAGE_VERSION:
+               {
+                       dbus_error_init (&error);
+                       message = dbus_message_new_method_call 
("org.frugalware.FWUpdateNotifier",
+                                                               
"/org/frugalware/FWUpdateNotifier",
+                                                               
"org.frugalware.FWUpdateNotifier",
+                                                               
"GetPackageVersion");
+                       dbus_message_append_args (message, DBUS_TYPE_STRING, 
&ip_arg);
+                       reply = dbus_connection_send_with_reply_and_block 
(fun_conn, message, reply_timeout, &error);
+                       if (dbus_error_is_set(&error))
+                       {
+                               fprintf (stderr, "ERROR: %s\n", error.message);
+                               dbus_error_free (&error);
+                               return FALSE;
+                       }
+                       if (!dbus_message_get_args (reply, &error,
+                                               DBUS_TYPE_STRING, op_arg,
+                                               DBUS_TYPE_INVALID))
+                       {
+                               fprintf (stderr, "ERROR: %s\n", error.message);
+                               dbus_error_free (&error);
+                               return FALSE;
+                       }
+
+                       dbus_message_unref (reply);
+                       dbus_message_unref (message);
+                       break;
+               }
+               case GET_PACKAGE_DESCRIPTION:
+               {
+                       dbus_error_init (&error);
+                       message = dbus_message_new_method_call 
("org.frugalware.FWUpdateNotifier",
+                                                               
"/org/frugalware/FWUpdateNotifier",
+                                                               
"org.frugalware.FWUpdateNotifier",
+                                                               
"GetPackageDescription");
+                       dbus_message_append_args (message, DBUS_TYPE_STRING, 
&ip_arg);
+                       reply = dbus_connection_send_with_reply_and_block 
(fun_conn, message, reply_timeout, &error);
+                       if (dbus_error_is_set(&error))
+                       {
+                               fprintf (stderr, "ERROR: %s\n", error.message);
+                               dbus_error_free (&error);
+                               return FALSE;
+                       }
+                       if (!dbus_message_get_args (reply, &error,
+                                               DBUS_TYPE_STRING, op_arg,
+                                               DBUS_TYPE_INVALID))
+                       {
+                               fprintf (stderr, "ERROR: %s\n", error.message);
+                               dbus_error_free (&error);
+                               return FALSE;
+                       }
+
+                       dbus_message_unref (reply);
+                       dbus_message_unref (message);
+                       break;
+               }
default: break;
}

diff --git a/src/fun-ui.c b/src/fun-ui.c
index 8dd4ed6..858f161 100644
--- a/src/fun-ui.c
+++ b/src/fun-ui.c
@@ -574,7 +574,28 @@ fun_about_show (void)
static void
fun_populate_updates_tvw (gchar *plist)
{
-       g_print ("updates are: %s \n", plist);
+       char                    *pkg = NULL;
+       GtkListStore    *store = NULL;
+       GtkTreeIter             iter;
+       GList                   *l = NULL;
+
+       /* convert the updates string to a GList */
+       GList   *pack_list = NULL;
+       pkg = strtok (plist, " ");
+       pack_list = g_list_append (pack_list, (gpointer)g_strdup(pkg));
+       while ((pkg=strtok(NULL, " "))!=NULL) pack_list = g_list_append 
(pack_list, (gpointer)g_strdup(pkg));
+
+       /* populate the updates treeview store */
+       store = GTK_LIST_STORE (gtk_tree_view_get_model 
(GTK_TREE_VIEW(fun_updates_tvw)));
+       for (l = g_list_first (pack_list); l; l = g_list_next (l))
+       {
+               gchar *ver = NULL;
+               gchar *desc = NULL;
+               fun_dbus_perform_service (GET_PACKAGE_VERSION, l->data, &ver);
+               gtk_list_store_append (store, &iter);
+               fun_dbus_perform_service (GET_PACKAGE_DESCRIPTION, l->data, 
&desc);
+               gtk_list_store_set (store, &iter, 0, NULL, 1, l->data, 2, ver, 
3, desc, -1);
+       }
}

static void
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to