[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19565 - in gnunet-gtk: contrib src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19565 - in gnunet-gtk: contrib src/fs |
Date: |
Tue, 31 Jan 2012 13:00:00 +0100 |
Author: grothoff
Date: 2012-01-31 13:00:00 +0100 (Tue, 31 Jan 2012)
New Revision: 19565
Modified:
gnunet-gtk/contrib/gnunet_fs_gtk_progress_dialog.glade
gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c
Log:
-making progress dialog nice and responsive
Modified: gnunet-gtk/contrib/gnunet_fs_gtk_progress_dialog.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_progress_dialog.glade 2012-01-31
11:02:18 UTC (rev 19564)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_progress_dialog.glade 2012-01-31
12:00:00 UTC (rev 19565)
@@ -15,25 +15,44 @@
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
- <object class="GtkScrolledWindow"
id="GNUNET_FS_GTK_progress_dialog_scrolled_window">
+ <object class="GtkFrame" id="GNUNET_FS_GTK_progress_dialog_frame">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property
name="hadjustment">GNUNET_FS_GTK_progress_dialog_textview_horizontal_adjustment</property>
- <property
name="vadjustment">GNUNET_FS_GTK_progress_dialog_textview_vertical_adjustment</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkTextView"
id="GNUNET_FS_GTK_progress_dialog_textview">
+ <object class="GtkAlignment"
id="GNUNET_FS_GTK_progress_dialog_alignment">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="wrap_mode">word</property>
- <property name="indent">-10</property>
- <property
name="buffer">GNUNET_FS_GTK_progress_dialog_textbuffer</property>
- <property name="accepts_tab">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkScrolledWindow"
id="GNUNET_FS_GTK_progress_dialog_scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="hadjustment">GNUNET_FS_GTK_progress_dialog_textview_horizontal_adjustment</property>
+ <property
name="vadjustment">GNUNET_FS_GTK_progress_dialog_textview_vertical_adjustment</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView"
id="GNUNET_FS_GTK_progress_dialog_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="indent">-10</property>
+ <property
name="buffer">GNUNET_FS_GTK_progress_dialog_textbuffer</property>
+ <property name="accepts_tab">False</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
+ <child type="label">
+ <object class="GtkLabel"
id="GNUNET_FS_GTK_progress_dialog_label">
+ <property name="visible">True</property>
+ <property name="label"
translatable="yes"><b>Messages</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
</object>
<packing>
<property name="position">0</property>
@@ -43,6 +62,10 @@
<object class="GtkProgressBar"
id="GNUNET_FS_GTK_progress_dialog_progressbar">
<property name="visible">True</property>
<property name="activity_mode">True</property>
+ <property name="pulse_step">0.050000002607703209</property>
+ <property name="text"
translatable="yes">Preprocessing...</property>
+ <property
name="adjustment">GNUNET_FS_GTK_progress_bar_adjustment</property>
+ <property name="discrete_blocks">5</property>
</object>
<packing>
<property name="expand">False</property>
@@ -69,6 +92,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -82,7 +106,6 @@
</object>
</child>
</object>
- <object class="GtkSizeGroup"
id="GNUNET_FS_GTK_progress_dialog_buttons_sizegroup"/>
<object class="GtkTextBuffer" id="GNUNET_FS_GTK_progress_dialog_textbuffer"/>
<object class="GtkAdjustment"
id="GNUNET_FS_GTK_progress_dialog_textview_horizontal_adjustment">
<property name="upper">100</property>
@@ -94,4 +117,10 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="GNUNET_FS_GTK_progress_bar_adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
</interface>
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c 2012-01-31
11:02:18 UTC (rev 19564)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c 2012-01-31
12:00:00 UTC (rev 19565)
@@ -30,6 +30,8 @@
#define MARKER_DIR_FILE_SIZE "-"
+#define VERBOSE_PROGRESS GNUNET_NO
+
struct AddDirClientContext;
struct MainPublishingDialogContext
@@ -49,7 +51,7 @@
GtkWidget *cancel_button;
GtkTreeView *file_info_treeview;
GtkTreeSelection *file_info_selection;
- GtkTreeModel *file_info_treemodel;
+ GtkTreeModel *file_info_treemodel;
GtkWindow *master_pubdialog;
gulong open_directory_handler_id;
@@ -86,6 +88,7 @@
GtkTextView *progress_dialog_textview;
GtkTextBuffer *progress_dialog_textbuffer;
GtkTextMark *progress_dialog_textmark;
+ GtkAdjustment *textview_vertial_adjustment;
unsigned int done;
unsigned int total;
@@ -779,18 +782,13 @@
static void
insert_progress_dialog_text (struct AddDirClientContext *adcc,
- char *text)
+ const char *text)
{
- GtkTextIter iter;
-
- gtk_text_buffer_get_iter_at_mark (adcc->progress_dialog_textbuffer,
- &iter, adcc->progress_dialog_textmark);
- gtk_text_buffer_insert (adcc->progress_dialog_textbuffer,
- &iter, text, -1);
- gtk_text_view_scroll_to_mark (adcc->progress_dialog_textview,
- adcc->progress_dialog_textmark,
- 0.0, FALSE, 1.0, 1.0);
-
+ gtk_text_buffer_insert_at_cursor (adcc->progress_dialog_textbuffer,
+ text, -1);
+ gtk_text_view_place_cursor_onscreen (adcc->progress_dialog_textview);
+ gtk_adjustment_set_value (adcc->textview_vertial_adjustment,
+ gtk_adjustment_get_upper
(adcc->textview_vertial_adjustment));
}
@@ -929,15 +927,21 @@
const char *filename, int is_directory,
enum GNUNET_FS_DirScannerProgressUpdateReason reason)
{
+ static struct GNUNET_TIME_Absolute last_pulse;
struct AddDirClientContext *adcc = cls;
char *s;
gdouble fraction;
- gtk_progress_bar_pulse (adcc->progress_dialog_bar);
switch (reason)
{
case GNUNET_FS_DIRSCANNER_FILE_START:
GNUNET_assert (filename != NULL);
+ if (GNUNET_TIME_absolute_get_duration (last_pulse).rel_value > 100)
+ {
+ gtk_progress_bar_pulse (adcc->progress_dialog_bar);
+ last_pulse = GNUNET_TIME_absolute_get ();
+ }
+#if VERBOSE_PROGRESS
if (is_directory)
{
GNUNET_asprintf (&s, _("Scanning directory `%s'.\n"), filename);
@@ -945,13 +949,21 @@
GNUNET_free (s);
}
else
- adcc->total++;
+ adcc->total++;
+#else
+ if (! is_directory)
+ adcc->total++;
+#endif
break;
case GNUNET_FS_DIRSCANNER_FILE_IGNORED:
GNUNET_assert (filename != NULL);
GNUNET_asprintf (&s,
_("Failed to scan `%s' (access error). Skipping.\n"),
filename);
+#if ! VERBOSE_PROGRESS
+ gtk_widget_show (GTK_WIDGET (gtk_builder_get_object
(adcc->progress_dialog_builder,
+
"GNUNET_FS_GTK_progress_dialog_scrolled_window")));
+#endif
insert_progress_dialog_text (adcc, s);
GNUNET_free (s);
break;
@@ -968,9 +980,11 @@
fraction);
break;
case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED:
+#if VERBOSE_PROGRESS
GNUNET_asprintf (&s, _("Processed file `%s'.\n"), filename);
insert_progress_dialog_text (adcc, s);
GNUNET_free (s);
+#endif
adcc->done++;
GNUNET_assert (adcc->done <= adcc->total);
fraction = (adcc->total == 0) ? 1.0 : (1.0 * adcc->done) / adcc->total;
@@ -1040,6 +1054,9 @@
adcc->progress_dialog_textview = GTK_TEXT_VIEW (
gtk_builder_get_object (adcc->progress_dialog_builder,
"GNUNET_FS_GTK_progress_dialog_textview"));
+ adcc->textview_vertial_adjustment = GTK_ADJUSTMENT (
+ gtk_builder_get_object (adcc->progress_dialog_builder,
+ "GNUNET_FS_GTK_progress_dialog_textview_vertical_adjustment"));
adcc->progress_dialog_textbuffer = GTK_TEXT_BUFFER (
gtk_builder_get_object (adcc->progress_dialog_builder,
"GNUNET_FS_GTK_progress_dialog_textbuffer"));
@@ -1048,6 +1065,10 @@
adcc->progress_dialog_textmark = gtk_text_buffer_create_mark (
adcc->progress_dialog_textbuffer, "scroll",
&iter, FALSE);
+#if VERBOSE_PROGRESS
+ gtk_widget_show (GTK_WIDGET (gtk_builder_get_object
(adcc->progress_dialog_builder,
+
"GNUNET_FS_GTK_progress_dialog_scrolled_window")));
+#endif
gtk_window_set_transient_for (GTK_WINDOW (adcc->progress_dialog),
adcc->ctx->master_pubdialog);
gtk_window_set_title (GTK_WINDOW (adcc->progress_dialog), filename);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19565 - in gnunet-gtk: contrib src/fs,
gnunet <=