diff options
author | Iain Holmes <iain@src.gnome.org> | 2000-12-14 02:26:45 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2000-12-14 02:26:45 +0800 |
commit | fe7da31d862feb3175a507bdb594341cac721f22 (patch) | |
tree | d9d6f60c28c48b94c12eb4c815454b4ef4139456 /executive-summary/component | |
parent | 1aa4562d998bc7f107fe3ea09ddb01c102274492 (diff) | |
download | gsoc2013-evolution-fe7da31d862feb3175a507bdb594341cac721f22.tar gsoc2013-evolution-fe7da31d862feb3175a507bdb594341cac721f22.tar.gz gsoc2013-evolution-fe7da31d862feb3175a507bdb594341cac721f22.tar.bz2 gsoc2013-evolution-fe7da31d862feb3175a507bdb594341cac721f22.tar.lz gsoc2013-evolution-fe7da31d862feb3175a507bdb594341cac721f22.tar.xz gsoc2013-evolution-fe7da31d862feb3175a507bdb594341cac721f22.tar.zst gsoc2013-evolution-fe7da31d862feb3175a507bdb594341cac721f22.zip |
Rm the whole of the Executive Summary dir.
Correctly display all the windows.
Put an HTML explaination into the configure dialog.
svn path=/trunk/; revision=6969
Diffstat (limited to 'executive-summary/component')
-rw-r--r-- | executive-summary/component/e-summary-callbacks.c | 79 | ||||
-rw-r--r-- | executive-summary/component/e-summary-util.c | 59 | ||||
-rw-r--r-- | executive-summary/component/e-summary-util.h | 1 | ||||
-rw-r--r-- | executive-summary/component/e-summary.c | 40 | ||||
-rw-r--r-- | executive-summary/component/executive-summary-config.glade | 15 |
5 files changed, 168 insertions, 26 deletions
diff --git a/executive-summary/component/e-summary-callbacks.c b/executive-summary/component/e-summary-callbacks.c index 09072990d5..7343726865 100644 --- a/executive-summary/component/e-summary-callbacks.c +++ b/executive-summary/component/e-summary-callbacks.c @@ -32,6 +32,8 @@ #include <liboaf/liboaf.h> #include <glade/glade.h> #include <e-summary-callbacks.h> +#include <gtkhtml/gtkhtml.h> +#include <e-util/e-html-utils.h> #include "e-summary.h" @@ -44,6 +46,70 @@ typedef struct _PropertyData { GladeXML *xml; } PropertyData; +/* HTML helper functions from mail/mail-config-gui.c */ +static void +html_size_req (GtkWidget *widget, + GtkRequisition *requisition) +{ + requisition->height = GTK_LAYOUT (widget)->height; +} + +/* Returns a GtkHTML which is already inside a GtkScrolledWindow. If + * @white is TRUE, the GtkScrolledWindow will be inside a GtkFrame. + */ +static GtkWidget * +html_new (gboolean white) +{ + GtkWidget *html, *scrolled, *frame; + GtkStyle *style; + + html = gtk_html_new (); + GTK_LAYOUT (html)->height = 0; + gtk_signal_connect (GTK_OBJECT (html), "size_request", + GTK_SIGNAL_FUNC (html_size_req), NULL); + gtk_html_set_editable (GTK_HTML (html), FALSE); + style = gtk_rc_get_style (html); + + if (style) { + gtk_html_set_default_background_color (GTK_HTML (html), + white ? &style->white: + &style->bg[0]); + } + + gtk_widget_set_sensitive (html, FALSE); + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_NEVER, GTK_POLICY_NEVER); + gtk_container_add (GTK_CONTAINER (scrolled), html); + if (white) { + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), + GTK_SHADOW_ETCHED_IN); + gtk_container_add (GTK_CONTAINER (frame), scrolled); + gtk_widget_show_all (frame); + } else { + gtk_widget_show_all (scrolled); + } + + return html; +} + +static void +put_html (GtkHTML *html, + const char *text) +{ + GtkHTMLStream *handle; + char *htmltext; + + htmltext = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL); + handle = gtk_html_begin (html); + gtk_html_write (html, handle, "<HTML><BODY>", 12); + gtk_html_write (html, handle, text, strlen (text)); + gtk_html_write (html, handle, "</BODY></HTML>", 14); + g_free (htmltext); + gtk_html_end (html, handle, GTK_HTML_STREAM_OK); +} + void embed_service (GtkWidget *widget, ESummary *esummary) @@ -172,6 +238,7 @@ configure_summary (GtkWidget *widget, static GtkWidget *prefs = NULL; PropertyData *data; GtkWidget *html_page; + GtkWidget *vbox, *html; if (prefs != NULL) { g_assert (GTK_WIDGET_REALIZED (prefs)); @@ -188,11 +255,21 @@ configure_summary (GtkWidget *widget, } esummary->tmp_prefs = e_summary_prefs_copy (esummary->prefs); - + data->xml = glade_xml_new (EVOLUTION_GLADEDIR "/executive-summary-config.glade", NULL); prefs = glade_xml_get_widget (data->xml, "summaryprefs"); data->box = GNOME_PROPERTY_BOX(prefs); + + vbox = glade_xml_get_widget (data->xml, "vbox"); + html = html_new (TRUE); + put_html (html, + _("You can select a different HTML page for the background " + "of the Executive Summary.\n\nJust leave it blank for the " + "default")); + gtk_box_pack_start (GTK_BOX (vbox), html->parent->parent, TRUE, TRUE, 0); + gtk_box_reorder_child (GTK_BOX (vbox), html->parent->parent, 0); + html_page = glade_xml_get_widget (data->xml, "htmlpage"); if (esummary->prefs->page != NULL) diff --git a/executive-summary/component/e-summary-util.c b/executive-summary/component/e-summary-util.c index 78731a6b3e..c19c829d57 100644 --- a/executive-summary/component/e-summary-util.c +++ b/executive-summary/component/e-summary-util.c @@ -25,6 +25,20 @@ #include <gnome.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> + +/** + * e_pixmap_file: + * @filename: Filename of pixmap. + * + * Finds @filename in the Evolution or GNOME installation dir. + * + * Returns: A newly allocated absolute path to @filename, or NULL + * if it cannot be found. + */ char * e_pixmap_file (const char *filename) { @@ -65,3 +79,48 @@ e_pixmap_file (const char *filename) return gnome_pixmap_file (filename); } +/** + * e_summary_rm_dir: + * @path: Full path to the directory or file to be removed. + * + * Deletes everything in fullpath. + */ +void +e_summary_rm_dir (const char *path) +{ + DIR *base; + struct stat statbuf; + struct dirent *contents; + + stat (path, &statbuf); + if (!S_ISDIR (statbuf.st_mode)) { + /* Not a directory */ + g_warning ("Removing: %s", path); + unlink (path); + return; + } else { + g_warning ("Opening: %s", path); + base = opendir (path); + + contents = readdir (base); + while (contents != NULL) { + char *fullpath; + + if (strcmp (contents->d_name, ".") == 0|| + strcmp (contents->d_name, "..") ==0) { + contents = readdir (base); + continue; + } + + fullpath = g_concat_dir_and_file (path, contents->d_name); + e_summary_rm_dir (fullpath); + g_free (fullpath); + + contents = readdir (base); + } + + closedir (base); + rmdir (path); + } +} + diff --git a/executive-summary/component/e-summary-util.h b/executive-summary/component/e-summary-util.h index 0cfd50403a..63799a324a 100644 --- a/executive-summary/component/e-summary-util.h +++ b/executive-summary/component/e-summary-util.h @@ -25,5 +25,6 @@ #define _E_SUMMARY_UTIL_H__ char *e_pixmap_file (const char *filename); +void e_summary_rm_dir (const char *filename); #endif diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c index c55d6887f7..ef95c7e8b1 100644 --- a/executive-summary/component/e-summary.c +++ b/executive-summary/component/e-summary.c @@ -542,28 +542,32 @@ e_summary_rebuild_page (ESummary *esummary) gtk_html_write (GTK_HTML (priv->html), priv->stream, service_table, strlen (service_table)); /* Load each of the services */ - numwindows = g_list_length (priv->window_list) - 1; + numwindows = g_list_length (priv->window_list); windows = priv->window_list; - if ( (numwindows % 3) == 0) + if (numwindows % 3 == 0) numrows = numwindows / 3; else - numrows = (numwindows / 3) + 1; + numrows = numwindows / 3 + 1; for (i = 0; i < numrows; i++) { GList *window = windows; - + g_print ("i: %d/%d\n", i, numrows); /* Do the same row twice: Once for the title, once for the contents */ for (j = 0; j < 2; j++) { - + gtk_html_write (GTK_HTML (priv->html), priv->stream, "<tr>", 4); - /* For each window on row i */ - for (k = 0; k < 3; k++) { + /* For each window on row i */ + for (k = 0; k < MIN (3, (numwindows - (i * 3))); k++) { + + g_print ("%d of %d\n", k, + MIN (3, (numwindows - (i * 3)))); + if (window == NULL) + break; - g_print ("%d of 3\n", k); if (j == 0) { e_summary_display_window_title (esummary, window->data, @@ -575,35 +579,35 @@ e_summary_rebuild_page (ESummary *esummary) k, k, numwindows); } + + if (window != NULL) + window = window->next; - window = window->next; if (window == NULL) break; } - + gtk_html_write (GTK_HTML (priv->html), priv->stream, "</tr>", 5); if (j == 0) window = windows; else { if (window) - windows = window->next; + windows = window; else break; } } } - - gtk_html_write (GTK_HTML (priv->html), priv->stream, "</tr></table>", - 13); - + gtk_html_write (GTK_HTML (priv->html), priv->stream, "</tr></table>", 13); + if (priv->footer == NULL) { load_default_footer (esummary); } else { gtk_html_write (GTK_HTML (priv->html), priv->stream, priv->footer, priv->footer_len); } - + e_summary_end_load (esummary); gtk_layout_thaw (GTK_LAYOUT (priv->html)); @@ -1276,7 +1280,7 @@ save_component (BonoboStorage *storage, bonobo_object_release_unref (corba_subdir, &ev); CORBA_exception_free (&ev); } - + static void e_summary_save_state (ESummary *esummary, const char *path) @@ -1298,7 +1302,7 @@ e_summary_save_state (ESummary *esummary, g_print ("fullpath: %s\n", fullpath); /* FIXME: Use RC's rmdir function */ - remove (fullpath); + e_summary_rm_dir (fullpath); storage = bonobo_storage_open (STORAGE_TYPE, fullpath, Bonobo_Storage_READ | diff --git a/executive-summary/component/executive-summary-config.glade b/executive-summary/component/executive-summary-config.glade index 387964fa21..f6d468ba33 100644 --- a/executive-summary/component/executive-summary-config.glade +++ b/executive-summary/component/executive-summary-config.glade @@ -51,11 +51,15 @@ <widget> <class>GtkVBox</class> - <name>vbox1</name> + <name>vbox</name> <border_width>2</border_width> <cxx_use_heap>True</cxx_use_heap> <homogeneous>False</homogeneous> - <spacing>0</spacing> + <spacing>8</spacing> + + <widget> + <class>Placeholder</class> + </widget> <widget> <class>GtkFrame</class> @@ -74,9 +78,10 @@ <widget> <class>GtkVBox</class> <name>vbox2</name> + <border_width>2</border_width> <cxx_use_heap>True</cxx_use_heap> <homogeneous>False</homogeneous> - <spacing>0</spacing> + <spacing>5</spacing> <widget> <class>GtkHBox</class> @@ -144,10 +149,6 @@ <widget> <class>Placeholder</class> </widget> - - <widget> - <class>Placeholder</class> - </widget> </widget> <widget> |