[bijiben] SelectionToolbar: dont allow to organize collections
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] SelectionToolbar: dont allow to organize collections
- Date: Mon, 27 May 2013 21:37:52 +0000 (UTC)
commit 8975f7f7fce376818c4a37876d8d16b2b9046c61
Author: Pierre-Yves Luyten <py luyten fr>
Date: Mon May 27 22:49:39 2013 +0200
SelectionToolbar: dont allow to organize collections
Collections have only one level for now
src/bjb-main-view.c | 27 +++++++++++++++++++++++++++
src/bjb-main-view.h | 6 ++++--
src/bjb-selection-toolbar.c | 24 ++++++++++++++++++++++--
3 files changed, 53 insertions(+), 4 deletions(-)
---
diff --git a/src/bjb-main-view.c b/src/bjb-main-view.c
index 81c204b..9156127 100644
--- a/src/bjb-main-view.c
+++ b/src/bjb-main-view.c
@@ -268,6 +268,33 @@ action_tag_selected_items (GtkWidget *w, BjbMainView *view)
g_list_free (notes);
}
+
+GList *
+bjb_main_view_get_selected_items (BjbMainView *view)
+{
+ GList *l, *paths, *result = NULL;
+ gchar *url;
+ BijiItem *item;
+
+ /* GtkTreePath */
+ paths = get_selected_paths (view);
+
+
+ for (l=paths; l!= NULL; l=l->next)
+ {
+ url = get_note_url_from_tree_path (l->data, view);
+ item = biji_note_book_get_item_at_path (
+ bjb_window_base_get_book (view->priv->window), url);
+ if (BIJI_IS_ITEM (item))
+ result = g_list_prepend (result, item);
+
+ g_free (url);
+ }
+
+ g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
+ return result;
+}
+
gboolean
bjb_main_view_get_selected_items_color (BjbMainView *view, GdkRGBA *color)
{
diff --git a/src/bjb-main-view.h b/src/bjb-main-view.h
index 51aea63..980c243 100644
--- a/src/bjb-main-view.h
+++ b/src/bjb-main-view.h
@@ -60,9 +60,11 @@ GtkWidget *bjb_main_view_get_window(BjbMainView *view);
void action_new_window_callback(GtkAction *action, gpointer bjb_main_view);
+GList *bjb_main_view_get_selected_items (BjbMainView *view);
+
/* Currently it simply looks for first selected note found. Maybe most common color?
* Or use default color when several ones including at least one default color?*/
-gboolean bjb_main_view_get_selected_items_color (BjbMainView *view, GdkRGBA *color);
+gboolean bjb_main_view_get_selected_items_color (BjbMainView *view, GdkRGBA *color); // killme... killme...
void action_color_selected_items (GtkWidget *w,BjbMainView *view);
@@ -93,7 +95,7 @@ GdMainViewType bjb_main_view_get_view_type (BjbMainView *view);
void bjb_main_view_set_view_type (BjbMainView *view, GdMainViewType type);
-GList *bjb_main_view_get_selection (BjbMainView *view);
+GList *bjb_main_view_get_selection (BjbMainView *view); // killme... killme...
G_END_DECLS
diff --git a/src/bjb-selection-toolbar.c b/src/bjb-selection-toolbar.c
index b87165c..a105e4c 100644
--- a/src/bjb-selection-toolbar.c
+++ b/src/bjb-selection-toolbar.c
@@ -75,14 +75,34 @@ bjb_selection_toolbar_fade_out (BjbSelectionToolbar *self)
static void
bjb_selection_toolbar_set_item_visibility (BjbSelectionToolbar *self)
{
- BjbSelectionToolbarPrivate *priv = self->priv;
+ BjbSelectionToolbarPrivate *priv;
+ GList *l, *selection;
GdkRGBA color;
+ g_return_if_fail (BJB_IS_SELECTION_TOOLBAR (self));
+
+ priv = self->priv;
+ selection = bjb_main_view_get_selected_items (priv->view);
+
+ /* Trash, always,
+ * Color, awlays */
gtk_widget_set_visible (priv->toolbar_trash, TRUE);
- /* Color */
if (bjb_main_view_get_selected_items_color (priv->view, &color))
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (priv->toolbar_color), &color);
+
+ /* Organize */
+ gtk_widget_set_opacity (priv->toolbar_tag, 1);
+ for (l=selection; l!=NULL; l=l->next)
+ {
+ if (BIJI_IS_COLLECTION (l->data))
+ {
+ gtk_widget_set_opacity (priv->toolbar_tag, 0);
+ break;
+ }
+ }
+
+ g_list_free (selection);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]