diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-06-28 23:10:40 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-06-28 23:10:40 +0800 |
commit | 60e8e89604ace4df3124e53e05e1318edba431f4 (patch) | |
tree | fbcd5a0959f66deb2c3750978d920d25f07f3115 | |
parent | b8430242b75b1aa7a06ec98dfadd4e934879a432 (diff) | |
download | gsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.tar.gz gsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.tar.zst gsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.zip |
new functions for allowing the execution of clipboard-related commands
2001-06-28 Rodrigo Moya <rodrigo@ximian.com>
* gui/e-calendar-table.[ch] (e_calendar_table_cut_clipboard),
(e_calendar_table_copy_clipboard),
(e_calendar_table_paste_clipboard): new functions for allowing the
execution of clipboard-related commands
* gui/tasks-control.c (tasks_control_cut_cmd),
(tasks_control_copy_cmd), (tasks_control_paste_cmd): added
callbacks for the new clipboard-related menu entries
svn path=/trunk/; revision=10560
-rw-r--r-- | calendar/ChangeLog | 11 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 131 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.h | 5 | ||||
-rw-r--r-- | calendar/gui/e-tasks.h | 1 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 8 | ||||
-rw-r--r-- | calendar/gui/tasks-control.c | 51 |
6 files changed, 158 insertions, 49 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5f0e57392f..6169cdaf0f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,16 @@ 2001-06-28 Rodrigo Moya <rodrigo@ximian.com> + * gui/e-calendar-table.[ch] (e_calendar_table_cut_clipboard), + (e_calendar_table_copy_clipboard), + (e_calendar_table_paste_clipboard): new functions for allowing the + execution of clipboard-related commands + + * gui/tasks-control.c (tasks_control_cut_cmd), + (tasks_control_copy_cmd), (tasks_control_paste_cmd): added + callbacks for the new clipboard-related menu entries + +2001-06-28 Rodrigo Moya <rodrigo@ximian.com> + * gui/component-factory.c: removed not-uses-anymore parameter in call to evolution_shell_component_new diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 727c095c2d..931c721dd4 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -799,6 +799,88 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table) delete_selected_components (cal_table); } +/** + * e_calendar_table_cut_clipboard: + * @cal_table: A calendar table. + * + * Cuts selected tasks in the given calendar table + */ +void +e_calendar_table_cut_clipboard (ECalendarTable *cal_table) +{ + g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); + + e_calendar_table_copy_clipboard (cal_table); + delete_selected_components (cal_table); +} + +/* callback for e_table_selected_row_foreach */ +static void +copy_row_cb (int model_row, gpointer data) +{ + ECalendarTable *cal_table; + CalComponent *comp; + gchar *comp_str; + + cal_table = E_CALENDAR_TABLE (data); + + comp = calendar_model_get_component (cal_table->model, model_row); + if (!comp) + return; + + + if (cal_table->clipboard_selection) { + g_free (cal_table->clipboard_selection); + cal_table->clipboard_selection = NULL; + } + + comp_str = cal_component_get_as_string (comp); + cal_table->clipboard_selection = g_strdup (comp_str); + + g_free (comp_str); +} + +/** + * e_calendar_table_copy_clipboard: + * @cal_table: A calendar table. + * + * Copies selected tasks into the clipboard + */ +void +e_calendar_table_copy_clipboard (ECalendarTable *cal_table) +{ + ETable *etable; + + g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); + + if (cal_table->clipboard_selection) { + g_free (cal_table->clipboard_selection); + cal_table->clipboard_selection = NULL; + } + + etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); + e_table_selected_row_foreach (etable, copy_row_cb, cal_table); + + gtk_selection_owner_set (cal_table->invisible, clipboard_atom, GDK_CURRENT_TIME); +} + +/** + * e_calendar_table_paste_clipboard: + * @cal_table: A calendar table. + * + * Pastes tasks currently in the clipboard into the given calendar table + */ +void +e_calendar_table_paste_clipboard (ECalendarTable *cal_table) +{ + g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); + + gtk_selection_convert (cal_table->invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + GDK_CURRENT_TIME); +} + /* Opens a task in the task editor */ static void open_task (ECalendarTable *cal_table, CalComponent *comp) @@ -929,64 +1011,25 @@ e_calendar_table_on_cut (GtkWidget *menuitem, gpointer data) ECalendarTable *cal_table; cal_table = E_CALENDAR_TABLE (data); - - e_calendar_table_on_copy (menuitem, data); - delete_selected_components (cal_table); -} - -static void -copy_row_cb (int model_row, gpointer data) -{ - ECalendarTable *cal_table; - CalComponent *comp; - gchar *comp_str; - - cal_table = E_CALENDAR_TABLE (data); - - comp = calendar_model_get_component (cal_table->model, model_row); - if (!comp) - return; - - - if (cal_table->clipboard_selection) { - g_free (cal_table->clipboard_selection); - cal_table->clipboard_selection = NULL; - } - - comp_str = cal_component_get_as_string (comp); - cal_table->clipboard_selection = g_strdup (comp_str); - - g_free (comp_str); + e_calendar_table_cut_clipboard (cal_table); } static void e_calendar_table_on_copy (GtkWidget *menuitem, gpointer data) { ECalendarTable *cal_table; - ETable *etable; cal_table = E_CALENDAR_TABLE (data); - - if (cal_table->clipboard_selection) { - g_free (cal_table->clipboard_selection); - cal_table->clipboard_selection = NULL; - } - - etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); - e_table_selected_row_foreach (etable, copy_row_cb, cal_table); - - gtk_selection_owner_set (cal_table->invisible, clipboard_atom, GDK_CURRENT_TIME); + e_calendar_table_copy_clipboard (cal_table); } static void e_calendar_table_on_paste (GtkWidget *menuitem, gpointer data) { - ECalendarTable *cal_table = E_CALENDAR_TABLE (data); + ECalendarTable *cal_table; - gtk_selection_convert (cal_table->invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - GDK_CURRENT_TIME); + cal_table = E_CALENDAR_TABLE (data); + e_calendar_table_paste_clipboard (cal_table); } static gint diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h index bcb6830f75..3ad45e541b 100644 --- a/calendar/gui/e-calendar-table.h +++ b/calendar/gui/e-calendar-table.h @@ -107,6 +107,11 @@ ETable *e_calendar_table_get_table (ECalendarTable *cal_table); void e_calendar_table_delete_selected (ECalendarTable *cal_table); +/* Clipboard related functions */ +void e_calendar_table_cut_clipboard (ECalendarTable *cal_table); +void e_calendar_table_copy_clipboard (ECalendarTable *cal_table); +void e_calendar_table_paste_clipboard (ECalendarTable *cal_table); + /* These load and save the state of the table (headers shown etc.) to/from the given file. */ void e_calendar_table_load_state (ECalendarTable *cal_table, diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h index 7f2861ca44..c509e1d826 100644 --- a/calendar/gui/e-tasks.h +++ b/calendar/gui/e-tasks.h @@ -74,7 +74,6 @@ void e_tasks_setup_menus (ETasks *tasks, ECalendarTable *e_tasks_get_calendar_table (ETasks *tasks); - /* This updates all the preference settings for all the ETasks widgets in use. */ void e_tasks_update_all_config_settings (void); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 3aade08afa..43e85804d1 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -2016,16 +2016,16 @@ gnome_calendar_paste_clipboard (GnomeCalendar *gcal) switch (priv->current_view_type) { case GNOME_CAL_DAY_VIEW : - e_day_view_paste_clipboard (priv->day_view); + e_day_view_paste_clipboard (E_DAY_VIEW (priv->day_view)); break; case GNOME_CAL_WORK_WEEK_VIEW : - e_day_view_paste_clipboard (priv->work_week_view); + e_day_view_paste_clipboard (E_DAY_VIEW (priv->work_week_view)); break; case GNOME_CAL_WEEK_VIEW : - e_week_view_paste_clipboard (priv->week_view); + e_week_view_paste_clipboard (E_WEEK_VIEW (priv->week_view)); break; case GNOME_CAL_MONTH_VIEW : - e_week_view_paste_clipboard (priv->month_view); + e_week_view_paste_clipboard (E_WEEK_VIEW (priv->month_view)); break; } } diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 8d61121380..d34d93e919 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -61,6 +61,15 @@ static void tasks_control_deactivate (BonoboControl *control, static void tasks_control_new_task_cmd (BonoboUIComponent *uic, gpointer data, const char *path); +static void tasks_control_cut_cmd (BonoboUIComponent *uic, + gpointer data, + const gchar *path); +static void tasks_control_copy_cmd (BonoboUIComponent *uic, + gpointer data, + const gchar *path); +static void tasks_control_paste_cmd (BonoboUIComponent *uic, + gpointer data, + const gchar *path); static void tasks_control_delete_cmd (BonoboUIComponent *uic, gpointer data, const char *path); @@ -215,6 +224,9 @@ selection_changed_cb (ETasks *tasks, int n_selected, gpointer data) static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd), + BONOBO_UI_VERB ("TasksCut", tasks_control_cut_cmd), + BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd), + BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd), BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd), BONOBO_UI_VERB_END @@ -297,6 +309,45 @@ tasks_control_new_task_cmd (BonoboUIComponent *uic, } static void +tasks_control_cut_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path) +{ + ETasks *tasks; + ECalendarTable *cal_table; + + tasks = E_TASKS (data); + cal_table = e_tasks_get_calendar_table (tasks); + e_calendar_table_cut_clipboard (tasks); +} + +static void +tasks_control_copy_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path) +{ + ETasks *tasks; + ECalendarTable *cal_table; + + tasks = E_TASKS (data); + cal_table = e_tasks_get_calendar_table (tasks); + e_calendar_table_copy_clipboard (tasks); +} + +static void +tasks_control_paste_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path) +{ + ETasks *tasks; + ECalendarTable *cal_table; + + tasks = E_TASKS (data); + cal_table = e_tasks_get_calendar_table (tasks); + e_calendar_table_paste_clipboard (cal_table); +} + +static void tasks_control_delete_cmd (BonoboUIComponent *uic, gpointer data, const char *path) |