diff options
| author | JP Rosevear <jpr@helixcode.com> | 2001-01-06 02:23:51 +0800 | 
|---|---|---|
| committer | JP Rosevear <jpr@src.gnome.org> | 2001-01-06 02:23:51 +0800 | 
| commit | ec532d28e42f4c0fb912bf7442b092e65d273178 (patch) | |
| tree | adeed36f523048363d3cdfbf425a32cea0e1a28b /calendar/gui | |
| parent | 601f4bc6b207a54bb4ec6a633eb4568e40474777 (diff) | |
| download | gsoc2013-evolution-ec532d28e42f4c0fb912bf7442b092e65d273178.tar.gz gsoc2013-evolution-ec532d28e42f4c0fb912bf7442b092e65d273178.tar.zst gsoc2013-evolution-ec532d28e42f4c0fb912bf7442b092e65d273178.zip | |
get categories button (init_widgets): listen for button click
2001-01-05  JP Rosevear  <jpr@helixcode.com>
	* gui/dialogs/task-editor.c (get_widgets): get categories button
	(init_widgets): listen for button click
	(fill_widgets): fill in the categories area
	(dialog_to_comp_object): set the cal component categories
	(categories_clicked): throw up the categories dialog and update
	when ok is clicked
	* gui/dialogs/task-editor-dialog.glade: Tweak to name the categories
	button and make it active
	* gui/calendar-model.c (get_categories): We can get the string list of
	categories directly now
	* cal-util/cal-component.c (cal_component_get_categories): new function
	to get the categories list as a string
	(cal_component_set_categories): same but for setting
	(free_icalcomponent): init the categories var
	(scan_categories): kill
	(scan_property): assign the prop to the categories var
	(cal_component_get_categories_list): deal with renaming var to categories
	(cal_component_set_categories_list): fix brokeness
