evolution r37502 - in trunk/calendar: . gui
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r37502 - in trunk/calendar: . gui
- Date: Tue, 7 Apr 2009 17:21:08 +0000 (UTC)
Author: mcrha
Date: Tue Apr 7 17:21:08 2009
New Revision: 37502
URL: http://svn.gnome.org/viewvc/evolution?rev=37502&view=rev
Log:
2009-04-07 Milan Crha <mcrha redhat com>
** Fix for bug #523802
* gui/e-tasks.h: (e_tasks_get_preview):
* gui/e-tasks.c: (e_tasks_get_preview):
* gui/e-cal-component-preview.h: (e_cal_component_preview_get_html):
* gui/e-cal-component-preview.c: (e_cal_component_preview_get_html):
* gui/tasks-control.c: (tasks_control_new), (tasks_sensitize_table[]),
(tasks_control_sensitize_commands), (tasks_control_focus_changed),
(tasks_control_copy_cmd):
* gui/e-memos.h: (e_memos_get_preview):
* gui/e-memos.c: (e_memos_get_preview):
* gui/e-cal-component-memo-preview.h:
* gui/e-cal-component-memo-preview.c:
(e_cal_component_memo_preview_get_html):
* gui/memos-control.c: (memos_control_new),
(memos_control_sensitize_commands), (memos_control_focus_changed),
(memos_control_copy_cmd):
Use copy of the preview panel, when focused, and events' copy otherwise.
Modified:
trunk/calendar/ChangeLog
trunk/calendar/gui/e-cal-component-memo-preview.c
trunk/calendar/gui/e-cal-component-memo-preview.h
trunk/calendar/gui/e-cal-component-preview.c
trunk/calendar/gui/e-cal-component-preview.h
trunk/calendar/gui/e-memos.c
trunk/calendar/gui/e-memos.h
trunk/calendar/gui/e-tasks.c
trunk/calendar/gui/e-tasks.h
trunk/calendar/gui/memos-control.c
trunk/calendar/gui/tasks-control.c
Modified: trunk/calendar/gui/e-cal-component-memo-preview.c
==============================================================================
--- trunk/calendar/gui/e-cal-component-memo-preview.c (original)
+++ trunk/calendar/gui/e-cal-component-memo-preview.c Tue Apr 7 17:21:08 2009
@@ -358,3 +358,11 @@
gtk_html_load_empty (GTK_HTML (priv->html));
}
+GtkWidget *
+e_cal_component_memo_preview_get_html (ECalComponentMemoPreview *preview)
+{
+ g_return_val_if_fail (preview != NULL, NULL);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview), NULL);
+
+ return preview->priv->html;
+}
Modified: trunk/calendar/gui/e-cal-component-memo-preview.h
==============================================================================
--- trunk/calendar/gui/e-cal-component-memo-preview.h (original)
+++ trunk/calendar/gui/e-cal-component-memo-preview.h Tue Apr 7 17:21:08 2009
@@ -62,5 +62,6 @@
void e_cal_component_memo_preview_display (ECalComponentMemoPreview *preview, ECal *ecal, ECalComponent *comp);
void e_cal_component_memo_preview_clear (ECalComponentMemoPreview *preview);
+GtkWidget *e_cal_component_memo_preview_get_html (ECalComponentMemoPreview *preview);
#endif /* _E_CAL_COMPONENT_MEMO_PREVIEW_H_ */
Modified: trunk/calendar/gui/e-cal-component-preview.c
==============================================================================
--- trunk/calendar/gui/e-cal-component-preview.c (original)
+++ trunk/calendar/gui/e-cal-component-preview.c Tue Apr 7 17:21:08 2009
@@ -449,3 +449,11 @@
gtk_html_load_empty (GTK_HTML (priv->html));
}
+GtkWidget *
+e_cal_component_preview_get_html (ECalComponentPreview *preview)
+{
+ g_return_val_if_fail (preview != NULL, NULL);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview), NULL);
+
+ return preview->priv->html;
+}
Modified: trunk/calendar/gui/e-cal-component-preview.h
==============================================================================
--- trunk/calendar/gui/e-cal-component-preview.h (original)
+++ trunk/calendar/gui/e-cal-component-preview.h Tue Apr 7 17:21:08 2009
@@ -68,5 +68,6 @@
/* Callback used when GtkHTML widget requests URL */
void e_cal_comp_preview_url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *html_stream, gpointer data);
+GtkWidget *e_cal_component_preview_get_html (ECalComponentPreview *preview);
#endif /* _E_CAL_COMPONENT_PREVIEW_H_ */
Modified: trunk/calendar/gui/e-memos.c
==============================================================================
--- trunk/calendar/gui/e-memos.c (original)
+++ trunk/calendar/gui/e-memos.c Tue Apr 7 17:21:08 2009
@@ -1222,3 +1222,18 @@
priv = memos->priv;
return E_MEMO_TABLE (priv->memos_view);
}
+
+/**
+ * e_memos_get_preview:
+ * @memos: A memos widget.
+ *
+ * Queries the #ECalComponentMemoPreview contained in a memos widget.
+ **/
+GtkWidget *
+e_memos_get_preview (EMemos *memos)
+{
+ g_return_val_if_fail (memos != NULL, NULL);
+ g_return_val_if_fail (E_IS_MEMOS (memos), NULL);
+
+ return memos->priv->preview;
+}
Modified: trunk/calendar/gui/e-memos.h
==============================================================================
--- trunk/calendar/gui/e-memos.h (original)
+++ trunk/calendar/gui/e-memos.h Tue Apr 7 17:21:08 2009
@@ -82,5 +82,6 @@
void e_memos_discard_view_menus (EMemos *memos);
EMemoTable *e_memos_get_calendar_table (EMemos *memos);
+GtkWidget *e_memos_get_preview (EMemos *memos);
#endif /* _E_MEMOS_H_ */
Modified: trunk/calendar/gui/e-tasks.c
==============================================================================
--- trunk/calendar/gui/e-tasks.c (original)
+++ trunk/calendar/gui/e-tasks.c Tue Apr 7 17:21:08 2009
@@ -1563,3 +1563,18 @@
priv = tasks->priv;
return E_CALENDAR_TABLE (priv->tasks_view);
}
+
+/**
+ * e_tasks_get_preview:
+ * @tasks: A tasks widget.
+ *
+ * Queries the #ECalComponentPreview contained in a tasks widget.
+ **/
+GtkWidget *
+e_tasks_get_preview (ETasks *tasks)
+{
+ g_return_val_if_fail (tasks != NULL, NULL);
+ g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
+
+ return tasks->priv->preview;
+}
Modified: trunk/calendar/gui/e-tasks.h
==============================================================================
--- trunk/calendar/gui/e-tasks.h (original)
+++ trunk/calendar/gui/e-tasks.h Tue Apr 7 17:21:08 2009
@@ -87,5 +87,6 @@
struct _ECalMenu *e_tasks_get_tasks_menu (ETasks *tasks);
ECalendarTable *e_tasks_get_calendar_table (ETasks *tasks);
+GtkWidget *e_tasks_get_preview (ETasks *tasks);
#endif /* _E_TASKS_H_ */
Modified: trunk/calendar/gui/memos-control.c
==============================================================================
--- trunk/calendar/gui/memos-control.c (original)
+++ trunk/calendar/gui/memos-control.c Tue Apr 7 17:21:08 2009
@@ -35,12 +35,14 @@
#include <e-util/e-icon-factory.h>
#include <e-util/e-print.h>
#include <e-util/e-util-private.h>
+#include <gtkhtml/gtkhtml.h>
#include "calendar-config.h"
#include "e-memos.h"
#include "e-memo-table.h"
#include "print.h"
#include "memos-control.h"
+#include "e-cal-component-memo-preview.h"
#include "evolution-shell-component-utils.h"
#define FIXED_MARGIN .05
@@ -74,13 +76,19 @@
gpointer data,
const char *path);
+struct focus_changed_data {
+ BonoboControl *control;
+ EMemos *memos;
+};
+static gboolean memos_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data);
BonoboControl *
memos_control_new (void)
{
BonoboControl *control;
- GtkWidget *memos;
+ GtkWidget *memos, *preview;
+ struct focus_changed_data *fc_data;
memos = e_memos_new ();
if (!memos)
@@ -96,6 +104,15 @@
g_signal_connect (control, "activate", G_CALLBACK (memos_control_activate_cb), memos);
+ fc_data = g_new0 (struct focus_changed_data, 1);
+ fc_data->control = control;
+ fc_data->memos = E_MEMOS (memos);
+
+ preview = e_cal_component_memo_preview_get_html (E_CAL_COMPONENT_MEMO_PREVIEW (e_memos_get_preview (fc_data->memos)));
+ g_object_set_data_full (G_OBJECT (preview), "memos-ctrl-fc-data", fc_data, g_free);
+ g_signal_connect (preview, "focus-in-event", G_CALLBACK (memos_control_focus_changed), fc_data);
+ g_signal_connect (preview, "focus-out-event", G_CALLBACK (memos_control_focus_changed), fc_data);
+
return control;
}
@@ -122,9 +139,10 @@
memos_control_sensitize_commands (BonoboControl *control, EMemos *memos, int n_selected)
{
BonoboUIComponent *uic;
- gboolean read_only = TRUE;
+ gboolean read_only = TRUE, preview_active;
ECal *ecal;
ECalModel *model;
+ GtkWidget *preview;
uic = bonobo_control_get_ui_component (control);
g_return_if_fail (uic != NULL);
@@ -132,6 +150,9 @@
if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
return;
+ preview = e_cal_component_memo_preview_get_html (E_CAL_COMPONENT_MEMO_PREVIEW (e_memos_get_preview (memos)));
+ preview_active = preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview);
+
model = e_memo_table_get_model (e_memos_get_calendar_table (memos));
ecal = e_cal_model_get_default_client (model);
if (ecal)
@@ -141,13 +162,13 @@
n_selected != 1 ? "0" : "1",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/MemosCut", "sensitive",
- n_selected == 0 || read_only ? "0" : "1",
+ n_selected == 0 || read_only || preview_active ? "0" : "1",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/MemosCopy", "sensitive",
n_selected == 0 ? "0" : "1",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/MemosPaste", "sensitive",
- read_only ? "0" : "1",
+ read_only || preview_active ? "0" : "1",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/MemosDelete", "sensitive",
n_selected == 0 || read_only ? "0" : "1",
@@ -165,6 +186,16 @@
memos_control_sensitize_commands (control, memos, n_selected);
}
+static gboolean
+memos_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data)
+{
+ g_return_val_if_fail (fc_data != NULL, FALSE);
+
+ memos_control_sensitize_commands (fc_data->control, fc_data->memos, e_table_selected_count (e_memo_table_get_table (e_memos_get_calendar_table (fc_data->memos))));
+
+ return FALSE;
+}
+
static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("MemosOpenMemo", memos_control_open_memo_cmd),
BONOBO_UI_VERB ("MemosNewMemo", memos_control_new_memo_cmd),
@@ -304,10 +335,18 @@
{
EMemos *memos;
EMemoTable *cal_table;
+ GtkWidget *preview;
memos = E_MEMOS (data);
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_copy_clipboard (cal_table);
+
+ preview = e_cal_component_memo_preview_get_html (E_CAL_COMPONENT_MEMO_PREVIEW (e_memos_get_preview (memos)));
+ if (preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview)) {
+ /* copy selected text in a preview when that's shown and focused */
+ gtk_html_copy (GTK_HTML (preview));
+ } else {
+ cal_table = e_memos_get_calendar_table (memos);
+ e_memo_table_copy_clipboard (cal_table);
+ }
}
static void
Modified: trunk/calendar/gui/tasks-control.c
==============================================================================
--- trunk/calendar/gui/tasks-control.c (original)
+++ trunk/calendar/gui/tasks-control.c Tue Apr 7 17:21:08 2009
@@ -43,6 +43,7 @@
#include "evolution-shell-component-utils.h"
#include "e-util/e-menu.h"
#include "e-cal-menu.h"
+#include "e-cal-component-preview.h"
#include "e-util/e-menu.h"
#include "itip-utils.h"
@@ -96,11 +97,19 @@
const char *state,
void *data);
+struct focus_changed_data {
+ BonoboControl *control;
+ ETasks *tasks;
+};
+
+static gboolean tasks_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data);
+
BonoboControl *
tasks_control_new (void)
{
BonoboControl *control;
- GtkWidget *tasks;
+ GtkWidget *tasks, *preview;
+ struct focus_changed_data *fc_data;
tasks = e_tasks_new ();
if (!tasks)
@@ -116,6 +125,15 @@
g_signal_connect (control, "activate", G_CALLBACK (tasks_control_activate_cb), tasks);
+ fc_data = g_new0 (struct focus_changed_data, 1);
+ fc_data->control = control;
+ fc_data->tasks = E_TASKS (tasks);
+
+ preview = e_cal_component_preview_get_html (E_CAL_COMPONENT_PREVIEW (e_tasks_get_preview (fc_data->tasks)));
+ g_object_set_data_full (G_OBJECT (preview), "tasks-ctrl-fc-data", fc_data, g_free);
+ g_signal_connect (preview, "focus-in-event", G_CALLBACK (tasks_control_focus_changed), fc_data);
+ g_signal_connect (preview, "focus-out-event", G_CALLBACK (tasks_control_focus_changed), fc_data);
+
return control;
}
@@ -160,11 +178,13 @@
}
}
+#define E_CAL_TASKS_PREVIEW_ACTIVE (1<<31)
+
static struct _tasks_sensitize_item tasks_sensitize_table[] = {
{ "TasksOpenTask", E_CAL_MENU_SELECT_ONE },
- { "TasksCut", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE },
+ { "TasksCut", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE | E_CAL_TASKS_PREVIEW_ACTIVE },
{ "TasksCopy", E_CAL_MENU_SELECT_ANY },
- { "TasksPaste", E_CAL_MENU_SELECT_EDITABLE },
+ { "TasksPaste", E_CAL_MENU_SELECT_EDITABLE | E_CAL_TASKS_PREVIEW_ACTIVE },
{ "TasksDelete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE },
{ "TasksMarkComplete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_NOTCOMPLETE},
{ "TasksPurge", E_CAL_MENU_SELECT_EDITABLE },
@@ -188,6 +208,7 @@
GPtrArray *events;
GSList *selected = NULL, *l = NULL;
ECalendarTable *cal_table;
+ GtkWidget *preview;
uic = bonobo_control_get_ui_component (control);
g_return_if_fail (uic != NULL);
@@ -214,6 +235,12 @@
if (ecal)
e_cal_is_read_only (ecal, &read_only, NULL);
+ preview = e_cal_component_preview_get_html (E_CAL_COMPONENT_PREVIEW (e_tasks_get_preview (tasks)));
+ if (preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview))
+ t->target.mask = t->target.mask | E_CAL_TASKS_PREVIEW_ACTIVE;
+ else
+ t->target.mask = t->target.mask & (~E_CAL_TASKS_PREVIEW_ACTIVE);
+
sensitize_items (uic, tasks_sensitize_table, t->target.mask);
e_menu_update_target ((EMenu *)menu, (EMenuTarget *)t);
}
@@ -229,6 +256,16 @@
tasks_control_sensitize_commands (control, tasks, n_selected);
}
+static gboolean
+tasks_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data)
+{
+ g_return_val_if_fail (fc_data != NULL, FALSE);
+
+ tasks_control_sensitize_commands (fc_data->control, fc_data->tasks, -1);
+
+ return FALSE;
+}
+
static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("TasksOpenTask", tasks_control_open_task_cmd),
BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd),
@@ -379,10 +416,19 @@
{
ETasks *tasks;
ECalendarTable *cal_table;
+ GtkWidget *preview;
tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_copy_clipboard (cal_table);
+
+
+ preview = e_cal_component_preview_get_html (E_CAL_COMPONENT_PREVIEW (e_tasks_get_preview (tasks)));
+ if (preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview)) {
+ /* copy selected text in a preview when that's shown and focused */
+ gtk_html_copy (GTK_HTML (preview));
+ } else {
+ cal_table = e_tasks_get_calendar_table (tasks);
+ e_calendar_table_copy_clipboard (cal_table);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]