aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorPeter Williams <peterw@ximian.com>2002-08-17 03:28:54 +0800
committerPeter Williams <peterw@src.gnome.org>2002-08-17 03:28:54 +0800
commit1cb3f6986b706aef6f508f547f70de1691e5b3bd (patch)
treec96a638cae70a7e1a7c0c1493e0f1a56f47fe02f /mail
parent6c2e746a7d99f1f1859b07c07eecf476fb5d0831 (diff)
downloadgsoc2013-evolution-1cb3f6986b706aef6f508f547f70de1691e5b3bd.tar.gz
gsoc2013-evolution-1cb3f6986b706aef6f508f547f70de1691e5b3bd.tar.zst
gsoc2013-evolution-1cb3f6986b706aef6f508f547f70de1691e5b3bd.zip
Change this into a GnomeApp so we get a statusbar and the dialog is a
2002-08-09 Peter Williams <peterw@ximian.com> * subscribe-dialog.c: Change this into a GnomeApp so we get a statusbar and the dialog is a little more comprehensible. * subscribe-dialog.c: (struct _FolderETree): Add members for tracking activity callback information. (get_short_folderinfo_got): Notify the activity callback. (subscribe_get_short_folderinfo): Here too. (folder_etree_init): Initialize the activity level to 0. (folder_etree_construct): Take new parameters of our activity callback and user_data. (folder_etree_new): Here too. (store_data_get_widget): Take the parameters here and pass them on. (sc_close_pressed): New callback for when close button is pressed. (sc_activity_timeout): New timeout to move the activity bar when folders are being scanned. (sc_activity_cb): If activity_level > 0, start the progressbar moving and set the status. (menu_item_selected): Pass the callback to store_data_get_widget. (subscribe_dialog_construct): Load some more widgets and adapt to some changes in the XML. Also connect the close button signal and initialize the progress bar's settings. * mail-callbacks.c (manage_subscriptions): Don't call gnome_dialog_set_close on it anymore since it's no longer a gnome dialog. svn path=/trunk/; revision=17793
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog29
-rw-r--r--mail/mail-callbacks.c2
-rw-r--r--mail/subscribe-dialog.c112
-rw-r--r--mail/subscribe-dialog.glade148
4 files changed, 208 insertions, 83 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 077a9475ce..3e2a731d0d 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,32 @@
+2002-08-09 Peter Williams <peterw@ximian.com>
+
+ * subscribe-dialog.c: Change this into a GnomeApp so we get a
+ statusbar and the dialog is a little more comprehensible.
+
+ * subscribe-dialog.c: (struct _FolderETree): Add members for
+ tracking activity callback information.
+ (get_short_folderinfo_got): Notify the activity callback.
+ (subscribe_get_short_folderinfo): Here too.
+ (folder_etree_init): Initialize the activity level to 0.
+ (folder_etree_construct): Take new parameters of our activity
+ callback and user_data.
+ (folder_etree_new): Here too.
+ (store_data_get_widget): Take the parameters here and pass them
+ on.
+ (sc_close_pressed): New callback for when close button is pressed.
+ (sc_activity_timeout): New timeout to move the activity bar when
+ folders are being scanned.
+ (sc_activity_cb): If activity_level > 0, start the progressbar
+ moving and set the status.
+ (menu_item_selected): Pass the callback to store_data_get_widget.
+ (subscribe_dialog_construct): Load some more widgets and adapt to
+ some changes in the XML. Also connect the close button signal and
+ initialize the progress bar's settings.
+
+ * mail-callbacks.c (manage_subscriptions): Don't call
+ gnome_dialog_set_close on it anymore since it's no longer a gnome
+ dialog.
+
2002-08-14 Dan Winship <danw@ximian.com>
* mail-config.glade: Add a "don't sign meeting requests" option to
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 52c778739e..d953676ff9 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -3276,8 +3276,6 @@ manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path)
gtk_signal_connect (GTK_OBJECT (SUBSCRIBE_DIALOG (subscribe_dialog)->app), "destroy",
subscribe_dialog_destroy, NULL);
- gnome_dialog_set_close (GNOME_DIALOG (SUBSCRIBE_DIALOG (subscribe_dialog)->app), TRUE);
-
subscribe_dialog_show (subscribe_dialog);
} else {
gdk_window_raise (SUBSCRIBE_DIALOG (subscribe_dialog)->app->window);
diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c
index e9c42855c0..7669833e7f 100644
--- a/mail/subscribe-dialog.c
+++ b/mail/subscribe-dialog.c
@@ -26,6 +26,9 @@
#include <config.h>
#endif
+#include <libgnomeui/gnome-app.h>
+#include <libgnomeui/gnome-appbar.h>
+
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
@@ -124,6 +127,8 @@
typedef struct _FolderETree FolderETree;
typedef struct _FolderETreeClass FolderETreeClass;
+typedef void (*FolderETreeActivityCallback) (int level, gpointer user_data);
+
struct _FolderETree {
ETreeMemory parent;
ETreePath root;
@@ -135,6 +140,10 @@ struct _FolderETree {
EvolutionStorage *e_storage;
char *service_name;
char *search;
+
+ FolderETreeActivityCallback activity_cb;
+ gpointer activity_data;
+ int activity_level;
};
struct _FolderETreeClass {
@@ -242,6 +251,9 @@ get_short_folderinfo_got (struct _mail_msg *mm)
camel_service_get_url (CAMEL_SERVICE (m->ftree->store)),
camel_exception_get_description (&mm->ex));
+ m->ftree->activity_level--;
+ (m->ftree->activity_cb) (m->ftree->activity_level, m->ftree->activity_data);
+
/* 'done' is probably guaranteed to fail, but... */
if (m->func)
@@ -288,6 +300,9 @@ subscribe_get_short_folderinfo (FolderETree *ftree,
m->func = func;
m->user_data = user_data;
+ ftree->activity_level++;
+ (ftree->activity_cb) (ftree->activity_level, ftree->activity_data);
+
id = m->msg.seq;
e_thread_put (mail_thread_queued, (EMsg *)m);
return id;
@@ -935,11 +950,15 @@ folder_etree_init (GtkObject *object)
ftree->subscribe_ops = g_hash_table_new (g_direct_hash, g_direct_equal);
ftree->search = g_strdup ("");
+
+ ftree->activity_level = 0;
}
static FolderETree *
folder_etree_construct (FolderETree *ftree,
- CamelStore *store)
+ CamelStore *store,
+ FolderETreeActivityCallback activity_cb,
+ gpointer activity_data)
{
e_tree_memory_construct (E_TREE_MEMORY (ftree));
@@ -950,6 +969,9 @@ folder_etree_construct (FolderETree *ftree,
ftree->e_storage = mail_lookup_storage (store); /* this gives us a ref */
+ ftree->activity_cb = activity_cb;
+ ftree->activity_data = activity_data;
+
fe_create_root_node (ftree);
return ftree;
@@ -961,12 +983,14 @@ E_MAKE_TYPE (folder_etree, "FolderETree", FolderETree, folder_etree_class_init,
/* public */
static FolderETree *
-folder_etree_new (CamelStore *store)
+folder_etree_new (CamelStore *store,
+ FolderETreeActivityCallback activity_cb,
+ gpointer activity_data)
{
FolderETree *ftree;
ftree = gtk_type_new (folder_etree_get_type());
- ftree = folder_etree_construct (ftree, store);
+ ftree = folder_etree_construct (ftree, store, activity_cb, activity_data);
return ftree;
}
@@ -1169,7 +1193,9 @@ sd_toggle_cb (ETree *tree, int row, ETreePath path, int col, GdkEvent *event, gp
}
static GtkWidget *
-store_data_get_widget (StoreData *sd)
+store_data_get_widget (StoreData *sd,
+ FolderETreeActivityCallback activity_cb,
+ gpointer activity_data)
{
GtkWidget *tree;
@@ -1181,7 +1207,7 @@ store_data_get_widget (StoreData *sd)
if (sd->widget)
return sd->widget;
- sd->ftree = folder_etree_new (sd->store);
+ sd->ftree = folder_etree_new (sd->store, activity_cb, activity_data);
/* You annoy me, etree! */
tree = gtk_widget_new (E_TREE_SCROLLED_TYPE,
@@ -1292,7 +1318,11 @@ struct _SubscribeDialogPrivate {
GtkWidget *search_entry;
GtkWidget *hbox;
GtkWidget *filter_radio, *all_radio;
- GtkWidget *sub_button, *unsub_button, *refresh_button;
+ GtkWidget *sub_button, *unsub_button, *refresh_button, *close_button;
+ GtkWidget *progress;
+ GtkWidget *appbar;
+
+ guint activity_timeout_id;
};
static GtkObjectClass *subscribe_dialog_parent_class;
@@ -1321,6 +1351,14 @@ sc_search_activated (GtkWidget *widget, gpointer user_data)
}
static void
+sc_close_pressed (GtkWidget *widget, gpointer user_data)
+{
+ SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data);
+
+ gtk_widget_destroy (GTK_WIDGET (sc->app));
+}
+
+static void
sc_subscribe_pressed (GtkWidget *widget, gpointer user_data)
{
SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data);
@@ -1416,6 +1454,43 @@ sc_selection_changed (GtkObject *obj, gpointer user_data)
gtk_widget_set_sensitive (sc->priv->unsub_button, sensitive);
}
+static gint
+sc_activity_timeout (SubscribeDialog *sc)
+{
+ GtkAdjustment *adj;
+ gfloat next;
+
+ adj = GTK_PROGRESS (sc->priv->progress)->adjustment;
+ next = adj->value + 1;
+ if (next > adj->upper)
+ next = adj->lower;
+
+ gtk_progress_set_value (GTK_PROGRESS (sc->priv->progress), next);
+ return TRUE;
+}
+
+static void
+sc_activity_cb (int level, SubscribeDialog *sc)
+{
+ g_assert (pthread_self() == mail_gui_thread);
+
+ if (level) {
+ if (sc->priv->activity_timeout_id)
+ return;
+
+ sc->priv->activity_timeout_id = gtk_timeout_add (50, (GtkFunction)
+ sc_activity_timeout, sc);
+ gnome_appbar_set_status (GNOME_APPBAR (sc->priv->appbar), _("Scanning folders..."));
+ } else {
+ if (sc->priv->activity_timeout_id) {
+ gtk_timeout_remove (sc->priv->activity_timeout_id);
+ sc->priv->activity_timeout_id = 0;
+ }
+
+ gnome_appbar_set_status (GNOME_APPBAR (sc->priv->appbar), "");
+ }
+}
+
static void
menu_item_selected (GtkMenuItem *item, gpointer user_data)
{
@@ -1429,7 +1504,7 @@ menu_item_selected (GtkMenuItem *item, gpointer user_data)
ESelectionModel *esm;
ETree *tree;
- widget = store_data_get_widget (sd);
+ widget = store_data_get_widget (sd, (FolderETreeActivityCallback) sc_activity_cb, sc);
gtk_box_pack_start (GTK_BOX (sc->priv->hbox), widget, TRUE, TRUE, 0);
tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (widget));
@@ -1530,7 +1605,10 @@ subscribe_dialog_destroy (GtkObject *object)
GList *iter;
sc = SUBSCRIBE_DIALOG (object);
-
+
+ if (sc->priv->activity_timeout_id)
+ gtk_timeout_remove (sc->priv->activity_timeout_id);
+
for (iter = sc->priv->store_list; iter; iter = iter->next) {
StoreData *data = iter->data;
@@ -1589,17 +1667,21 @@ subscribe_dialog_construct (GtkObject *object)
SubscribeDialog *sc = SUBSCRIBE_DIALOG (object);
/* Load the XML */
- sc->priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/subscribe-dialog.glade", NULL);
+ /* "app2" */
+ sc->priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/subscribe-dialog.glade", "app");
- sc->app = glade_xml_get_widget (sc->priv->xml, "Manage Subscriptions");
+ sc->app = glade_xml_get_widget (sc->priv->xml, "app");
sc->priv->hbox = glade_xml_get_widget (sc->priv->xml, "tree_box");
sc->priv->search_entry = glade_xml_get_widget (sc->priv->xml, "search_entry");
sc->priv->filter_radio = glade_xml_get_widget (sc->priv->xml, "filter_radio");
sc->priv->all_radio = glade_xml_get_widget (sc->priv->xml, "all_radio");
+ sc->priv->close_button = glade_xml_get_widget (sc->priv->xml, "close_button");
sc->priv->sub_button = glade_xml_get_widget (sc->priv->xml, "subscribe_button");
sc->priv->unsub_button = glade_xml_get_widget (sc->priv->xml, "unsubscribe_button");
sc->priv->refresh_button = glade_xml_get_widget (sc->priv->xml, "refresh_button");
-
+ sc->priv->appbar = GNOME_APP (sc->app)->statusbar;
+ sc->priv->progress = GTK_WIDGET (gnome_appbar_get_progress (GNOME_APPBAR (sc->priv->appbar)));
+
/* create default view */
sc->priv->default_widget = sc_create_default_widget();
sc->priv->current_widget = sc->priv->default_widget;
@@ -1615,12 +1697,18 @@ subscribe_dialog_construct (GtkObject *object)
/* hook up some signals */
gtk_signal_connect (GTK_OBJECT (sc->priv->search_entry), "activate", sc_search_activated, sc);
+ gtk_signal_connect (GTK_OBJECT (sc->priv->close_button), "clicked", sc_close_pressed, sc);
gtk_signal_connect (GTK_OBJECT (sc->priv->sub_button), "clicked", sc_subscribe_pressed, sc);
gtk_signal_connect (GTK_OBJECT (sc->priv->unsub_button), "clicked", sc_unsubscribe_pressed, sc);
gtk_signal_connect (GTK_OBJECT (sc->priv->refresh_button), "clicked", sc_refresh_pressed, sc);
gtk_signal_connect (GTK_OBJECT (sc->priv->all_radio), "toggled", sc_all_toggled, sc);
gtk_signal_connect (GTK_OBJECT (sc->priv->filter_radio), "toggled", sc_filter_toggled, sc);
-
+
+ /* progress */
+ gtk_progress_set_activity_mode (GTK_PROGRESS (sc->priv->progress), 1);
+ gtk_progress_bar_set_activity_step (GTK_PROGRESS_BAR (sc->priv->progress), 5);
+ gtk_progress_bar_set_activity_blocks (GTK_PROGRESS_BAR (sc->priv->progress), 10);
+
/* Get the list of stores */
populate_store_list (sc);
}
diff --git a/mail/subscribe-dialog.glade b/mail/subscribe-dialog.glade
index 472491b3e8..1970844367 100644
--- a/mail/subscribe-dialog.glade
+++ b/mail/subscribe-dialog.glade
@@ -14,73 +14,89 @@
</project>
<widget>
- <class>GnomeDialog</class>
- <name>Manage Subscriptions</name>
+ <class>GnomeApp</class>
+ <name>app</name>
<title>Manage Subscriptions</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
- <default_width>484</default_width>
- <default_height>423</default_height>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
+ <enable_layout_config>True</enable_layout_config>
<widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
+ <class>GnomeDock</class>
+ <child_name>GnomeApp:dock</child_name>
+ <name>dock2</name>
+ <border_width>3</border_width>
+ <allow_floating>True</allow_floating>
<child>
- <padding>4</padding>
+ <padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area2</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
+ <class>GnomeDockItem</class>
+ <name>dockitem2</name>
+ <border_width>1</border_width>
+ <placement>GNOME_DOCK_TOP</placement>
+ <band>1</band>
+ <position>0</position>
+ <offset>0</offset>
+ <locked>False</locked>
+ <exclusive>True</exclusive>
+ <never_floating>False</never_floating>
+ <never_vertical>False</never_vertical>
+ <never_horizontal>False</never_horizontal>
+ <shadow_type>GTK_SHADOW_OUT</shadow_type>
<widget>
- <class>GtkButton</class>
- <name>button9</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
+ <class>GtkToolbar</class>
+ <name>toolbar1</name>
+ <border_width>1</border_width>
+ <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
+ <type>GTK_TOOLBAR_BOTH</type>
+ <space_size>16</space_size>
+ <space_style>GTK_TOOLBAR_SPACE_LINE</space_style>
+ <relief>GTK_RELIEF_NONE</relief>
+ <tooltips>True</tooltips>
+
+ <widget>
+ <class>GtkButton</class>
+ <child_name>Toolbar:button</child_name>
+ <name>refresh_button</name>
+ <tooltip>Apri file</tooltip>
+ <label>Refresh List</label>
+ <stock_pixmap>GNOME_STOCK_PIXMAP_REFRESH</stock_pixmap>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <child_name>Toolbar:button</child_name>
+ <name>close_button</name>
+ <tooltip>Salve file</tooltip>
+ <label>Close</label>
+ <stock_pixmap>GNOME_STOCK_PIXMAP_CLOSE</stock_pixmap>
+ <child>
+ <new_group>True</new_group>
+ </child>
+ </widget>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
- <name>vbox2</name>
+ <child_name>GnomeDock:contents</child_name>
+ <name>vbox6</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>3</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
<widget>
<class>GtkHBox</class>
- <name>hbox1</name>
+ <name>hbox7</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
@@ -91,15 +107,15 @@
<widget>
<class>GtkLabel</class>
- <name>label1</name>
- <label>Show _folders from server: </label>
+ <name>label5</name>
+ <label>S_elect server: </label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
- <default_focus_target>store_menu</default_focus_target>
+ <default_focus_target>optionmenu2</default_focus_target>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -138,7 +154,7 @@
<widget>
<class>GtkVBox</class>
- <name>vbox3</name>
+ <name>vbox7</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>3</spacing>
@@ -151,7 +167,7 @@
<widget>
<class>GtkLabel</class>
- <name>label2</name>
+ <name>label6</name>
<label>
</label>
<justify>GTK_JUSTIFY_CENTER</justify>
@@ -169,7 +185,7 @@
<widget>
<class>GtkVButtonBox</class>
- <name>vbuttonbox2</name>
+ <name>vbuttonbox6</name>
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
<spacing>0</spacing>
<child_min_width>85</child_min_width>
@@ -202,18 +218,8 @@
</widget>
<widget>
- <class>GtkHSeparator</class>
- <name>hseparator1</name>
- <child>
- <padding>14</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
<class>GtkVButtonBox</class>
- <name>vbuttonbox3</name>
+ <name>vbuttonbox7</name>
<layout_style>GTK_BUTTONBOX_START</layout_style>
<spacing>10</spacing>
<child_min_width>85</child_min_width>
@@ -225,23 +231,14 @@
<expand>False</expand>
<fill>False</fill>
</child>
-
- <widget>
- <class>GtkButton</class>
- <name>refresh_button</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label> _Refresh List </label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
- <name>frame1</name>
- <label>Display options</label>
+ <name>frame3</name>
+ <label>Display Options</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
@@ -252,7 +249,7 @@
<widget>
<class>GtkHBox</class>
- <name>hbox3</name>
+ <name>hbox9</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>3</spacing>
@@ -304,7 +301,7 @@
<widget>
<class>GtkHButtonBox</class>
- <name>hbuttonbox1</name>
+ <name>hbuttonbox3</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
@@ -321,6 +318,19 @@
</widget>
</widget>
</widget>
+
+ <widget>
+ <class>GnomeAppBar</class>
+ <child_name>GnomeApp:appbar</child_name>
+ <name>appbar2</name>
+ <has_progress>True</has_progress>
+ <has_status>True</has_status>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
</widget>
</GTK-Interface>