gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r22051 - in gnunet-gtk: contrib src/fs src/lib


From: gnunet
Subject: [GNUnet-SVN] r22051 - in gnunet-gtk: contrib src/fs src/lib
Date: Sat, 16 Jun 2012 21:38:57 +0200

Author: grothoff
Date: 2012-06-16 21:38:57 +0200 (Sat, 16 Jun 2012)
New Revision: 22051

Modified:
   gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade
   gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
   gnunet-gtk/src/lib/animations.c
Log:
-working animations for most cases

Modified: gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade  2012-06-16 19:27:15 UTC 
(rev 22050)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade  2012-06-16 19:38:57 UTC 
(rev 22051)
@@ -107,7 +107,7 @@
             <property name="label" translatable="yes">Publishing</property>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">False</property>
             <property name="padding">5</property>
             <property name="position">0</property>

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-06-16 19:27:15 UTC 
(rev 22050)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-06-16 19:38:57 UTC 
(rev 22051)
@@ -2376,6 +2376,33 @@
 
 
 /**
+ * Change the status icon for the download.
+ *
+ * @param de download that had an error
+ * @param icon status icon to display
+ */
+static void
+change_download_status_icon (struct DownloadEntry *de,
+                             GdkPixbuf *icon)
+{
+  GtkTreeIter iter;
+  GtkTreePath *path;
+
+  path = gtk_tree_row_reference_get_path (de->sr->rr);
+  if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->sr->tab->ts), &iter, 
path))
+  {
+    GNUNET_break (0);
+    gtk_tree_path_free (path);
+    return;
+  }
+  gtk_tree_path_free (path);
+  gtk_tree_store_set (de->sr->tab->ts, &iter,
+                     SEARCH_TAB_MC_STATUS_ICON, icon,
+                      -1);
+}
+
+
+/**
  * FS-API encountered an error downloading a file.  Update the
  * view accordingly.
  *
@@ -2402,6 +2429,7 @@
   gtk_tree_store_set (de->sr->tab->ts, &iter,
                       SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 0,
                       SEARCH_TAB_MC_URI_AS_STRING, emsg,
+                     SEARCH_TAB_MC_STATUS_ICON, NULL /* FIXME: error icon? */,
                       -1);
 }
 
@@ -2432,6 +2460,8 @@
   gtk_tree_store_set (de->sr->tab->ts, &iter, 
                       SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100,
                       SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100,
+                     SEARCH_TAB_MC_STATUS_ICON, 
+                     GNUNET_GTK_animation_context_get_pixbuf 
(animation_downloaded),
                       -1);
 }
 
@@ -2575,6 +2605,7 @@
                       SEARCH_TAB_MC_COMPLETED, (guint64) completed,
                       SEARCH_TAB_MC_FILENAME, de->filename,
                       SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, de->anonymity,
+                     GNUNET_GTK_animation_context_get_pixbuf 
(animation_download_stalled),
                       -1);
   return de;
 }
@@ -2703,6 +2734,8 @@
   gtk_tree_path_free (path);
   gtk_tree_store_set (pe->tab->ts, &iter, 
                       PUBLISH_TAB_MC_RESULT_STRING, emsg,
+                      PUBLISH_TAB_MC_PROGRESS, 100,
+                     PUBLISH_TAB_MC_STATUS_ICON, NULL /* FIXME: error status 
icon? */,
                       -1);
   change_publish_color (pe, "red");
 }
@@ -2715,23 +2748,28 @@
 delete_publish_tab ()
 {
   GtkNotebook *notebook;
+  struct PublishTab *pt;
   int index;
   int i;
  
+  if (NULL == publish_tab)
+    return;
+  pt = publish_tab;
+  publish_tab = NULL;
   notebook =
       GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object
                     ("GNUNET_GTK_main_window_notebook"));
   index = -1;
   for (i = gtk_notebook_get_n_pages (notebook) - 1; i >= 0; i--)
-    if (publish_tab->frame == gtk_notebook_get_nth_page (notebook, i))
+    if (pt->frame == gtk_notebook_get_nth_page (notebook, i))
       index = i;
   gtk_notebook_remove_page (notebook, index);
 
   /* fully destroy tab */
-  g_object_unref (publish_tab->builder);
-  if (NULL != publish_tab->atv)
-    GNUNET_GTK_animation_tree_view_unregister (publish_tab->atv);
-  GNUNET_free (publish_tab);
+  g_object_unref (pt->builder);
+  if (NULL != pt->atv)
+    GNUNET_GTK_animation_tree_view_unregister (pt->atv);
+  GNUNET_free (pt);
   publish_tab = NULL;
   GNUNET_GTK_animation_context_destroy (animation_publishing);
   animation_publishing = NULL;
@@ -3255,9 +3293,13 @@
     return NULL;
   case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE:
     change_download_color (info->value.download.cctx, "yellow");
+    change_download_status_icon (info->value.download.cctx, 
+                                GNUNET_GTK_animation_context_get_pixbuf 
(animation_downloading));
     return info->value.download.cctx;
   case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE:
     change_download_color (info->value.download.cctx, "blue");
+    change_download_status_icon (info->value.download.cctx, 
+                                GNUNET_GTK_animation_context_get_pixbuf 
(animation_download_stalled));
     return info->value.download.cctx;
   case GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT:
     download_lost_parent (info->value.download.cctx);

Modified: gnunet-gtk/src/lib/animations.c
===================================================================
--- gnunet-gtk/src/lib/animations.c     2012-06-16 19:27:15 UTC (rev 22050)
+++ gnunet-gtk/src/lib/animations.c     2012-06-16 19:38:57 UTC (rev 22051)
@@ -235,7 +235,8 @@
   gint width;
   
   gw = gtk_widget_get_window (GTK_WIDGET (atv->tv));
-
+  if (! gtk_widget_get_realized (GTK_WIDGET (atv->tv)))
+    return;
   /* Get column x and width in bin window coordinates */
   gtk_tree_view_get_cell_area (atv->tv, NULL, atv->image_col, &r);
   /* Convert x and width to window coordinates */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]