aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-calendar-table.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-06-28 23:10:40 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-06-28 23:10:40 +0800
commit60e8e89604ace4df3124e53e05e1318edba431f4 (patch)
treefbcd5a0959f66deb2c3750978d920d25f07f3115 /calendar/gui/e-calendar-table.c
parentb8430242b75b1aa7a06ec98dfadd4e934879a432 (diff)
downloadgsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.tar
gsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.tar.gz
gsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.tar.bz2
gsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.tar.lz
gsoc2013-evolution-60e8e89604ace4df3124e53e05e1318edba431f4.tar.xz
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
Diffstat (limited to 'calendar/gui/e-calendar-table.c')
-rw-r--r--calendar/gui/e-calendar-table.c131
1 files changed, 87 insertions, 44 deletions
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