svn path=/trunk/; revision=7268
Diffstat (limited to 'calendar/gui')
| -rw-r--r-- | calendar/gui/calendar-model.c | 26 | ||||
| -rw-r--r-- | calendar/gui/dialogs/task-editor-dialog.glade | 8 | ||||
| -rw-r--r-- | calendar/gui/dialogs/task-editor-dialog.glade.h | 36 | ||||
| -rw-r--r-- | calendar/gui/dialogs/task-editor.c | 49 | ||||
| -rw-r--r-- | calendar/gui/dialogs/task-page.glade | 8 | 
5 files changed, 76 insertions, 51 deletions
| diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 55f265390c..7168f2714b 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -303,31 +303,11 @@ get_time_t (CalendarModel *model, time_t *t, gboolean skip_midnight)  static char *  get_categories (CalComponent *comp)  { -	GSList *categories; -	GString *str; -	char *s; -	GSList *l; - -	cal_component_get_categories_list (comp, &categories); - -	str = g_string_new (NULL); - -	for (l = categories; l; l = l->next) { -		const char *category; - -		category = l->data; -		g_string_append (str, category); - -		if (l->next != NULL) -			g_string_append (str, ", "); -	} - -	s = str->str; +	const char *categories; -	g_string_free (str, FALSE); -	cal_component_free_categories_list (categories); +	cal_component_get_categories (comp, &categories); -	return s; +	return g_strdup (categories);  }  /* Returns a string based on the CLASSIFICATION property of a calendar component */ diff --git a/calendar/gui/dialogs/task-editor-dialog.glade b/calendar/gui/dialogs/task-editor-dialog.glade index bdde9ed091..e205b4c10d 100644 --- a/calendar/gui/dialogs/task-editor-dialog.glade +++ b/calendar/gui/dialogs/task-editor-dialog.glade @@ -484,7 +484,6 @@ Confidential  	    <class>GtkButton</class>  	    <name>button3</name>  	    <can_focus>True</can_focus> -	    <relief>GTK_RELIEF_NORMAL</relief>  	    <child>  	      <padding>0</padding>  	      <expand>False</expand> @@ -494,7 +493,6 @@ Confidential  	    <widget>  	      <class>GtkLabel</class>  	      <name>label16</name> -	      <sensitive>False</sensitive>  	      <label>_Contacts...</label>  	      <justify>GTK_JUSTIFY_CENTER</justify>  	      <wrap>False</wrap> @@ -508,7 +506,6 @@ Confidential  	  <widget>  	    <class>GtkEntry</class>  	    <name>contacts</name> -	    <sensitive>False</sensitive>  	    <can_focus>True</can_focus>  	    <editable>True</editable>  	    <text_visible>True</text_visible> @@ -523,9 +520,8 @@ Confidential  	  <widget>  	    <class>GtkButton</class> -	    <name>button4</name> +	    <name>categories-button</name>  	    <can_focus>True</can_focus> -	    <relief>GTK_RELIEF_NORMAL</relief>  	    <child>  	      <padding>0</padding>  	      <expand>False</expand> @@ -535,7 +531,6 @@ Confidential  	    <widget>  	      <class>GtkLabel</class>  	      <name>label17</name> -	      <sensitive>False</sensitive>  	      <label>Ca_tegories...</label>  	      <justify>GTK_JUSTIFY_CENTER</justify>  	      <wrap>False</wrap> @@ -549,7 +544,6 @@ Confidential  	  <widget>  	    <class>GtkEntry</class>  	    <name>categories</name> -	    <sensitive>False</sensitive>  	    <can_focus>True</can_focus>  	    <editable>True</editable>  	    <text_visible>True</text_visible> diff --git a/calendar/gui/dialogs/task-editor-dialog.glade.h b/calendar/gui/dialogs/task-editor-dialog.glade.h index 5aa32dd38b..20f7db3014 100644 --- a/calendar/gui/dialogs/task-editor-dialog.glade.h +++ b/calendar/gui/dialogs/task-editor-dialog.glade.h @@ -1,20 +1,34 @@  /* - * Translatable strings file generated by extract-ui. - * Add this file to your project's POTFILES.in + * Translatable strings file generated by Glade. + * Add this file to your project's POTFILES.in.   * DO NOT compile it as part of your application.   */ +gchar *s = N_("task-editor-dialog"); +gchar *s = N_("S_ummary"); +gchar *s = N_("Sta_rt Date:"); +gchar *s = N_("_Due Date:");  gchar *s = N_("% Comp_lete:"); +gchar *s = N_("_Status:"); +gchar *s = N_("Not Started\n" +              "In Progress\n" +              "Completed\n" +              "Cancelled\n" +              ""); +gchar *s = N_("_Priority:"); +gchar *s = N_("High\n" +              "Normal\n" +              "Low\n" +              "");  gchar *s = N_("C_lassification:"); +gchar *s = N_("None\n" +              "Public\n" +              "Private\n" +              "Confidential\n" +              ""); +gchar *s = N_("_Contacts...");  gchar *s = N_("Ca_tegories..."); -gchar *s = N_("Date Completed:"); -gchar *s = N_("Details"); -gchar *s = N_("S_ummary"); -gchar *s = N_("Sta_rt Date:");  gchar *s = N_("Task"); +gchar *s = N_("Date Completed:");  gchar *s = N_("URL:"); -gchar *s = N_("_Contacts..."); -gchar *s = N_("_Due Date:"); -gchar *s = N_("_Priority:"); -gchar *s = N_("_Status:"); -gchar *s = N_("task-editor-dialog"); +gchar *s = N_("Details"); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index ceac6c933d..288244802e 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -32,6 +32,7 @@  #include <glade/glade.h>  #include <gal/util/e-util.h>  #include <gal/widgets/e-unicode.h> +#include <gal/widgets/e-categories.h>  #include <e-util/e-dialog-widgets.h>  #include <widgets/misc/e-dateedit.h>  #include <cal-util/timeutil.h> @@ -79,6 +80,7 @@ typedef struct {  	GtkWidget *description;  	GtkWidget *contacts; +	GtkWidget *categories_btn;  	GtkWidget *categories;  	GtkWidget *completed_date; @@ -166,6 +168,8 @@ static void field_changed		(GtkWidget	*widget,  static void task_editor_set_changed	(TaskEditor	*tedit,  					 gboolean	 changed);  static gboolean prompt_to_save_changes	(TaskEditor	*tedit); +static void categories_clicked          (GtkWidget      *button,  +					 TaskEditor     *editor);  /* The function libglade calls to create the EDateEdit widgets in the GUI. */  GtkWidget * task_editor_create_date_edit (void); @@ -396,6 +400,7 @@ get_widgets (TaskEditor *tedit)  	priv->description = GW ("description");  	priv->contacts = GW ("contacts"); +	priv->categories_btn = GW ("categories-button");  	priv->categories = GW ("categories");  	priv->completed_date = GW ("completed-date"); @@ -413,6 +418,7 @@ get_widgets (TaskEditor *tedit)  		&& priv->classification  		&& priv->description  		&& priv->contacts +		&& priv->categories_btn  		&& priv->categories  		&& priv->completed_date  		&& priv->url); @@ -464,6 +470,9 @@ init_widgets (TaskEditor *tedit)  	gtk_signal_connect (GTK_OBJECT (priv->url), "changed",  			    GTK_SIGNAL_FUNC (field_changed), tedit); +	/* Button clicks */ +	gtk_signal_connect (GTK_OBJECT (priv->categories_btn), "clicked", +			    GTK_SIGNAL_FUNC (categories_clicked), tedit);  }  static void @@ -752,7 +761,8 @@ fill_widgets (TaskEditor *tedit)  	icalproperty_status status;  	TaskEditorPriority priority;  	const char *url; - +	const char *categories; +	  	priv = tedit->priv;  	task_editor_set_changed (tedit, FALSE); @@ -848,6 +858,9 @@ fill_widgets (TaskEditor *tedit)  	e_dialog_option_menu_set (priv->classification, classification,  				  classification_map); +	/* Categories */ +	cal_component_get_categories (priv->comp, &categories); +	e_dialog_editable_set (priv->categories, categories);  	/* URL. */  	cal_component_get_url (priv->comp, &url); @@ -891,7 +904,7 @@ dialog_to_comp_object (TaskEditor *tedit)  	TaskEditorPriority priority;  	int priority_value, percent;  	CalComponentClassification classification; -	char *url; +	char *url, *cat;  	char *str;  	priv = tedit->priv; @@ -986,6 +999,12 @@ dialog_to_comp_object (TaskEditor *tedit)  						   classification_map);  	cal_component_set_classification (comp, classification); +	/* Categories */ +	cat = e_dialog_editable_get (priv->categories); +	cal_component_set_categories (comp, cat); + +	if (cat) +		g_free (cat);  	/* URL. */  	url = e_dialog_editable_get (priv->url); @@ -994,7 +1013,6 @@ dialog_to_comp_object (TaskEditor *tedit)  	if (url)  		g_free (url); -  	cal_component_commit_sequence (comp);  } @@ -1297,3 +1315,28 @@ prompt_to_save_changes		(TaskEditor	*tedit)  	}  } + +static void +categories_clicked(GtkWidget *button, TaskEditor *tedit) +{ +	char *categories; +	GnomeDialog *dialog; +	int result; +	GtkWidget *entry; + +	entry = ((TaskEditorPrivate *)tedit->priv)->categories; +	categories = e_utf8_gtk_entry_get_text (GTK_ENTRY (entry)); + +	dialog = GNOME_DIALOG (e_categories_new (categories)); +	result = gnome_dialog_run (dialog); +	g_free (categories); +	 +	if (result == 0) { +		gtk_object_get (GTK_OBJECT (dialog), +				"categories", &categories, +				NULL); +		e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), categories); +		g_free (categories); +	} +	gtk_object_destroy (GTK_OBJECT (dialog)); +} diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index bdde9ed091..e205b4c10d 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -484,7 +484,6 @@ Confidential  	    <class>GtkButton</class>  	    <name>button3</name>  	    <can_focus>True</can_focus> -	    <relief>GTK_RELIEF_NORMAL</relief>  	    <child>  	      <padding>0</padding>  	      <expand>False</expand> @@ -494,7 +493,6 @@ Confidential  	    <widget>  	      <class>GtkLabel</class>  	      <name>label16</name> -	      <sensitive>False</sensitive>  	      <label>_Contacts...</label>  	      <justify>GTK_JUSTIFY_CENTER</justify>  	      <wrap>False</wrap> @@ -508,7 +506,6 @@ Confidential  	  <widget>  	    <class>GtkEntry</class>  	    <name>contacts</name> -	    <sensitive>False</sensitive>  	    <can_focus>True</can_focus>  	    <editable>True</editable>  	    <text_visible>True</text_visible> @@ -523,9 +520,8 @@ Confidential  	  <widget>  	    <class>GtkButton</class> -	    <name>button4</name> +	    <name>categories-button</name>  	    <can_focus>True</can_focus> -	    <relief>GTK_RELIEF_NORMAL</relief>  	    <child>  	      <padding>0</padding>  	      <expand>False</expand> @@ -535,7 +531,6 @@ Confidential  	    <widget>  	      <class>GtkLabel</class>  	      <name>label17</name> -	      <sensitive>False</sensitive>  	      <label>Ca_tegories...</label>  	      <justify>GTK_JUSTIFY_CENTER</justify>  	      <wrap>False</wrap> @@ -549,7 +544,6 @@ Confidential  	  <widget>  	    <class>GtkEntry</class>  	    <name>categories</name> -	    <sensitive>False</sensitive>  	    <can_focus>True</can_focus>  	    <editable>True</editable>  	    <text_visible>True</text_visible> | 
