diff options
10 files changed, 250 insertions, 165 deletions
@@ -1,3 +1,22 @@ +2000-09-15 J Shane Culpepper <pepper@eazel.com> + + * components/services/install/nautilus-view/nautilus-service-instal + l-view.c: + * components/services/login/nautilus-view/nautilus-login-view.c: + * components/services/summary/lib/eazel-summary-shared.c: + (services_data_new), (update_news_data_new), (parse_a_service), + (parse_a_update_news_item): + * components/services/summary/lib/eazel-summary-shared.h: + * components/services/summary/nautilus-view/nautilus-summary-view.c + : (generate_startup_form), (generate_summary_form), + (generate_service_entry_row), (generate_update_news_entry_row), + (goto_service_cb), (goto_update_cb): + + Fixed Bug # 2630, 3054, and most of 2632 and 3051. You probably + will get a blank summary view now since the xml file lives on my + local apache. I will point it to the server generated one on + Monday. + 2000-09-15 John Sullivan <sullivan@eazel.com> Fixed bug 2362 (Selecting "Add Bookmark" while loading a web diff --git a/components/services/install-view/nautilus-service-install-view.c b/components/services/install-view/nautilus-service-install-view.c index 575c14059..07a0629bf 100644 --- a/components/services/install-view/nautilus-service-install-view.c +++ b/components/services/install-view/nautilus-service-install-view.c @@ -58,7 +58,7 @@ /* number of rows of (label, progressbar) to scroll at the bottom */ #define STATUS_ROWS 4 -#define NEXT_SERVICE_VIEW "eazel-summary:" +#define NEXT_SERVICE_VIEW "eazel:" /* this stuff will need to be configurable, once we have a config pane */ #define INSTALL_HOST "services.eazel.com" diff --git a/components/services/install/nautilus-view/nautilus-service-install-view.c b/components/services/install/nautilus-view/nautilus-service-install-view.c index 575c14059..07a0629bf 100644 --- a/components/services/install/nautilus-view/nautilus-service-install-view.c +++ b/components/services/install/nautilus-view/nautilus-service-install-view.c @@ -58,7 +58,7 @@ /* number of rows of (label, progressbar) to scroll at the bottom */ #define STATUS_ROWS 4 -#define NEXT_SERVICE_VIEW "eazel-summary:" +#define NEXT_SERVICE_VIEW "eazel:" /* this stuff will need to be configurable, once we have a config pane */ #define INSTALL_HOST "services.eazel.com" diff --git a/components/services/login/nautilus-view/nautilus-login-view.c b/components/services/login/nautilus-view/nautilus-login-view.c index 4c7e4f044..e57ea4731 100644 --- a/components/services/login/nautilus-view/nautilus-login-view.c +++ b/components/services/login/nautilus-view/nautilus-login-view.c @@ -79,7 +79,7 @@ struct _NautilusLoginViewDetails { EazelProxy_AuthnCallback authn_callback; }; -#define SERVICE_SUMMARY_LOCATION "eazel-summary:" +#define SERVICE_SUMMARY_LOCATION "eazel:" #define SERVICE_HELP_LOCATION "http://www.eazel.com" static void nautilus_login_view_initialize_class (NautilusLoginViewClass *klass); diff --git a/components/services/summary/eazel-summary-shared.c b/components/services/summary/eazel-summary-shared.c index 8b49274f1..c7c1c2f75 100644 --- a/components/services/summary/eazel-summary-shared.c +++ b/components/services/summary/eazel-summary-shared.c @@ -69,12 +69,12 @@ services_data_new () ServicesData *return_value; return_value = g_new0 (ServicesData, 1); - return_value->name = NULL; + return_value->gconf_name = NULL; return_value->icon = NULL; return_value->button_label = NULL; return_value->description_header = NULL; return_value->description = NULL; - return_value->grey_out = TRUE; + return_value->enabled = TRUE; return return_value; @@ -103,10 +103,10 @@ update_news_data_new () return_value->name = NULL; return_value->version = NULL; return_value->priority = NULL; - return_value->description_header = NULL; return_value->description = NULL; return_value->icon = NULL; - return_value->install_uri = NULL; + return_value->button_label = NULL; + return_value->uri = NULL; return return_value; @@ -120,29 +120,29 @@ parse_a_service (xmlNodePtr node) return_value = services_data_new (); - return_value->name = g_strdup (xml_get_value (node, "NAME")); - g_print ("%s\n", return_value->name); + return_value->gconf_name = g_strdup (xml_get_value (node, "GCONF_NAME")); + g_print ("%s\n", return_value->gconf_name); return_value->icon = g_strdup (xml_get_value (node, "ICON")); g_print ("%s\n", return_value->icon); return_value->button_label = (xml_get_value (node, "BUTTON_LABEL")); g_print ("%s\n", return_value->button_label); - return_value->redirect_to = (xml_get_value (node, "REDIRECT_TO")); - g_print ("%s\n", return_value->redirect_to); + return_value->uri = (xml_get_value (node, "URI")); + g_print ("%s\n", return_value->uri); return_value->description_header = (xml_get_value (node, "DESCRIPTION_HEADER")); g_print ("%s\n", return_value->description_header); return_value->description = (xml_get_value (node, "DESCRIPTION")); g_print ("%s\n", return_value->description); - tempbuf = (xml_get_value (node, "GREY_OUT")); + tempbuf = (xml_get_value (node, "ENABLED")); g_print ("%s\n", tempbuf); if (tempbuf[0] == 'T' || tempbuf[0] == 't') { - return_value->grey_out = TRUE; + return_value->enabled = TRUE; } else if (tempbuf[0] == 'F' || tempbuf[0] == 'f') { - return_value->grey_out = FALSE; + return_value->enabled = FALSE; } else { g_warning (_("Could not find a valid boolean value for grey_out!")); - return_value->grey_out = FALSE; + return_value->enabled = FALSE; } return return_value; @@ -178,14 +178,14 @@ parse_a_update_news_item (xmlNodePtr node) g_print ("%s\n", return_value->version); return_value->priority = g_strdup (xml_get_value (node, "PRIORITY")); g_print ("%s\n", return_value->priority); - return_value->description_header = g_strdup (xml_get_value (node, "DESCRIPTION_HEADER")); - g_print ("%s\n", return_value->description_header); return_value->description = g_strdup (xml_get_value (node, "DESCRIPTION")); g_print ("%s\n", return_value->description); return_value->icon = g_strdup (xml_get_value (node, "ICON")); g_print ("%s\n", return_value->icon); - return_value->install_uri = (xml_get_value (node, "INSTALL_URI")); - g_print ("%s\n", return_value->install_uri); + return_value->button_label = g_strdup (xml_get_value (node, "BUTTON_LABEL")); + g_print ("%s\n", return_value->button_label); + return_value->uri = (xml_get_value (node, "URI")); + g_print ("%s\n", return_value->uri); return return_value; diff --git a/components/services/summary/eazel-summary-shared.h b/components/services/summary/eazel-summary-shared.h index 1d4f1a7d3..454b06fd9 100644 --- a/components/services/summary/eazel-summary-shared.h +++ b/components/services/summary/eazel-summary-shared.h @@ -32,13 +32,13 @@ typedef struct _UpdateNewsData UpdateNewsData; typedef struct _SummaryData SummaryData; struct _ServicesData { - char *name; + char *gconf_name; char *icon; char *button_label; - char *redirect_to; + char *uri; char *description_header; char *description; - gboolean grey_out; + gboolean enabled; }; struct _EazelNewsData { @@ -51,10 +51,10 @@ struct _UpdateNewsData { char *name; char *version; char *priority; - char *description_header; char *description; char *icon; - char *install_uri; + char *button_label; + char *uri; }; struct _SummaryData { diff --git a/components/services/summary/lib/eazel-summary-shared.c b/components/services/summary/lib/eazel-summary-shared.c index 8b49274f1..c7c1c2f75 100644 --- a/components/services/summary/lib/eazel-summary-shared.c +++ b/components/services/summary/lib/eazel-summary-shared.c @@ -69,12 +69,12 @@ services_data_new () ServicesData *return_value; return_value = g_new0 (ServicesData, 1); - return_value->name = NULL; + return_value->gconf_name = NULL; return_value->icon = NULL; return_value->button_label = NULL; return_value->description_header = NULL; return_value->description = NULL; - return_value->grey_out = TRUE; + return_value->enabled = TRUE; return return_value; @@ -103,10 +103,10 @@ update_news_data_new () return_value->name = NULL; return_value->version = NULL; return_value->priority = NULL; - return_value->description_header = NULL; return_value->description = NULL; return_value->icon = NULL; - return_value->install_uri = NULL; + return_value->button_label = NULL; + return_value->uri = NULL; return return_value; @@ -120,29 +120,29 @@ parse_a_service (xmlNodePtr node) return_value = services_data_new (); - return_value->name = g_strdup (xml_get_value (node, "NAME")); - g_print ("%s\n", return_value->name); + return_value->gconf_name = g_strdup (xml_get_value (node, "GCONF_NAME")); + g_print ("%s\n", return_value->gconf_name); return_value->icon = g_strdup (xml_get_value (node, "ICON")); g_print ("%s\n", return_value->icon); return_value->button_label = (xml_get_value (node, "BUTTON_LABEL")); g_print ("%s\n", return_value->button_label); - return_value->redirect_to = (xml_get_value (node, "REDIRECT_TO")); - g_print ("%s\n", return_value->redirect_to); + return_value->uri = (xml_get_value (node, "URI")); + g_print ("%s\n", return_value->uri); return_value->description_header = (xml_get_value (node, "DESCRIPTION_HEADER")); g_print ("%s\n", return_value->description_header); return_value->description = (xml_get_value (node, "DESCRIPTION")); g_print ("%s\n", return_value->description); - tempbuf = (xml_get_value (node, "GREY_OUT")); + tempbuf = (xml_get_value (node, "ENABLED")); g_print ("%s\n", tempbuf); if (tempbuf[0] == 'T' || tempbuf[0] == 't') { - return_value->grey_out = TRUE; + return_value->enabled = TRUE; } else if (tempbuf[0] == 'F' || tempbuf[0] == 'f') { - return_value->grey_out = FALSE; + return_value->enabled = FALSE; } else { g_warning (_("Could not find a valid boolean value for grey_out!")); - return_value->grey_out = FALSE; + return_value->enabled = FALSE; } return return_value; @@ -178,14 +178,14 @@ parse_a_update_news_item (xmlNodePtr node) g_print ("%s\n", return_value->version); return_value->priority = g_strdup (xml_get_value (node, "PRIORITY")); g_print ("%s\n", return_value->priority); - return_value->description_header = g_strdup (xml_get_value (node, "DESCRIPTION_HEADER")); - g_print ("%s\n", return_value->description_header); return_value->description = g_strdup (xml_get_value (node, "DESCRIPTION")); g_print ("%s\n", return_value->description); return_value->icon = g_strdup (xml_get_value (node, "ICON")); g_print ("%s\n", return_value->icon); - return_value->install_uri = (xml_get_value (node, "INSTALL_URI")); - g_print ("%s\n", return_value->install_uri); + return_value->button_label = g_strdup (xml_get_value (node, "BUTTON_LABEL")); + g_print ("%s\n", return_value->button_label); + return_value->uri = (xml_get_value (node, "URI")); + g_print ("%s\n", return_value->uri); return return_value; diff --git a/components/services/summary/lib/eazel-summary-shared.h b/components/services/summary/lib/eazel-summary-shared.h index 1d4f1a7d3..454b06fd9 100644 --- a/components/services/summary/lib/eazel-summary-shared.h +++ b/components/services/summary/lib/eazel-summary-shared.h @@ -32,13 +32,13 @@ typedef struct _UpdateNewsData UpdateNewsData; typedef struct _SummaryData SummaryData; struct _ServicesData { - char *name; + char *gconf_name; char *icon; char *button_label; - char *redirect_to; + char *uri; char *description_header; char *description; - gboolean grey_out; + gboolean enabled; }; struct _EazelNewsData { @@ -51,10 +51,10 @@ struct _UpdateNewsData { char *name; char *version; char *priority; - char *description_header; char *description; char *icon; - char *install_uri; + char *button_label; + char *uri; }; struct _SummaryData { diff --git a/components/services/summary/nautilus-summary-view.c b/components/services/summary/nautilus-summary-view.c index f6986fa7c..d27acbdce 100644 --- a/components/services/summary/nautilus-summary-view.c +++ b/components/services/summary/nautilus-summary-view.c @@ -51,15 +51,27 @@ #define DEFAULT_BACKGROUND_COLOR "rgb:0000/6666/6666" #define DEFAULT_SUMMARY_BACKGROUND_COLOR "rgb:FFFF/FFFF/FFFF" +typedef struct _ServicesButtonCallbackData ServicesButtonCallbackData; + typedef enum { Pending_None, Pending_Login, } SummaryPendingOperationType; + +struct _ServicesButtonCallbackData { + NautilusView *nautilus_view; + char *uri; +}; + /* A NautilusContentView's private information. */ struct _NautilusSummaryViewDetails { char *uri; NautilusView *nautilus_view; + + SummaryData *xml_data; + + /* Parent form and title */ GtkWidget *form; GtkWidget *form_title; @@ -73,6 +85,7 @@ struct _NautilusSummaryViewDetails { gboolean *logged_in; /* Services control panel */ + int current_service_row; GtkTable *services_table; GtkWidget *services_icon_container; GtkWidget *services_icon_widget; @@ -85,7 +98,7 @@ struct _NautilusSummaryViewDetails { GtkWidget *services_goto_button; GtkWidget *services_goto_label_widget; char *services_goto_label; - char *services_redirect; + char *services_redirects[500]; /* Login Frame Widgets */ GtkWidget *username_label; @@ -104,6 +117,7 @@ struct _NautilusSummaryViewDetails { GtkWidget *logout_label; /* Eazel news panel */ + int current_news_row; gboolean *news_has_data; GtkTable *service_news_table; GtkWidget *news_icon_container; @@ -115,6 +129,7 @@ struct _NautilusSummaryViewDetails { char *news_description_body; /* Update control panel */ + int current_update_row; gboolean *updates_has_data; GtkTable *updates_table; GtkWidget *update_icon_container; @@ -130,7 +145,7 @@ struct _NautilusSummaryViewDetails { GtkWidget *update_goto_button; GtkWidget *update_goto_label_widget; char *update_goto_label; - char *update_redirect; + char *update_redirects[500]; /* EazelProxy -- for logging in/logging out */ EazelProxy_UserControl user_control; @@ -162,9 +177,9 @@ static void logout_button_cb (GtkWidget *button, static void entry_changed_cb (GtkWidget *entry, NautilusSummaryView *view); static void goto_service_cb (GtkWidget *button, - NautilusSummaryView *view); + ServicesButtonCallbackData *cbdata); static void goto_update_cb (GtkWidget *button, - NautilusSummaryView *view); + ServicesButtonCallbackData *cbdata); static void register_button_cb (GtkWidget *button, NautilusSummaryView *view); @@ -177,10 +192,9 @@ generate_startup_form (NautilusSummaryView *view) GtkWidget *temp_box; GtkWidget *align; int counter; - SummaryData *test_parse; - /* test xml fetching */ - test_parse = parse_summary_xml_file (); + /* fetch and parse the xml file */ + view->details->xml_data = parse_summary_xml_file (); /* allocate the parent box to hold everything */ view->details->form = gtk_vbox_new (FALSE, 0); @@ -287,6 +301,14 @@ generate_summary_form (NautilusSummaryView *view) GtkWidget *temp_box; GtkWidget *temp_hbox; GtkWidget *button_box; + ServicesData *service_node; + EazelNewsData *eazel_news_node; + UpdateNewsData *update_news_node; + GList *iterator; + + view->details->current_service_row = 0; + view->details->current_news_row = 0; + view->details->current_update_row = 0; /* set to default not logged in for now */ view->details->logged_in = FALSE; @@ -334,37 +356,21 @@ generate_summary_form (NautilusSummaryView *view) /* Create the parent table to hold 5 rows */ view->details->services_table = GTK_TABLE (gtk_table_new (5, 3, FALSE)); - /* Build the first column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("vault-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Internet File Storage"); - view->details->services_description_body = g_strdup_printf ("Your remote file storage area.\nLast accesed 6/30/00 at 16:32:01"); - view->details->services_goto_label = g_strdup_printf (" Go to Vault! "); - view->details->services_redirect = g_strdup_printf ("http://www.eazel.com/services.html"); - generate_service_entry_row (view, 1); - - /* Build the second column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("softcat-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Eazel's Software Catalog"); - view->details->services_description_body = g_strdup_printf ("Look for the latest software here!\nLast accessed 8/31/00 at 05:04:44"); - view->details->services_goto_label = g_strdup_printf (" Go to SoftCat! "); - view->details->services_redirect = g_strdup_printf ("http://www.eazel.com/register.html"); - generate_service_entry_row (view, 2); - - /* Build the third column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("inventory-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Inventory Sync Service"); - view->details->services_description_body = g_strdup_printf ("Update your inventory now!\nYou have not sent your inventory\nto storage yet!"); - view->details->services_goto_label = g_strdup_printf ("Go to Inventory View"); - view->details->services_redirect = g_strdup_printf ("eazel-inventory:"); - generate_service_entry_row (view, 3); - - /* Build the fourth column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("time-sync-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Time Sync Service"); - view->details->services_description_body = g_strdup_printf ("Update your clock now!"); - view->details->services_goto_label = g_strdup_printf (" Sync time now! "); - view->details->services_redirect = g_strdup_printf ("http://nautilus.eazel.com"); - generate_service_entry_row (view, 4); + /* build the services table from the xml file */ + for (iterator = view->details->xml_data->services_list; iterator; iterator = g_list_next (iterator)) { + + view->details->current_service_row++; + service_node = iterator->data; + view->details->services_icon_name = service_node->icon; + view->details->services_description_header = service_node->description_header; + view->details->services_description_body = service_node->description; + view->details->services_goto_label = service_node->button_label; + view->details->services_redirects[view->details->current_service_row - 1] = service_node->uri; + generate_service_entry_row (view, view->details->current_service_row); + + } + + g_list_free (iterator); /* draw parent vbox and connect it to the login frame */ gtk_box_pack_start (GTK_BOX (temp_box), GTK_WIDGET (view->details->services_table), 0, 0, 0); @@ -517,10 +523,18 @@ generate_summary_form (NautilusSummaryView *view) view->details->service_news_table = GTK_TABLE (gtk_table_new (4, 2, FALSE)); - /* Build the first column with static data for now */ - view->details->news_icon_name = g_strdup_printf ("services-warning.png"); - view->details->news_description_body = g_strdup_printf ("The Eazel servers will be down this friday!"); - generate_eazel_news_entry_row (view, 1); + /* build the eazel news table from the xml file */ + for (iterator = view->details->xml_data->eazel_news_list; iterator; iterator = g_list_next (iterator)) { + + view->details->current_news_row++; + eazel_news_node = iterator->data; + view->details->news_icon_name = eazel_news_node->icon; + view->details->news_description_body = eazel_news_node->message; + generate_eazel_news_entry_row (view, view->details->current_news_row); + + } + + g_list_free (iterator); /* draw parent vbox and connect it to the login frame */ gtk_box_pack_start (GTK_BOX (temp_box), GTK_WIDGET (view->details->service_news_table), 0, 0, 0); @@ -550,14 +564,22 @@ generate_summary_form (NautilusSummaryView *view) /* create the default update table with 4 rows */ view->details->updates_table = GTK_TABLE (gtk_table_new (4, 3, FALSE)); - /* Build the first column with static data for now */ - view->details->update_icon_name = g_strdup_printf ("netscape.png"); - view->details->update_description_header = g_strdup_printf ("Netscape Communicator"); - view->details->update_description_body = g_strdup_printf ("Everyone's favorite web browser."); - view->details->update_description_version = g_strdup_printf ("Version 4.75"); - view->details->update_goto_label = g_strdup_printf (" Update Nescape Now! "); - view->details->update_redirect = g_strdup_printf ("http://download.netscape.com"); - generate_update_news_entry_row (view, 1); + /* build the updates table from the xml file */ + for (iterator = view->details->xml_data->update_news_list; iterator; iterator = g_list_next (iterator)) { + + view->details->current_update_row++; + update_news_node = iterator->data; + view->details->update_icon_name = update_news_node->icon; + view->details->update_description_header = update_news_node->name; + view->details->update_description_version = update_news_node->version; + view->details->update_description_body = update_news_node->description; + view->details->update_goto_label = update_news_node->button_label; + view->details->update_redirects[view->details->current_update_row - 1] = update_news_node->uri; + generate_update_news_entry_row (view, view->details->current_update_row); + + } + + g_list_free (iterator); /* draw parent vbox and connect it to the login frame */ gtk_box_pack_start (GTK_BOX (temp_box), GTK_WIDGET (view->details->updates_table), 0, 0, 0); @@ -568,13 +590,17 @@ generate_summary_form (NautilusSummaryView *view) /* draw the parent frame box */ gtk_box_pack_start (GTK_BOX (view->details->form), GTK_WIDGET (parent), 0, 0, 4); gtk_widget_show (GTK_WIDGET (parent)); + } static void generate_service_entry_row (NautilusSummaryView *view, int row) { - GtkWidget *temp_vbox; - GtkWidget *temp_hbox; + GtkWidget *temp_vbox; + GtkWidget *temp_hbox; + ServicesButtonCallbackData *cbdata; + + cbdata = g_new0 (ServicesButtonCallbackData, 1); /* Generate first column with service icon */ view->details->services_icon_container = gtk_hbox_new (TRUE, 4); @@ -620,7 +646,9 @@ generate_service_entry_row (NautilusSummaryView *view, int row) gtk_widget_show (view->details->services_goto_label_widget); gtk_container_add (GTK_CONTAINER (view->details->services_goto_button), view->details->services_goto_label_widget); gtk_box_pack_start (GTK_BOX (view->details->services_button_container), view->details->services_goto_button, FALSE, FALSE, 13); - gtk_signal_connect (GTK_OBJECT (view->details->services_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_service_cb), view); + cbdata->nautilus_view = view->details->nautilus_view; + cbdata->uri = view->details->services_redirects[view->details->current_service_row - 1]; + gtk_signal_connect (GTK_OBJECT (view->details->services_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_service_cb), cbdata); gtk_widget_show (view->details->services_goto_button); gtk_table_attach (view->details->services_table, view->details->services_button_container, 2, 3, row - 1, row, 0, 0, 0, 0); gtk_widget_show (view->details->services_button_container); @@ -653,6 +681,9 @@ generate_update_news_entry_row (NautilusSummaryView *view, int row) { GtkWidget *temp_vbox; GtkWidget *temp_hbox; + ServicesButtonCallbackData *cbdata; + + cbdata = g_new0 (ServicesButtonCallbackData, 1); /* Generate first column with icon */ view->details->update_icon_container = gtk_hbox_new (TRUE, 4); @@ -711,7 +742,9 @@ generate_update_news_entry_row (NautilusSummaryView *view, int row) gtk_widget_show (view->details->update_goto_label_widget); gtk_container_add (GTK_CONTAINER (view->details->update_goto_button), view->details->update_goto_label_widget); gtk_box_pack_start (GTK_BOX (view->details->update_button_container), view->details->update_goto_button, FALSE, FALSE, 13); - gtk_signal_connect (GTK_OBJECT (view->details->update_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_update_cb), view); + cbdata->nautilus_view = view->details->nautilus_view; + cbdata->uri = view->details->update_redirects[view->details->current_update_row - 1]; + gtk_signal_connect (GTK_OBJECT (view->details->update_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_update_cb), cbdata); gtk_widget_show (view->details->update_goto_button); gtk_table_attach (view->details->updates_table, view->details->update_button_container, 2, 3, row - 1, row, 0, 0, 0, 0); gtk_widget_show (view->details->update_button_container); @@ -896,19 +929,19 @@ register_button_cb (GtkWidget *button, NautilusSummaryView *view) /* callback to handle the goto a service button. */ static void -goto_service_cb (GtkWidget *button, NautilusSummaryView *view) +goto_service_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata) { - - go_to_uri (view->details->nautilus_view, view->details->services_redirect); + + go_to_uri (cbdata->nautilus_view, cbdata->uri); } /* callback to handle install netscape button. Right now only does a simple redirect. */ static void -goto_update_cb (GtkWidget *button, NautilusSummaryView *view) +goto_update_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata) { - - go_to_uri (view->details->nautilus_view, view->details->update_redirect); + + go_to_uri (cbdata->nautilus_view, cbdata->uri); } diff --git a/components/services/summary/nautilus-view/nautilus-summary-view.c b/components/services/summary/nautilus-view/nautilus-summary-view.c index f6986fa7c..d27acbdce 100644 --- a/components/services/summary/nautilus-view/nautilus-summary-view.c +++ b/components/services/summary/nautilus-view/nautilus-summary-view.c @@ -51,15 +51,27 @@ #define DEFAULT_BACKGROUND_COLOR "rgb:0000/6666/6666" #define DEFAULT_SUMMARY_BACKGROUND_COLOR "rgb:FFFF/FFFF/FFFF" +typedef struct _ServicesButtonCallbackData ServicesButtonCallbackData; + typedef enum { Pending_None, Pending_Login, } SummaryPendingOperationType; + +struct _ServicesButtonCallbackData { + NautilusView *nautilus_view; + char *uri; +}; + /* A NautilusContentView's private information. */ struct _NautilusSummaryViewDetails { char *uri; NautilusView *nautilus_view; + + SummaryData *xml_data; + + /* Parent form and title */ GtkWidget *form; GtkWidget *form_title; @@ -73,6 +85,7 @@ struct _NautilusSummaryViewDetails { gboolean *logged_in; /* Services control panel */ + int current_service_row; GtkTable *services_table; GtkWidget *services_icon_container; GtkWidget *services_icon_widget; @@ -85,7 +98,7 @@ struct _NautilusSummaryViewDetails { GtkWidget *services_goto_button; GtkWidget *services_goto_label_widget; char *services_goto_label; - char *services_redirect; + char *services_redirects[500]; /* Login Frame Widgets */ GtkWidget *username_label; @@ -104,6 +117,7 @@ struct _NautilusSummaryViewDetails { GtkWidget *logout_label; /* Eazel news panel */ + int current_news_row; gboolean *news_has_data; GtkTable *service_news_table; GtkWidget *news_icon_container; @@ -115,6 +129,7 @@ struct _NautilusSummaryViewDetails { char *news_description_body; /* Update control panel */ + int current_update_row; gboolean *updates_has_data; GtkTable *updates_table; GtkWidget *update_icon_container; @@ -130,7 +145,7 @@ struct _NautilusSummaryViewDetails { GtkWidget *update_goto_button; GtkWidget *update_goto_label_widget; char *update_goto_label; - char *update_redirect; + char *update_redirects[500]; /* EazelProxy -- for logging in/logging out */ EazelProxy_UserControl user_control; @@ -162,9 +177,9 @@ static void logout_button_cb (GtkWidget *button, static void entry_changed_cb (GtkWidget *entry, NautilusSummaryView *view); static void goto_service_cb (GtkWidget *button, - NautilusSummaryView *view); + ServicesButtonCallbackData *cbdata); static void goto_update_cb (GtkWidget *button, - NautilusSummaryView *view); + ServicesButtonCallbackData *cbdata); static void register_button_cb (GtkWidget *button, NautilusSummaryView *view); @@ -177,10 +192,9 @@ generate_startup_form (NautilusSummaryView *view) GtkWidget *temp_box; GtkWidget *align; int counter; - SummaryData *test_parse; - /* test xml fetching */ - test_parse = parse_summary_xml_file (); + /* fetch and parse the xml file */ + view->details->xml_data = parse_summary_xml_file (); /* allocate the parent box to hold everything */ view->details->form = gtk_vbox_new (FALSE, 0); @@ -287,6 +301,14 @@ generate_summary_form (NautilusSummaryView *view) GtkWidget *temp_box; GtkWidget *temp_hbox; GtkWidget *button_box; + ServicesData *service_node; + EazelNewsData *eazel_news_node; + UpdateNewsData *update_news_node; + GList *iterator; + + view->details->current_service_row = 0; + view->details->current_news_row = 0; + view->details->current_update_row = 0; /* set to default not logged in for now */ view->details->logged_in = FALSE; @@ -334,37 +356,21 @@ generate_summary_form (NautilusSummaryView *view) /* Create the parent table to hold 5 rows */ view->details->services_table = GTK_TABLE (gtk_table_new (5, 3, FALSE)); - /* Build the first column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("vault-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Internet File Storage"); - view->details->services_description_body = g_strdup_printf ("Your remote file storage area.\nLast accesed 6/30/00 at 16:32:01"); - view->details->services_goto_label = g_strdup_printf (" Go to Vault! "); - view->details->services_redirect = g_strdup_printf ("http://www.eazel.com/services.html"); - generate_service_entry_row (view, 1); - - /* Build the second column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("softcat-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Eazel's Software Catalog"); - view->details->services_description_body = g_strdup_printf ("Look for the latest software here!\nLast accessed 8/31/00 at 05:04:44"); - view->details->services_goto_label = g_strdup_printf (" Go to SoftCat! "); - view->details->services_redirect = g_strdup_printf ("http://www.eazel.com/register.html"); - generate_service_entry_row (view, 2); - - /* Build the third column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("inventory-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Inventory Sync Service"); - view->details->services_description_body = g_strdup_printf ("Update your inventory now!\nYou have not sent your inventory\nto storage yet!"); - view->details->services_goto_label = g_strdup_printf ("Go to Inventory View"); - view->details->services_redirect = g_strdup_printf ("eazel-inventory:"); - generate_service_entry_row (view, 3); - - /* Build the fourth column with static data for now */ - view->details->services_icon_name = g_strdup_printf ("time-sync-service-icon.png"); - view->details->services_description_header = g_strdup_printf ("Time Sync Service"); - view->details->services_description_body = g_strdup_printf ("Update your clock now!"); - view->details->services_goto_label = g_strdup_printf (" Sync time now! "); - view->details->services_redirect = g_strdup_printf ("http://nautilus.eazel.com"); - generate_service_entry_row (view, 4); + /* build the services table from the xml file */ + for (iterator = view->details->xml_data->services_list; iterator; iterator = g_list_next (iterator)) { + + view->details->current_service_row++; + service_node = iterator->data; + view->details->services_icon_name = service_node->icon; + view->details->services_description_header = service_node->description_header; + view->details->services_description_body = service_node->description; + view->details->services_goto_label = service_node->button_label; + view->details->services_redirects[view->details->current_service_row - 1] = service_node->uri; + generate_service_entry_row (view, view->details->current_service_row); + + } + + g_list_free (iterator); /* draw parent vbox and connect it to the login frame */ gtk_box_pack_start (GTK_BOX (temp_box), GTK_WIDGET (view->details->services_table), 0, 0, 0); @@ -517,10 +523,18 @@ generate_summary_form (NautilusSummaryView *view) view->details->service_news_table = GTK_TABLE (gtk_table_new (4, 2, FALSE)); - /* Build the first column with static data for now */ - view->details->news_icon_name = g_strdup_printf ("services-warning.png"); - view->details->news_description_body = g_strdup_printf ("The Eazel servers will be down this friday!"); - generate_eazel_news_entry_row (view, 1); + /* build the eazel news table from the xml file */ + for (iterator = view->details->xml_data->eazel_news_list; iterator; iterator = g_list_next (iterator)) { + + view->details->current_news_row++; + eazel_news_node = iterator->data; + view->details->news_icon_name = eazel_news_node->icon; + view->details->news_description_body = eazel_news_node->message; + generate_eazel_news_entry_row (view, view->details->current_news_row); + + } + + g_list_free (iterator); /* draw parent vbox and connect it to the login frame */ gtk_box_pack_start (GTK_BOX (temp_box), GTK_WIDGET (view->details->service_news_table), 0, 0, 0); @@ -550,14 +564,22 @@ generate_summary_form (NautilusSummaryView *view) /* create the default update table with 4 rows */ view->details->updates_table = GTK_TABLE (gtk_table_new (4, 3, FALSE)); - /* Build the first column with static data for now */ - view->details->update_icon_name = g_strdup_printf ("netscape.png"); - view->details->update_description_header = g_strdup_printf ("Netscape Communicator"); - view->details->update_description_body = g_strdup_printf ("Everyone's favorite web browser."); - view->details->update_description_version = g_strdup_printf ("Version 4.75"); - view->details->update_goto_label = g_strdup_printf (" Update Nescape Now! "); - view->details->update_redirect = g_strdup_printf ("http://download.netscape.com"); - generate_update_news_entry_row (view, 1); + /* build the updates table from the xml file */ + for (iterator = view->details->xml_data->update_news_list; iterator; iterator = g_list_next (iterator)) { + + view->details->current_update_row++; + update_news_node = iterator->data; + view->details->update_icon_name = update_news_node->icon; + view->details->update_description_header = update_news_node->name; + view->details->update_description_version = update_news_node->version; + view->details->update_description_body = update_news_node->description; + view->details->update_goto_label = update_news_node->button_label; + view->details->update_redirects[view->details->current_update_row - 1] = update_news_node->uri; + generate_update_news_entry_row (view, view->details->current_update_row); + + } + + g_list_free (iterator); /* draw parent vbox and connect it to the login frame */ gtk_box_pack_start (GTK_BOX (temp_box), GTK_WIDGET (view->details->updates_table), 0, 0, 0); @@ -568,13 +590,17 @@ generate_summary_form (NautilusSummaryView *view) /* draw the parent frame box */ gtk_box_pack_start (GTK_BOX (view->details->form), GTK_WIDGET (parent), 0, 0, 4); gtk_widget_show (GTK_WIDGET (parent)); + } static void generate_service_entry_row (NautilusSummaryView *view, int row) { - GtkWidget *temp_vbox; - GtkWidget *temp_hbox; + GtkWidget *temp_vbox; + GtkWidget *temp_hbox; + ServicesButtonCallbackData *cbdata; + + cbdata = g_new0 (ServicesButtonCallbackData, 1); /* Generate first column with service icon */ view->details->services_icon_container = gtk_hbox_new (TRUE, 4); @@ -620,7 +646,9 @@ generate_service_entry_row (NautilusSummaryView *view, int row) gtk_widget_show (view->details->services_goto_label_widget); gtk_container_add (GTK_CONTAINER (view->details->services_goto_button), view->details->services_goto_label_widget); gtk_box_pack_start (GTK_BOX (view->details->services_button_container), view->details->services_goto_button, FALSE, FALSE, 13); - gtk_signal_connect (GTK_OBJECT (view->details->services_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_service_cb), view); + cbdata->nautilus_view = view->details->nautilus_view; + cbdata->uri = view->details->services_redirects[view->details->current_service_row - 1]; + gtk_signal_connect (GTK_OBJECT (view->details->services_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_service_cb), cbdata); gtk_widget_show (view->details->services_goto_button); gtk_table_attach (view->details->services_table, view->details->services_button_container, 2, 3, row - 1, row, 0, 0, 0, 0); gtk_widget_show (view->details->services_button_container); @@ -653,6 +681,9 @@ generate_update_news_entry_row (NautilusSummaryView *view, int row) { GtkWidget *temp_vbox; GtkWidget *temp_hbox; + ServicesButtonCallbackData *cbdata; + + cbdata = g_new0 (ServicesButtonCallbackData, 1); /* Generate first column with icon */ view->details->update_icon_container = gtk_hbox_new (TRUE, 4); @@ -711,7 +742,9 @@ generate_update_news_entry_row (NautilusSummaryView *view, int row) gtk_widget_show (view->details->update_goto_label_widget); gtk_container_add (GTK_CONTAINER (view->details->update_goto_button), view->details->update_goto_label_widget); gtk_box_pack_start (GTK_BOX (view->details->update_button_container), view->details->update_goto_button, FALSE, FALSE, 13); - gtk_signal_connect (GTK_OBJECT (view->details->update_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_update_cb), view); + cbdata->nautilus_view = view->details->nautilus_view; + cbdata->uri = view->details->update_redirects[view->details->current_update_row - 1]; + gtk_signal_connect (GTK_OBJECT (view->details->update_goto_button), "clicked", GTK_SIGNAL_FUNC (goto_update_cb), cbdata); gtk_widget_show (view->details->update_goto_button); gtk_table_attach (view->details->updates_table, view->details->update_button_container, 2, 3, row - 1, row, 0, 0, 0, 0); gtk_widget_show (view->details->update_button_container); @@ -896,19 +929,19 @@ register_button_cb (GtkWidget *button, NautilusSummaryView *view) /* callback to handle the goto a service button. */ static void -goto_service_cb (GtkWidget *button, NautilusSummaryView *view) +goto_service_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata) { - - go_to_uri (view->details->nautilus_view, view->details->services_redirect); + + go_to_uri (cbdata->nautilus_view, cbdata->uri); } /* callback to handle install netscape button. Right now only does a simple redirect. */ static void -goto_update_cb (GtkWidget *button, NautilusSummaryView *view) +goto_update_cb (GtkWidget *button, ServicesButtonCallbackData *cbdata) { - - go_to_uri (view->details->nautilus_view, view->details->update_redirect); + + go_to_uri (cbdata->nautilus_view, cbdata->uri); } |