aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-01-24 07:42:54 +0800
committerIain Holmes <iain@src.gnome.org>2001-01-24 07:42:54 +0800
commit9d3fd8c92531b33d5974b790c092c06f914a6282 (patch)
treee07518050631c868d8ae7695f911c28298ec9976
parente441180783a0d5af0664b991bd99906f5bd993f5 (diff)
downloadgsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar
gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar.gz
gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar.bz2
gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar.lz
gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar.xz
gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.tar.zst
gsoc2013-evolution-9d3fd8c92531b33d5974b790c092c06f914a6282.zip
Lots of stuff like memory leaks and things I forgot ages ago...
Enjoy. svn path=/trunk/; revision=7763
-rw-r--r--executive-summary/ChangeLog9
-rw-r--r--executive-summary/component/component-factory.c135
-rw-r--r--executive-summary/component/e-summary-callbacks.c28
-rw-r--r--executive-summary/component/e-summary-factory.c1
-rw-r--r--executive-summary/component/e-summary-prefs.c24
-rw-r--r--executive-summary/component/e-summary-prefs.h9
-rw-r--r--executive-summary/component/e-summary.c95
-rw-r--r--executive-summary/evolution-services/executive-summary-html-view.c1
-rw-r--r--executive-summary/summary.html2
-rw-r--r--executive-summary/test-service/rdf-summary.c68
10 files changed, 239 insertions, 133 deletions
diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog
index e247e6d6ff..2058117e84 100644
--- a/executive-summary/ChangeLog
+++ b/executive-summary/ChangeLog
@@ -1,3 +1,12 @@
+2001-01-23 Iain Holmes <iain@ximian.com>
+
+ * component/e-summary.c (e_summary_load_page): Don't strdup the NULL.
+
+2001-01-20 Iain Holmes <iain@ximian.com>
+
+ * component/e-summary.c (e_summary_display_window): Free the html
+ variable and the header too.
+
2001-01-22 Christopher James Lahey <clahey@helixcode.com>
* component/e-summary-url.c: Change the callbacks in this file to
diff --git a/executive-summary/component/component-factory.c b/executive-summary/component/component-factory.c
index 56a516a5eb..7e1dc17b45 100644
--- a/executive-summary/component/component-factory.c
+++ b/executive-summary/component/component-factory.c
@@ -44,8 +44,8 @@ static BonoboGenericFactory *factory = NULL;
static gint running_objects = 0;
static const EvolutionShellComponentFolderType folder_types[] = {
- { "executive-summary", "evolution-today.png" },
- { NULL, NULL }
+ { "executive-summary", "evolution-today.png" },
+ { NULL, NULL }
};
char *evolution_dir;
@@ -59,23 +59,23 @@ create_view (EvolutionShellComponent *shell_component,
BonoboControl **control_return,
void *closure)
{
- EvolutionShellClient *shell_client;
- GNOME_Evolution_Shell corba_shell;
- BonoboControl *control;
-
- if (g_strcasecmp (folder_type, "executive-summary") != 0)
- return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
-
- shell_client = evolution_shell_component_get_owner (shell_component);
- corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
-
- control = e_summary_factory_new_control (physical_uri, corba_shell);
- if (!control)
- return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
-
- *control_return = control;
-
- return EVOLUTION_SHELL_COMPONENT_OK;
+ EvolutionShellClient *shell_client;
+ GNOME_Evolution_Shell corba_shell;
+ BonoboControl *control;
+
+ if (g_strcasecmp (folder_type, "executive-summary") != 0)
+ return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
+
+ shell_client = evolution_shell_component_get_owner (shell_component);
+ corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
+
+ control = e_summary_factory_new_control (physical_uri, corba_shell);
+ if (!control)
+ return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
+
+ *control_return = control;
+
+ return EVOLUTION_SHELL_COMPONENT_OK;
}
static void
@@ -84,72 +84,79 @@ owner_set_cb (EvolutionShellComponent *shell_component,
const char *evolution_homedir,
gpointer user_data)
{
- GNOME_Evolution_Shell corba_shell;
-
- evolution_dir = g_strdup (evolution_homedir);
-
- corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
+ GNOME_Evolution_Shell corba_shell;
+
+ evolution_dir = g_strdup (evolution_homedir);
+
+ corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
}
static void
owner_unset_cb (EvolutionShellComponent *shell_component,
gpointer user_data)
{
- gtk_main_quit ();
+ gtk_main_quit ();
+}
+
+static void
+component_destroy_cb (GtkObject *object,
+ gpointer user_data)
+{
+ gtk_main_quit ();
}
static void
factory_destroy (BonoboEmbeddable *embeddable,
gpointer dummy)
{
- running_objects--;
-
- if (running_objects > 0)
- return;
-
- if (factory)
- bonobo_object_unref (BONOBO_OBJECT (factory));
- else
- g_warning ("Serious ref counting error");
- factory = NULL;
-
- gtk_main_quit ();
+ running_objects--;
+
+ if (running_objects > 0)
+ return;
+
+ if (factory)
+ bonobo_object_unref (BONOBO_OBJECT (factory));
+ else
+ g_warning ("Serious ref counting error");
+ factory = NULL;
+
+ gtk_main_quit ();
}
static BonoboObject *
factory_fn (BonoboGenericFactory *factory,
void *closure)
{
- EvolutionShellComponent *shell_component;
-
- running_objects++;
-
- shell_component = evolution_shell_component_new (folder_types,
- create_view,
- NULL, NULL, NULL, NULL,
- NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "destroy",
- GTK_SIGNAL_FUNC (factory_destroy), NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
- GTK_SIGNAL_FUNC (owner_set_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
- GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
-
- return BONOBO_OBJECT (shell_component);
+ EvolutionShellComponent *shell_component;
+
+ running_objects++;
+
+ shell_component = evolution_shell_component_new (folder_types,
+ create_view,
+ NULL, NULL, NULL, NULL,
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (shell_component), "destroy",
+ GTK_SIGNAL_FUNC (factory_destroy), NULL);
+ gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
+ GTK_SIGNAL_FUNC (owner_set_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
+ GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
+
+ return BONOBO_OBJECT (shell_component);
}
void
component_factory_init (void)
{
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID,
- factory_fn, NULL);
-
- if (factory == NULL) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Cannot initialize Evolution's Executive Summary component."));
- exit (1);
- }
+ if (factory != NULL)
+ return;
+
+ factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID,
+ factory_fn, NULL);
+
+ if (factory == NULL) {
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
+ _("Cannot initialize Evolution's Executive Summary component."));
+ exit (1);
+ }
}
diff --git a/executive-summary/component/e-summary-callbacks.c b/executive-summary/component/e-summary-callbacks.c
index 383fe47bc0..4d9929fc7e 100644
--- a/executive-summary/component/e-summary-callbacks.c
+++ b/executive-summary/component/e-summary-callbacks.c
@@ -217,6 +217,23 @@ html_page_changed_cb (GtkEntry *entry,
}
static void
+column_spinner_changed_cb (GtkEntry *entry,
+ PropertyData *data)
+{
+ ESummaryPrefs *prefs;
+ char *value;
+
+ prefs = data->esummary->tmp_prefs;
+
+ gnome_property_box_changed (data->box);
+ value = gtk_entry_get_text (entry);
+ if (value == NULL || *value == '\0')
+ return;
+
+ prefs->columns = atoi (value);
+}
+
+static void
apply_prefs_cb (GnomePropertyBox *property_box,
int page,
ESummary *esummary)
@@ -238,7 +255,8 @@ configure_summary (GtkWidget *widget,
static GtkWidget *prefs = NULL;
PropertyData *data;
GtkWidget *html_page;
- GtkWidget *vbox, *html;
+ GtkWidget *vbox, *html, *spinner;
+ char *tmp;
if (prefs != NULL) {
g_assert (GTK_WIDGET_REALIZED (prefs));
@@ -279,6 +297,14 @@ configure_summary (GtkWidget *widget,
"changed", GTK_SIGNAL_FUNC (html_page_changed_cb),
data);
+ spinner = glade_xml_get_widget (data->xml, "columnspinner");
+
+ tmp = g_strdup_printf ("%d", esummary->prefs->columns);
+ gtk_entry_set_text (GTK_ENTRY (spinner), tmp);
+ g_free (tmp);
+ gtk_signal_connect (GTK_OBJECT (spinner), "changed",
+ GTK_SIGNAL_FUNC (column_spinner_changed_cb), data);
+
gtk_signal_connect (GTK_OBJECT (prefs), "apply",
GTK_SIGNAL_FUNC (apply_prefs_cb), esummary);
diff --git a/executive-summary/component/e-summary-factory.c b/executive-summary/component/e-summary-factory.c
index 5d32b3ee6b..4fcd77db48 100644
--- a/executive-summary/component/e-summary-factory.c
+++ b/executive-summary/component/e-summary-factory.c
@@ -114,6 +114,7 @@ control_deactivate (BonoboControl *control,
BonoboUIComponent *ui_component,
ESummary *esummary)
{
+ e_summary_unset_message (esummary);
bonobo_ui_component_unset_container (ui_component);
}
diff --git a/executive-summary/component/e-summary-prefs.c b/executive-summary/component/e-summary-prefs.c
index ffefdcd583..440c3837f4 100644
--- a/executive-summary/component/e-summary-prefs.c
+++ b/executive-summary/component/e-summary-prefs.c
@@ -56,10 +56,27 @@ e_summary_prefs_copy (ESummaryPrefs *prefs)
copy = e_summary_prefs_new ();
copy->page = g_strdup (prefs->page);
+ copy->columns = prefs->columns;
return copy;
}
+gboolean
+e_summary_prefs_compare (ESummaryPrefs *p1,
+ ESummaryPrefs *p2)
+{
+ if (p1 == p2)
+ return TRUE;
+
+ if (strcmp (p1->page, p2->page) == 0)
+ return TRUE;
+
+ if (p1->columns == p2->columns)
+ return TRUE;
+
+ return FALSE;
+}
+
ESummaryPrefs *
e_summary_prefs_load (const char *path)
{
@@ -75,6 +92,9 @@ e_summary_prefs_load (const char *path)
prefs->page = gnome_config_get_string (item);
g_free (item);
+ item = g_strdup_printf ("=%s/e-summary=/executive-summary/columns=3", path);
+ prefs->columns = gnome_config_get_int (item);
+ g_free (item);
return prefs;
}
@@ -92,6 +112,10 @@ e_summary_prefs_save (ESummaryPrefs *prefs,
gnome_config_set_string (item, prefs->page);
g_free (item);
+ item = g_strdup_printf ("=%s/e-summary=/executive-summary/columns", path);
+ gnome_config_set_int (item, prefs->columns);
+ g_free (item);
+
gnome_config_sync ();
gnome_config_drop_all ();
}
diff --git a/executive-summary/component/e-summary-prefs.h b/executive-summary/component/e-summary-prefs.h
index 95fc6af2c2..9dc7b09404 100644
--- a/executive-summary/component/e-summary-prefs.h
+++ b/executive-summary/component/e-summary-prefs.h
@@ -26,12 +26,19 @@
typedef struct _ESummaryPrefs ESummaryPrefs;
struct _ESummaryPrefs {
- char *page;
+ char *page; /* Background HTML page URL */
+ int columns; /* Number of components per row (Default = 3) */
+
+ /* If anything is added here, don't forget to add
+ copy, compare, load and save routines to the appropriate
+ functions. */
};
ESummaryPrefs *e_summary_prefs_new (void);
void e_summary_prefs_free (ESummaryPrefs *prefs);
ESummaryPrefs *e_summary_prefs_copy (ESummaryPrefs *prefs);
+gboolean e_summary_prefs_compare (ESummaryPrefs *p1,
+ ESummaryPrefs *p2);
ESummaryPrefs *e_summary_prefs_load (const char *path);
void e_summary_prefs_save (ESummaryPrefs *prefs,
const char *path);
diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c
index 4172b7ce0f..ae55f63e53 100644
--- a/executive-summary/component/e-summary.c
+++ b/executive-summary/component/e-summary.c
@@ -104,6 +104,7 @@ e_summary_destroy (GtkObject *object)
e_summary_save_state (esummary, prefix);
g_free (prefix);
+ e_summary_prefs_free (esummary->prefs);
for (l = priv->window_list; l; l = l->next)
e_summary_window_free (l->data);
g_list_free (priv->window_list);
@@ -409,9 +410,10 @@ e_summary_display_window (ESummary *esummary,
header = g_strdup_printf ("<td bgcolor=\"%s\" valign=\"top\">", colour[col % 2]);
gtk_html_write (GTK_HTML (priv->html), priv->stream, header, strlen (header));
+ g_free (header);
if (window->html != CORBA_OBJECT_NIL) {
- char *html;
+ char *html = NULL;
CORBA_Environment ev;
CORBA_exception_init (&ev);
@@ -420,11 +422,14 @@ e_summary_display_window (ESummary *esummary,
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
g_warning ("Cannot get HTML.");
+ if (html)
+ CORBA_free (html);
} else {
CORBA_exception_free (&ev);
-
+
gtk_html_write (GTK_HTML (priv->html), priv->stream,
html, strlen (html));
+ CORBA_free (html);
}
} else {
#if 0
@@ -446,9 +451,11 @@ e_summary_rebuild_page (ESummary *esummary)
{
ESummaryPrivate *priv;
GList *windows;
- char *service_table = "<table numcols=\"3\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" height=\"100%\">";
+ char *service_table = "<table numcols=\"%d\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" height=\"100%%\" width=\"100%%\">";
+ char *tmp;
int numwindows, numrows;
int i, j, k;
+ int columns;
g_return_val_if_fail (esummary != NULL, FALSE);
g_return_val_if_fail (IS_E_SUMMARY (esummary), FALSE);
@@ -480,16 +487,19 @@ e_summary_rebuild_page (ESummary *esummary)
}
/* Load the start of the services */
- gtk_html_write (GTK_HTML (priv->html), priv->stream, service_table,
- strlen (service_table));
+ tmp = g_strdup_printf (service_table, esummary->prefs->columns);
+ gtk_html_write (GTK_HTML (priv->html), priv->stream, tmp, strlen (tmp));
+ g_free (tmp);
/* Load each of the services */
numwindows = g_list_length (priv->window_list);
+ columns = esummary->prefs->columns;
+
windows = priv->window_list;
- if (numwindows % 3 == 0)
- numrows = numwindows / 3;
+ if (numwindows % columns == 0)
+ numrows = numwindows / columns;
else
- numrows = numwindows / 3 + 1;
+ numrows = numwindows / columns + 1;
for (i = 0; i < numrows; i++) {
GList *window = windows;
@@ -498,14 +508,15 @@ e_summary_rebuild_page (ESummary *esummary)
/* Do the same row twice:
Once for the title, once for the contents */
for (j = 0; j < 2; j++) {
+ int limit;
gtk_html_write (GTK_HTML (priv->html), priv->stream,
"<tr>", 4);
/* For each window on row i */
- for (k = 0; k < MIN (3, (numwindows - (i * 3))); k++) {
+ limit = MIN (columns, (numwindows - (i * columns)));
+ for (k = 0; k < limit; k++) {
- g_print ("%d of %d\n", k,
- MIN (3, (numwindows - (i * 3))));
+ g_print ("%d of %d\n", k, limit);
if (window == NULL)
break;
@@ -523,7 +534,7 @@ e_summary_rebuild_page (ESummary *esummary)
if (window != NULL)
window = window->next;
-
+
if (window == NULL)
break;
}
@@ -672,20 +683,18 @@ e_summary_add_service (ESummary *esummary,
"IDL:Bonobo/PersistStream:1.0",
&ev);
window->persiststream = (Bonobo_PersistStream) unknown;
-
+
unknown = Bonobo_Unknown_queryInterface (component,
"IDL:Bonobo/PropertyControl:1.0",
&ev);
window->propertycontrol = (Bonobo_PropertyControl) unknown;
/* Cache the title and icon */
- window->title = g_strdup (bonobo_property_bag_client_get_value_string (
- window->propertybag,
- "window_title",
- NULL));
- window->icon = g_strdup (bonobo_property_bag_client_get_value_string (
- window->propertybag,
- "window_icon", NULL));
+ window->title = bonobo_property_bag_client_get_value_string (window->propertybag,
+ "window_title",
+ NULL);
+ window->icon = bonobo_property_bag_client_get_value_string (window->propertybag,
+ "window_icon", NULL);
CORBA_exception_free (&ev);
priv->window_list = g_list_append (priv->window_list, window);
@@ -739,29 +748,15 @@ e_summary_window_free (ESummaryWindow *window)
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("CORBA ERROR: %s", CORBA_exception_id (&ev));
}
- bonobo_object_release_unref (window->event_source, &ev);
- }
-
- if (window->propertybag != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (window->propertybag, &ev);
- }
-
- if (window->persiststream != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (window->persiststream, &ev);
- }
-
- if (window->propertycontrol != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (window->propertycontrol, &ev);
- }
-
- if (window->listener) {
- bonobo_object_unref (BONOBO_OBJECT (window->listener));
- }
-
- if (window->html != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (window->html, &ev);
+ bonobo_object_release_unref (window->event_source, &ev);
}
+ bonobo_object_release_unref (window->propertybag, &ev);
+ bonobo_object_release_unref (window->persiststream, &ev);
+ bonobo_object_release_unref (window->propertycontrol, &ev);
+ bonobo_object_unref (BONOBO_OBJECT (window->listener));
+ bonobo_object_release_unref (window->html, &ev);
+
bonobo_object_release_unref (window->component, &ev);
CORBA_exception_free (&ev);
@@ -905,10 +900,12 @@ e_summary_load_page (ESummary *esummary)
priv = esummary->private;
- filename = g_strdup (esummary->prefs->page);
/* Pass NULL to reset the page to the default */
- if (filename == NULL || *filename == '\0') {
+ if ((esummary->prefs->page) == NULL ||
+ *(esummary->prefs->page) == '\0') {
filename = g_concat_dir_and_file (EVOLUTION_DATADIR, "/evolution/summary.html");
+ } else {
+ filename = g_strdup (esummary->prefs->page);
}
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (esummary));
@@ -953,8 +950,13 @@ e_summary_load_page (ESummary *esummary)
return;
}
+ if (priv->header != NULL)
+ g_free (priv->header);
priv->header = g_strndup (str, comment - str);
priv->header_len = strlen (priv->header);
+
+ if (priv->footer != NULL)
+ g_free (priv->footer);
priv->footer = g_strdup (comment);
priv->footer_len = strlen (priv->footer);
g_free (str);
@@ -1079,10 +1081,6 @@ load_component (ESummary *esummary,
void
e_summary_reconfigure (ESummary *esummary)
{
- ESummaryPrefs *prefs;
-
- prefs = esummary->prefs;
-
e_summary_load_page (esummary);
e_summary_queue_rebuild (esummary);
}
@@ -1125,6 +1123,9 @@ e_summary_load_state (ESummary *esummary,
g_free (fullpath);
/* Load the preferences */
+ if (esummary->prefs != NULL)
+ e_summary_prefs_free (esummary->prefs);
+
esummary->prefs = e_summary_prefs_load (path);
e_summary_reconfigure (esummary);
}
diff --git a/executive-summary/evolution-services/executive-summary-html-view.c b/executive-summary/evolution-services/executive-summary-html-view.c
index 1792a5a53e..659aad18fd 100644
--- a/executive-summary/evolution-services/executive-summary-html-view.c
+++ b/executive-summary/evolution-services/executive-summary-html-view.c
@@ -209,7 +209,6 @@ executive_summary_html_view_new_full (BonoboEventSource *event_source)
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (view),
servant);
- bonobo_object_ref (BONOBO_OBJECT (event_source));
executive_summary_html_view_construct (view, event_source, corba_object);
return BONOBO_OBJECT (view);
diff --git a/executive-summary/summary.html b/executive-summary/summary.html
index 79542b87dd..16602da2a6 100644
--- a/executive-summary/summary.html
+++ b/executive-summary/summary.html
@@ -11,6 +11,7 @@
<td width="100%" colspan="2" align="middle" bgcolor="#9aadbf">
E V O L U T I O N
</td></tr>
+<!-- Hmmmm.
<tr><td bgcolor="#9aadbf">&nbsp;</td>
<td valign="top" width="100"><img src="executive-summary-curve.png"></td>
<td width="95%">
@@ -25,6 +26,7 @@ E V O L U T I O N
</form>
</td>
</tr>
+-->
<tr>
<td colspan="2">
<!-- EVOLUTION EXECUTIVE SUMMARY SERVICES DO NOT REMOVE -->
diff --git a/executive-summary/test-service/rdf-summary.c b/executive-summary/test-service/rdf-summary.c
index c2d71551e5..ad9a826afd 100644
--- a/executive-summary/test-service/rdf-summary.c
+++ b/executive-summary/test-service/rdf-summary.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* RDF viewer Evolution Executive Summary Component.
- * Bonoboised by Iain Holmes <iain@helixcode.com>
- * Copyright (C) 2000 Helix Code, Inc.
+ * Bonoboised by Iain Holmes <iain@ximian.com>
+ * Copyright (C) 2000 Ximian, Inc.
*
* Based on code from Portaloo
* Channel retrieval tool
@@ -46,11 +46,13 @@ struct _RdfSummary {
GtkWidget *rdf;
GtkWidget *g_limit;
+ GtkWidget *g_title;
char *title;
char *icon;
char *location;
int limit;
+ gboolean showtitle;
GString *str;
char *buffer;
@@ -199,19 +201,18 @@ tree_walk (xmlNodePtr root,
t = layer_find(channel->childs, "title", "No title");
arg = bonobo_arg_new (BONOBO_ARG_STRING);
- BONOBO_ARG_SET_STRING (arg, t);
+
+ if (summary->showtitle) {
+ BONOBO_ARG_SET_STRING (arg, t);
+ } else {
+ BONOBO_ARG_SET_STRING (arg, "");
+ }
+
bonobo_property_bag_set_value (summary->bag,
- "window_title", (const BonoboArg *) arg,
- NULL);
+ "window_title",
+ (const BonoboArg *) arg, NULL);
bonobo_arg_release (arg);
-#if 0
- tmp = g_strdup_printf ("%s",
- layer_find(channel->childs, "description", ""));
- g_string_append (html, tmp);
- g_free (tmp);
-#endif
-
if (image && !wipe_trackers) {
char *icon;
@@ -336,7 +337,6 @@ load_from_stream (BonoboPersistStream *ps,
if (strcasecmp (children->name, "location") == 0) {
xml_str = xmlNodeListGetString (doc, children->childs, 1);
summary->location = g_strdup (xml_str);
- g_print ("Location = %s\n", summary->location);
xmlFree (xml_str);
children = children->next;
@@ -346,7 +346,15 @@ load_from_stream (BonoboPersistStream *ps,
if (strcasecmp (children->name, "limit") == 0) {
xml_str = xmlNodeListGetString (doc, children->childs, 1);
summary->limit = atoi (xml_str);
- g_print ("Limit = %d\n", summary->limit);
+ xmlFree (xml_str);
+
+ children = children->next;
+ continue;
+ }
+
+ if (strcasecmp (children->name, "showtitle") == 0) {
+ xml_str = xmlNodeListGetString (doc, children->childs, 1);
+ summary->showtitle = atoi (xml_str);
xmlFree (xml_str);
children = children->next;
@@ -379,6 +387,10 @@ summary_to_string (RdfSummary *summary)
xmlNewChild (doc->root, ns, "limit", tmp_str);
g_free (tmp_str);
+ tmp_str = g_strdup_printf ("%d", summary->showtitle);
+ xmlNewChild (doc->root, ns, "showtitle", tmp_str);
+ g_free (tmp_str);
+
xmlDocDumpMemory (doc, &out_str, &out_len);
g_print ("%s\n", out_str);
@@ -620,8 +632,8 @@ set_prop (BonoboPropertyBag *bag,
}
static void
-entry_changed (GtkEntry *entry,
- RdfSummary *summary)
+item_changed (GtkEntry *entry,
+ RdfSummary *summary)
{
bonobo_property_control_changed (summary->property_control, NULL);
}
@@ -648,7 +660,7 @@ property_control (BonoboPropertyControl *property_control,
gtk_entry_set_text (GTK_ENTRY (summary->rdf), summary->location);
gtk_signal_connect (GTK_OBJECT (summary->rdf), "changed",
- GTK_SIGNAL_FUNC (entry_changed), summary);
+ GTK_SIGNAL_FUNC (item_changed), summary);
gtk_box_pack_start (GTK_BOX (hbox), summary->rdf, TRUE, TRUE, 0);
@@ -665,10 +677,25 @@ property_control (BonoboPropertyControl *property_control,
g_free (climit);
gtk_signal_connect (GTK_OBJECT (summary->g_limit), "changed",
- GTK_SIGNAL_FUNC (entry_changed), summary);
+ GTK_SIGNAL_FUNC (item_changed), summary);
gtk_box_pack_start (GTK_BOX (hbox), summary->g_limit, TRUE, TRUE, 0);
+ hbox = gtk_hbox_new (FALSE, 2);
+
+ /* FIXME: Do this better? */
+ label = gtk_label_new ("Show window title");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ summary->g_title = gtk_check_button_new ();
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (summary->g_title),
+ summary->showtitle);
+
+ gtk_signal_connect (GTK_OBJECT (summary->g_title), "toggled",
+ GTK_SIGNAL_FUNC (item_changed), summary);
+
+ gtk_box_pack_start (GTK_BOX (hbox), summary->g_title, TRUE, TRUE, 0);
+
gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0);
gtk_widget_show_all (container);
@@ -685,6 +712,7 @@ property_action (GtkObject *property_control,
switch (action) {
case Bonobo_PropertyControl_APPLY:
g_free (summary->location);
+ summary->showtitle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (summary->g_title));
summary->location = g_strdup (gtk_entry_get_text (GTK_ENTRY (summary->rdf)));
summary->limit = atoi (gtk_entry_get_text (GTK_ENTRY (summary->g_limit)));
g_idle_add ((GSourceFunc) download, summary);
@@ -715,6 +743,7 @@ create_view (ExecutiveSummaryComponentFactory *_factory,
summary->title = g_strdup ("Downloading...");
summary->location = g_strdup ("http://news.gnome.org/gnome-news/rdf");
summary->limit = 10;
+ summary->showtitle = TRUE;
component = executive_summary_component_new ();
gtk_signal_connect (GTK_OBJECT (component), "destroy",
@@ -726,16 +755,17 @@ create_view (ExecutiveSummaryComponentFactory *_factory,
BonoboPropertyControl as we can only have one Bonobo::EventSource
interface aggregated */
event_source = bonobo_event_source_new ();
- bonobo_object_ref (BONOBO_OBJECT (event_source));
/* Summary::HtmlView */
view = executive_summary_html_view_new_full (event_source);
+
summary->view = view;
bonobo_object_add_interface (component, view);
/* Bonobo::PropertyBag */
bag = bonobo_property_bag_new_full (get_prop, set_prop,
event_source, summary);
+
summary->bag = bag;
bonobo_property_bag_add (bag,
"window_title", PROPERTY_TITLE,