static void memo_shell_content_model_row_changed_cb (EMemoShellContent *memo_shell_content, gint row, ETableModel *model) { ECalModelComponent *comp_data; EMemoTable *memo_table; const gchar *current_uid; const gchar *uid; current_uid = memo_shell_content->priv->current_uid; if (current_uid == NULL) return; comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row); if (comp_data == NULL) return; uid = icalcomponent_get_uid (comp_data->icalcomp); if (g_strcmp0 (uid, current_uid) != 0) return; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); memo_shell_content_cursor_change_cb ( memo_shell_content, 0, E_TABLE (memo_table)); }
void e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view) { ECalShellContent *cal_shell_content; EShellWindow *shell_window; EShellView *shell_view; EMemoTable *memo_table; GtkAction *action; GSList *list, *iter; gboolean editable = TRUE; gboolean has_url = FALSE; gboolean sensitive; gint n_selected; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); n_selected = e_table_selected_count (E_TABLE (memo_table)); list = e_memo_table_get_selected (memo_table); for (iter = list; iter != NULL; iter = iter->next) { ECalModelComponent *comp_data = iter->data; icalproperty *prop; gboolean read_only; read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; prop = icalcomponent_get_first_property ( comp_data->icalcomp, ICAL_URL_PROPERTY); has_url |= (prop != NULL); } g_slist_free (list); action = ACTION (CALENDAR_MEMOPAD_FORWARD); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_OPEN); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_OPEN_URL); sensitive = (n_selected == 1) && has_url; gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_PRINT); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_SAVE_AS); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); }
static void memo_shell_content_display_view_cb (EMemoShellContent *memo_shell_content, GalView *gal_view) { EMemoTable *memo_table; if (!GAL_IS_VIEW_ETABLE (gal_view)) return; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); gal_view_etable_attach_table ( GAL_VIEW_ETABLE (gal_view), E_TABLE (memo_table)); }
static void action_task_list_print_preview_cb (GtkAction *action, ETaskShellView *task_shell_view) { ETaskShellContent *task_shell_content; ETaskTable *task_table; task_shell_content = task_shell_view->priv->task_shell_content; task_table = e_task_shell_content_get_task_table (task_shell_content); print_table ( E_TABLE (task_table), _("Print Tasks"), _("Tasks"), GTK_PRINT_OPERATION_ACTION_PREVIEW); }
static void task_shell_content_display_view_cb (ETaskShellContent *task_shell_content, GalView *gal_view) { ETaskTable *task_table; if (!GAL_IS_VIEW_ETABLE (gal_view)) return; task_table = e_task_shell_content_get_task_table (task_shell_content); gal_view_etable_attach_table ( GAL_VIEW_ETABLE (gal_view), E_TABLE (task_table)); }
static void gdvd_button_copy_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) { int row; GtkWidget *scrolled; ETable *etable; scrolled = glade_xml_get_widget(dialog->gui, "custom-table"); etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled)); row = e_table_get_cursor_row (E_TABLE(etable)); if (row != -1) { gal_define_views_model_copy_view(GAL_DEFINE_VIEWS_MODEL(dialog->model), row); } }
static guint32 memo_shell_content_check_state (EShellContent *shell_content) { EMemoShellContent *memo_shell_content; EMemoTable *memo_table; GSList *list, *iter; gboolean editable = TRUE; gboolean has_url = FALSE; gint n_selected; guint32 state = 0; memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); n_selected = e_table_selected_count (E_TABLE (memo_table)); list = e_memo_table_get_selected (memo_table); for (iter = list; iter != NULL; iter = iter->next) { ECalModelComponent *comp_data = iter->data; icalproperty *prop; gboolean read_only; if (!comp_data) continue; read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY); has_url |= (prop != NULL); } g_slist_free (list); if (n_selected == 1) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_SINGLE; if (n_selected > 1) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_MULTIPLE; if (editable) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_IS_EDITABLE; if (has_url) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_HAS_URL; return state; }
static void memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content, gint row, gint col, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time) { EMemoTable *memo_table; GdkAtom target; struct { ECalModel *model; GSList *list; } foreach_data; /* Sanity check the selection target. */ target = gtk_selection_data_get_target (selection_data); if (!e_targets_include_calendar (&target, 1)) return; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); foreach_data.model = e_memo_table_get_model (memo_table); foreach_data.list = NULL; e_table_selected_row_foreach ( E_TABLE (memo_table), memo_shell_content_table_foreach_cb, &foreach_data); if (foreach_data.list != NULL) { cal_comp_selection_set_string_list ( selection_data, foreach_data.list); g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL); g_slist_free (foreach_data.list); } }
static AtkObject * eti_ref_accessible_at_point (AtkComponent *component, gint x, gint y, AtkCoordType coord_type) { gint row = -1; gint col = -1; gint x_origin, y_origin; ETableItem *item; GtkWidget *tableOrTree; item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (component))); if (!item) return NULL; atk_component_get_extents ( component, &x_origin, &y_origin, NULL, NULL, coord_type); x -= x_origin; y -= y_origin; tableOrTree = gtk_widget_get_parent (GTK_WIDGET (item->parent.canvas)); if (E_IS_TREE (tableOrTree)) e_tree_get_cell_at (E_TREE (tableOrTree), x, y, &row, &col); else e_table_get_cell_at (E_TABLE (tableOrTree), x, y, &row, &col); if (row != -1 && col != -1) { return eti_ref_at (ATK_TABLE (component), row, col); } else { return NULL; } }
/* Component IFace */ static void gal_a11y_e_cell_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type) { GalA11yECell *a11y = GAL_A11Y_E_CELL (component); GtkWidget *tableOrTree; gint row; gint col; gint xval; gint yval; row = a11y->row; col = a11y->view_col; tableOrTree = gtk_widget_get_parent (GTK_WIDGET (a11y->item->parent.canvas)); if (E_IS_TREE (tableOrTree)) { e_tree_get_cell_geometry ( E_TREE (tableOrTree), row, col, &xval, &yval, width, height); } else { e_table_get_cell_geometry ( E_TABLE (tableOrTree), row, col, &xval, &yval, width, height); } atk_component_get_extents ( ATK_COMPONENT (a11y->parent), x, y, NULL, NULL, coord_type); if (x && *x != G_MININT) *x += xval; if (y && *y != G_MININT) *y += yval; }
void e_task_shell_view_update_sidebar (ETaskShellView *task_shell_view) { ETaskShellContent *task_shell_content; EShellView *shell_view; EShellSidebar *shell_sidebar; ETaskTable *task_table; ECalModel *model; GString *string; const gchar *format; gint n_rows; gint n_selected; shell_view = E_SHELL_VIEW (task_shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); task_shell_content = task_shell_view->priv->task_shell_content; task_table = e_task_shell_content_get_task_table (task_shell_content); model = e_task_table_get_model (task_table); n_rows = e_table_model_row_count (E_TABLE_MODEL (model)); n_selected = e_table_selected_count (E_TABLE (task_table)); string = g_string_sized_new (64); format = ngettext ("%d task", "%d tasks", n_rows); g_string_append_printf (string, format, n_rows); if (n_selected > 0) { format = _("%d selected"); g_string_append_len (string, ", ", 2); g_string_append_printf (string, format, n_selected); } e_shell_sidebar_set_secondary_text (shell_sidebar, string->str); g_string_free (string, TRUE); }
static void memo_shell_content_constructed (GObject *object) { EMemoShellContentPrivate *priv; EShell *shell; EShellView *shell_view; EShellContent *shell_content; EShellTaskbar *shell_taskbar; EShellWindow *shell_window; ESourceRegistry *registry; GalViewInstance *view_instance; GtkTargetList *target_list; GtkTargetEntry *targets; GtkWidget *container; GtkWidget *widget; gint n_targets; priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_memo_shell_content_parent_class)->constructed (object); shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); registry = e_shell_get_registry (shell); priv->memo_model = e_cal_model_memos_new (registry); /* Build content widgets. */ container = GTK_WIDGET (object); widget = e_paned_new (GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (container), widget); priv->paned = g_object_ref (widget); gtk_widget_show (widget); g_object_bind_property ( object, "orientation", widget, "orientation", G_BINDING_SYNC_CREATE); container = priv->paned; widget = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW (widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN); gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, FALSE); gtk_widget_show (widget); container = widget; widget = e_memo_table_new (shell_view, priv->memo_model); gtk_container_add (GTK_CONTAINER (container), widget); priv->memo_table = g_object_ref (widget); gtk_widget_show (widget); container = priv->paned; widget = e_cal_component_preview_new (); gtk_widget_show (widget); g_signal_connect_swapped ( widget, "status-message", G_CALLBACK (e_shell_taskbar_set_message), shell_taskbar); widget = e_preview_pane_new (E_WEB_VIEW (widget)); gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE); priv->preview_pane = g_object_ref (widget); gtk_widget_show (widget); g_object_bind_property ( object, "preview-visible", widget, "visible", G_BINDING_SYNC_CREATE); target_list = gtk_target_list_new (NULL, 0); e_target_list_add_calendar_targets (target_list, 0); targets = gtk_target_table_new_from_list (target_list, &n_targets); e_table_drag_source_set ( E_TABLE (priv->memo_table), GDK_BUTTON1_MASK, targets, n_targets, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK); gtk_target_table_free (targets, n_targets); gtk_target_list_unref (target_list); g_signal_connect_swapped ( priv->memo_table, "table-drag-data-get", G_CALLBACK (memo_shell_content_table_drag_data_get_cb), object); g_signal_connect_swapped ( priv->memo_table, "table-drag-data-delete", G_CALLBACK (memo_shell_content_table_drag_data_delete_cb), object); g_signal_connect_swapped ( priv->memo_table, "cursor-change", G_CALLBACK (memo_shell_content_cursor_change_cb), object); g_signal_connect_swapped ( priv->memo_table, "selection-change", G_CALLBACK (memo_shell_content_selection_change_cb), object); e_signal_connect_notify ( priv->memo_table, "notify::is-editing", G_CALLBACK (memo_shell_content_is_editing_changed_cb), shell_view); g_signal_connect_swapped ( priv->memo_model, "model-row-changed", G_CALLBACK (memo_shell_content_model_row_changed_cb), object); /* Load the view instance. */ view_instance = e_shell_view_new_view_instance (shell_view, NULL); g_signal_connect_swapped ( view_instance, "display-view", G_CALLBACK (memo_shell_content_display_view_cb), object); e_shell_view_set_view_instance (shell_view, view_instance); gal_view_instance_load (view_instance); g_object_unref (view_instance); /* Restore pane positions from the last session once * the shell view is fully initialized and visible. */ g_signal_connect ( shell_window, "shell-view-created::memos", G_CALLBACK (memo_shell_content_restore_state_cb), shell_content); }
void e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view) { ECalShellContent *cal_shell_content; EShellWindow *shell_window; EShellView *shell_view; ETaskTable *task_table; GtkAction *action; GSList *list, *iter; gboolean assignable = TRUE; gboolean editable = TRUE; gboolean has_url = FALSE; gboolean sensitive; gint n_selected; gint n_complete = 0; gint n_incomplete = 0; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; task_table = e_cal_shell_content_get_task_table (cal_shell_content); n_selected = e_table_selected_count (E_TABLE (task_table)); list = e_task_table_get_selected (task_table); for (iter = list; iter != NULL; iter = iter->next) { ECalModelComponent *comp_data = iter->data; icalproperty *prop; const gchar *cap; gboolean read_only; read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT; if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK; if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; prop = icalcomponent_get_first_property ( comp_data->icalcomp, ICAL_URL_PROPERTY); has_url |= (prop != NULL); prop = icalcomponent_get_first_property ( comp_data->icalcomp, ICAL_COMPLETED_PROPERTY); if (prop != NULL) n_complete++; else n_incomplete++; } g_slist_free (list); action = ACTION (CALENDAR_TASKPAD_ASSIGN); sensitive = (n_selected == 1) && editable && assignable; gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_TASKPAD_FORWARD); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_TASKPAD_MARK_COMPLETE); sensitive = (n_selected > 0) && editable && (n_incomplete > 0); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_TASKPAD_MARK_INCOMPLETE); sensitive = (n_selected > 0) && editable && (n_complete > 0); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_TASKPAD_OPEN); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_TASKPAD_OPEN_URL); sensitive = (n_selected == 1) && has_url; gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_TASKPAD_PRINT); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_TASKPAD_SAVE_AS); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); }
static void task_shell_content_constructed (GObject *object) { ETaskShellContent *task_shell_content; EShellView *shell_view; EShellContent *shell_content; EShellTaskbar *shell_taskbar; ECalModel *model; GalViewInstance *view_instance; GtkTargetList *target_list; GtkTargetEntry *targets; GtkWidget *container; GtkWidget *widget; gint n_targets; task_shell_content = E_TASK_SHELL_CONTENT (object); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_task_shell_content_parent_class)->constructed (object); model = e_cal_base_shell_content_get_model (E_CAL_BASE_SHELL_CONTENT (task_shell_content)); shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); /* Build content widgets. */ container = GTK_WIDGET (object); widget = e_paned_new (GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (container), widget); task_shell_content->priv->paned = g_object_ref (widget); gtk_widget_show (widget); e_binding_bind_property ( object, "orientation", widget, "orientation", G_BINDING_SYNC_CREATE); container = task_shell_content->priv->paned; widget = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW (widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, FALSE); gtk_widget_show (widget); container = widget; widget = e_task_table_new (shell_view, model); gtk_container_add (GTK_CONTAINER (container), widget); task_shell_content->priv->task_table = g_object_ref (widget); gtk_widget_show (widget); container = task_shell_content->priv->paned; widget = e_cal_component_preview_new (); gtk_widget_show (widget); g_signal_connect_swapped ( widget, "status-message", G_CALLBACK (e_shell_taskbar_set_message), shell_taskbar); widget = e_preview_pane_new (E_WEB_VIEW (widget)); gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE); task_shell_content->priv->preview_pane = g_object_ref (widget); gtk_widget_show (widget); e_binding_bind_property ( object, "preview-visible", widget, "visible", G_BINDING_SYNC_CREATE); target_list = gtk_target_list_new (NULL, 0); e_target_list_add_calendar_targets (target_list, 0); targets = gtk_target_table_new_from_list (target_list, &n_targets); e_table_drag_source_set ( E_TABLE (task_shell_content->priv->task_table), GDK_BUTTON1_MASK, targets, n_targets, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK); gtk_target_table_free (targets, n_targets); gtk_target_list_unref (target_list); g_signal_connect_swapped ( task_shell_content->priv->task_table, "table-drag-data-get", G_CALLBACK (task_shell_content_table_drag_data_get_cb), object); g_signal_connect_swapped ( task_shell_content->priv->task_table, "table-drag-data-delete", G_CALLBACK (task_shell_content_table_drag_data_delete_cb), object); g_signal_connect_swapped ( task_shell_content->priv->task_table, "cursor-change", G_CALLBACK (task_shell_content_cursor_change_cb), object); g_signal_connect_swapped ( task_shell_content->priv->task_table, "selection-change", G_CALLBACK (task_shell_content_selection_change_cb), object); e_signal_connect_notify ( task_shell_content->priv->task_table, "notify::is-editing", G_CALLBACK (task_shell_content_is_editing_changed_cb), shell_view); g_signal_connect_swapped ( model, "model-row-changed", G_CALLBACK (task_shell_content_model_row_changed_cb), object); /* Prepare the view instance. */ view_instance = e_shell_view_new_view_instance (shell_view, NULL); g_signal_connect_swapped ( view_instance, "display-view", G_CALLBACK (task_shell_content_display_view_cb), object); e_shell_view_set_view_instance (shell_view, view_instance); g_object_unref (view_instance); }
static guint32 task_shell_content_check_state (EShellContent *shell_content) { ETaskShellContent *task_shell_content; ETaskTable *task_table; GSList *list, *iter; gboolean assignable = TRUE; gboolean editable = TRUE; gboolean has_url = FALSE; gint n_selected; gint n_complete = 0; gint n_incomplete = 0; guint32 state = 0; task_shell_content = E_TASK_SHELL_CONTENT (shell_content); task_table = e_task_shell_content_get_task_table (task_shell_content); n_selected = e_table_selected_count (E_TABLE (task_table)); list = e_task_table_get_selected (task_table); for (iter = list; iter != NULL; iter = iter->next) { ECalModelComponent *comp_data = iter->data; icalproperty *prop; const gchar *cap; gboolean read_only; if (!comp_data) continue; read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT; if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK; if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; prop = icalcomponent_get_first_property ( comp_data->icalcomp, ICAL_URL_PROPERTY); has_url |= (prop != NULL); prop = icalcomponent_get_first_property ( comp_data->icalcomp, ICAL_COMPLETED_PROPERTY); if (prop != NULL) n_complete++; else n_incomplete++; } g_slist_free (list); if (n_selected == 1) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_SINGLE; if (n_selected > 1) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_MULTIPLE; if (assignable) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_CAN_ASSIGN; if (editable) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_IS_EDITABLE; if (n_complete > 0) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_HAS_COMPLETE; if (n_incomplete > 0) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE; if (has_url) state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_HAS_URL; return state; }