[gnome-photos/wip/collection-dialog: 140/140] start collection dialog
- From: Alessandro Bono <abono src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/collection-dialog: 140/140] start collection dialog
- Date: Wed, 9 Dec 2015 14:36:04 +0000 (UTC)
commit b6872927e2c1e899dcfbe8ec0debb9fb9da08a4f
Author: Alessandro Bono <shadow openaliasbox org>
Date: Mon Oct 26 15:34:37 2015 +0100
start collection dialog
src/Makefile.am | 2 +
src/photos-organize-collection-dialog.c | 154 +++++++++++++++---------
src/photos-organize-collection-dialog.h | 4 +-
src/photos-organize-collection-dialog.ui | 195 ++++++++++++++++++++++++++++++
src/photos-organize-collection-list.c | 194 +++++++++++++++++++++++++++++
src/photos-organize-collection-list.h | 79 ++++++++++++
src/photos-selection-toolbar.c | 12 +-
src/photos.gresource.xml | 1 +
8 files changed, 578 insertions(+), 63 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 66cdb49..b975301 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -130,6 +130,8 @@ gnome_photos_SOURCES = \
photos-operation-insta-filter.h \
photos-organize-collection-dialog.c \
photos-organize-collection-dialog.h \
+ photos-organize-collection-list.c \
+ photos-organize-collection-list.h \
photos-organize-collection-model.c \
photos-organize-collection-model.h \
photos-organize-collection-view.c \
diff --git a/src/photos-organize-collection-dialog.c b/src/photos-organize-collection-dialog.c
index c9fff67..f7d56b3 100644
--- a/src/photos-organize-collection-dialog.c
+++ b/src/photos-organize-collection-dialog.c
@@ -25,6 +25,7 @@
#include "config.h"
+#include <gio/gio.h>
#include <glib/gi18n.h>
#include "photos-organize-collection-dialog.h"
@@ -33,82 +34,132 @@
struct _PhotosOrganizeCollectionDialogPrivate
{
- GtkWidget *coll_view;
+ gboolean rename_mode;
+ GtkButton *add_button_empty;
+ GtkButton *add_button_collections;
+ GtkButton *add_entry_empty;
+ GtkButton *add_entry_collections;
+ GtkWidget *collection_list;
+ GtkWidget *scrolled_window_collections;
};
-G_DEFINE_TYPE_WITH_PRIVATE (PhotosOrganizeCollectionDialog, photos_organize_collection_dialog,
GTK_TYPE_DIALOG);
+G_DEFINE_TYPE_WITH_PRIVATE (PhotosOrganizeCollectionDialog, photos_organize_collection_dialog,
GTK_TYPE_WINDOW);
-
-static gboolean
-photos_organize_collection_dialog_button_press_event (PhotosOrganizeCollectionDialog *self, GdkEvent *event)
+static void
+photos_organize_collection_dialog_add_button_clicked (GtkButton *button, gpointer user_data)
{
- photos_organize_collection_view_confirmed_choice (PHOTOS_ORGANIZE_COLLECTION_VIEW (self->priv->coll_view));
- return FALSE;
+ PhotosOrganizeCollectionDialogPrivate *priv = PHOTOS_ORGANIZE_COLLECTION_DIALOG (user_data)->priv;
+ //TODO
}
-
static void
-photos_organize_collection_dialog_response (GtkDialog *dialog, gint response_id)
+photos_organize_collection_dialog_delete_collection (GSimpleAction *action, GVariant *parameter, gpointer
user_data)
{
- PhotosOrganizeCollectionDialog *self = PHOTOS_ORGANIZE_COLLECTION_DIALOG (dialog);
+ PhotosOrganizeCollectionDialogPrivate *priv = PHOTOS_ORGANIZE_COLLECTION_DIALOG (user_data)->priv;
+ const gchar *collId;
+ collId = g_variant_get_string (parameter, NULL);
+ //TODO
+}
- if (response_id != GTK_RESPONSE_ACCEPT)
- return;
+static gboolean
+photos_organize_collection_dialog_key_pressed (PhotosOrganizeCollectionDialog *self, GdkEventKey *event,
gpointer user_data)
+{
+ PhotosOrganizeCollectionDialogPrivate *priv = self->priv;
+
+ if (event->keyval == GDK_KEY_Escape)
+ {
+ if (priv->rename_mode)
+ gtk_widget_destroy (GTK_WIDGET (self));// TODO this._renameModeStop(false);
+ else
+ gtk_widget_destroy (GTK_WIDGET (self));
+
+ return GDK_EVENT_STOP;
+ }
+ return GDK_EVENT_PROPAGATE;
+}
- photos_organize_collection_view_add_collection (PHOTOS_ORGANIZE_COLLECTION_VIEW (self->priv->coll_view));
+static void
+photos_organize_collection_dialog_rename_mode_start (GSimpleAction *action, GVariant *parameter, gpointer
user_data)
+{
+ PhotosOrganizeCollectionDialogPrivate *priv = PHOTOS_ORGANIZE_COLLECTION_DIALOG (user_data)->priv;
+ const gchar *collId;
+ collId = g_variant_get_string (parameter, NULL);
+ photos_organize_collection_dialog_set_rename_mode (TRUE);
+ // TODO
}
+static void
+photos_organize_collection_dialog_text_changed (GtkEntry *entry, gpointer user_data)
+{
+ GtkButton *add_button;
+
+ PhotosOrganizeCollectionDialog *self = PHOTOS_ORGANIZE_COLLECTION_DIALOG (user_data);
+ PhotosOrganizeCollectionDialogPrivate *priv = self->priv;
+
+ gboolean sensitive = TRUE; // TODO check if is valid
+ if (priv->rename_mode)
+ {
+ // TODO
+ }
+ else
+ {
+ add_button = priv->add_button_empty;// TODO check if empty
+ gtk_widget_set_sensitive (GTK_WIDGET (add_button), sensitive);
+ }
+}
static void
photos_organize_collection_dialog_init (PhotosOrganizeCollectionDialog *self)
{
PhotosOrganizeCollectionDialogPrivate *priv;
- GtkWidget *content_area;
- GtkWidget *ok_button;
- GtkWidget *sw;
+ GSimpleActionGroup *action_group;
+ GSimpleAction *delete_action;
+ GSimpleAction *rename_action;
+ GVariantType *parameter_type;
self->priv = photos_organize_collection_dialog_get_instance_private (self);
priv = self->priv;
- gtk_dialog_add_button (GTK_DIALOG (self), _("_Add"), GTK_RESPONSE_ACCEPT);
- ok_button = gtk_dialog_add_button (GTK_DIALOG (self), _("_OK"), GTK_RESPONSE_CLOSE);
- gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_CLOSE);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (self));
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- gtk_widget_set_margin_start (sw, 5);
- gtk_widget_set_margin_end (sw, 5);
- gtk_widget_set_margin_bottom (sw, 3);
-
- priv->coll_view = photos_organize_collection_view_new ();
- gtk_container_add (GTK_CONTAINER (sw), priv->coll_view);
- gtk_container_add (GTK_CONTAINER (content_area), sw);
-
- /* HACK:
- * - We want clicking on "OK" to add the typed-in collection if
- * we're editing.
- * - Unfortunately, since we focus out of the editable entry in
- * order to click the button, we'll get an editing-canceled signal
- * on the renderer from GTK+. As this handler will run before
- * focus-out, we here signal the view to ignore the next
- * editing-canceled signal and add the collection in that case
- * instead.
- */
- g_signal_connect_swapped (ok_button,
- "button-press-event",
- G_CALLBACK (photos_organize_collection_dialog_button_press_event),
- self);
+ gtk_widget_init_template (GTK_WIDGET (self));
+
+ priv->rename_mode = FALSE;
+
+ g_signal_connect (self, "key-press-event", (GCallback) photos_organize_collection_dialog_key_pressed,
NULL);
+ g_signal_connect (priv->add_button_empty, "clicked", (GCallback)
photos_organize_collection_dialog_add_button_clicked, self);
+ g_signal_connect (priv->add_button_collections, "clicked", (GCallback)
photos_organize_collection_dialog_add_button_clicked, self);
+ g_signal_connect (priv->add_entry_empty, "changed", (GCallback)
photos_organize_collection_dialog_text_changed, self);
+ g_signal_connect (priv->add_entry_collections, "changed", (GCallback)
photos_organize_collection_dialog_text_changed, self);
+
+ action_group = g_simple_action_group_new ();
+ parameter_type = g_variant_type_new ("s");
+ delete_action = g_simple_action_new ("delete-collection", parameter_type);
+ g_variant_type_free (parameter_type);
+ parameter_type = g_variant_type_new ("s");
+ rename_action = g_simple_action_new ("rename-collection", parameter_type);
+ g_variant_type_free (parameter_type);
+ g_action_map_add_action (G_ACTION_MAP (action_group), G_ACTION (delete_action));
+ g_action_map_add_action (G_ACTION_MAP (action_group), G_ACTION (rename_action));
+ gtk_widget_insert_action_group (GTK_WIDGET (self), "dialog", G_ACTION_GROUP (action_group));
+
+ g_signal_connect (delete_action, "activate", (GCallback)
photos_organize_collection_dialog_rename_mode_start, self);
+ g_signal_connect (rename_action, "activate", (GCallback)
photos_organize_collection_dialog_delete_collection, self);
+
+ //TODO
}
static void
photos_organize_collection_dialog_class_init (PhotosOrganizeCollectionDialogClass *class)
{
- GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (class);
-
- dialog_class->response = photos_organize_collection_dialog_response;
+ GtkWindowClass *window_class = GTK_WINDOW_CLASS (class);
+
+ gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (window_class),
"/org/gnome/Photos/organize-collection-dialog.ui");
+ gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (window_class),
PhotosOrganizeCollectionDialog, add_button_empty);
+ gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (window_class),
PhotosOrganizeCollectionDialog, add_button_collections);
+ gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (window_class),
PhotosOrganizeCollectionDialog, add_entry_empty);
+ gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (window_class),
PhotosOrganizeCollectionDialog, add_entry_collections);
+ gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (window_class),
PhotosOrganizeCollectionDialog, scrolled_window_collections);
}
@@ -118,13 +169,6 @@ photos_organize_collection_dialog_new (GtkWindow *parent)
g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
return g_object_new (PHOTOS_TYPE_ORGANIZE_COLLECTION_DIALOG,
- "default-width", 400,
- "default-height", 250,
- "destroy-with-parent", TRUE,
- "modal", TRUE,
- /* Translators: "Organize" refers to photos in this context */
- "title", C_("Dialog title", "Organize"),
"transient-for", parent,
- "use-header-bar", TRUE,
NULL);
}
diff --git a/src/photos-organize-collection-dialog.h b/src/photos-organize-collection-dialog.h
index fd48449..dc4b787 100644
--- a/src/photos-organize-collection-dialog.h
+++ b/src/photos-organize-collection-dialog.h
@@ -57,13 +57,13 @@ typedef struct _PhotosOrganizeCollectionDialogPrivate PhotosOrganizeCollectionDi
struct _PhotosOrganizeCollectionDialog
{
- GtkDialog parent_instance;
+ GtkWindow parent_instance;
PhotosOrganizeCollectionDialogPrivate *priv;
};
struct _PhotosOrganizeCollectionDialogClass
{
- GtkDialogClass parent_class;
+ GtkWindowClass parent_class;
};
GType photos_organize_collection_dialog_get_type (void) G_GNUC_CONST;
diff --git a/src/photos-organize-collection-dialog.ui b/src/photos-organize-collection-dialog.ui
new file mode 100644
index 0000000..0a5f9eb
--- /dev/null
+++ b/src/photos-organize-collection-dialog.ui
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="3.12"/>
+ <template class="PhotosOrganizeCollectionDialog" parent="GtkWindow">
+ <property name="visible">True</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="default_width">420</property>
+ <property name="default_height">500</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <child>
+ <object class="GtkStack" id="content">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkGrid" id="view_empty">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkImage" id="image_empty">
+ <property name="visible">True</property>
+ <property name="pixel_size">96</property>
+ <property name="icon_name">inode-directory-symbolic</property>
+ <property name="margin_bottom">18</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_empty">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Enter a name for your first collection</property>
+ <property name="margin_bottom">6</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="add_entry_empty">
+ <property name="visible">True</property>
+ <property name="has_focus">True</property>
+ <property name="activates_default">True</property>
+ <property name="placeholder_text" translatable="yes">New Collection…</property>
+ <property name="margin_bottom">6</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="add_button_empty">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Add</property>
+ <property name="visible">True</property>
+ <property name="margin_start">36</property>
+ <property name="margin_end">36</property>
+ </object>
+ </child>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSpinner" id="view_spinner">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="width_request">32</property>
+ <property name="height_request">32</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkGrid" id="view_collections">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkGrid" id="add_grid_collections">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="margin">5</property>
+ <child>
+ <object class="GtkEntry" id="add_entry_collections">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
+ <property name="placeholder_text" translatable="yes">New Collection…</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="add_button_collections">
+ <property name="label" translatable="yes">Add</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolled_window_collections">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="titlebar">
+ <object class="GtkHeaderBar" id="header_bar">
+ <property name="visible">True</property>
+ <property name="title">Collections</property>
+ <property name="show_close_button">True</property>
+ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="label" translatable="yes">Cancel</property>
+ <property name="no_show_all">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="done_button">
+ <property name="label" translatable="yes">Done</property>
+ <property name="can_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="sensitive">False</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="collection-dialog"/>
+ </style>
+ </template>
+</interface>
diff --git a/src/photos-organize-collection-list.c b/src/photos-organize-collection-list.c
new file mode 100644
index 0000000..2a78bf2
--- /dev/null
+++ b/src/photos-organize-collection-list.c
@@ -0,0 +1,194 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 Alessandro Bono
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/* Based on code from:
+ * + Documents
+ */
+
+
+#include "config.h"
+
+#include <gio/gio.h>
+#include <glib/gi18n.h>
+
+#include "photos-base-item.h"
+#include "photos-base-manager.h"
+#include "photos-fetch-collection-state-job.h"
+#include "photos-organize-collection-list.h"
+#include "photos-search-context.h"
+
+
+struct _PhotosOrganizeCollectionListPrivate
+{
+ PhotosBaseManager *manager;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (PhotosOrganizeCollectionList, photos_organize_collection_list,
GTK_TYPE_LIST_BOX);
+
+static void
+photos_organize_collection_list_fetch_collection_state_executed (GHashTable *collection_state, gpointer
user_data)
+{
+ PhotosOrganizeCollectionList *self = PHOTOS_ORGANIZE_COLLECTION_LIST (user_data);
+ GHashTableIter collection_state_iter;
+ const gchar *idx;
+ gpointer value;
+
+ g_hash_table_iter_init (&collection_state_iter, collection_state);
+ while (g_hash_table_iter_next (&collection_state_iter, (gpointer) &idx, (gpointer) &value))
+ {
+ PhotosBaseItem *item;
+ gint state = GPOINTER_TO_INT (value);
+
+ if (state & PHOTOS_COLLECTION_STATE_HIDDEN)
+ continue;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_object_by_id (self->priv->manager, idx));
+ //TODO create and add collection
+ }
+
+ g_object_unref (self);
+}
+
+gboolean
+photos_organize_collection_list_is_empty (PhotosOrganizeCollectionList *self)
+{
+ return (gtk_container_get_children (GTK_CONTAINER (self)) == NULL);
+}
+
+gboolean
+photos_organize_collection_list_is_valid_name (PhotosOrganizeCollectionList *self, const gchar *name)
+{
+ GList *children;
+ GList *l;
+
+ if (name == NULL || (g_strcmp0 (name, "") == 0))
+ return FALSE;
+
+ children = gtk_container_get_children (GTK_CONTAINER (self));
+ for (l = children; l != NULL; l = l->next)
+ {
+ // TODO GIOExtension *extension = (GIOExtension *) l->data;
+ }
+ return TRUE;
+}
+
+static void
+photos_organize_collection_list_object_added (PhotosBaseManager *manager, GObject *object, gpointer
user_data)
+{
+ PhotosOrganizeCollectionList *self = PHOTOS_ORGANIZE_COLLECTION_LIST (user_data);
+ //photos_organize_collection_model_refresh_state (self);
+ // TODO
+}
+
+
+static void
+photos_organize_collection_list_object_removed (PhotosBaseManager *manager, GObject *object, gpointer
user_data)
+{
+ PhotosOrganizeCollectionList *self = PHOTOS_ORGANIZE_COLLECTION_LIST (user_data);
+ // TODO
+}
+
+static void
+photos_organize_collection_list_update_header_func (GtkListBoxRow *row,
+ GtkListBoxRow *before,
+ gpointer user_data)
+{
+ GtkWidget *current;
+
+ if (before == NULL)
+ {
+ gtk_list_box_row_set_header (row, NULL);
+ return;
+ }
+
+ current = gtk_list_box_row_get_header (row);
+ if (current == NULL)
+ {
+ current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_show (current);
+ gtk_list_box_row_set_header (row, current);
+ }
+}
+
+static gint
+photos_organize_collection_list_sort_func (GtkListBoxRow *row1,
+ GtkListBoxRow *row2,
+ gpointer user_data)
+{
+ return -1;//TODO
+}
+
+static void
+photos_organize_collection_list_init (PhotosOrganizeCollectionList *self)
+{
+ PhotosOrganizeCollectionListPrivate *priv;
+ GApplication *app;
+ PhotosSearchContextState *state;
+ PhotosFetchCollectionStateJob *job;
+ guint coll_added_id;
+ guint coll_removed_id;
+ self->priv = photos_organize_collection_list_get_instance_private (self);
+ priv = self->priv;
+
+ app = g_application_get_default ();
+ state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
+
+ priv->manager = g_object_ref (state->item_mngr);
+
+ g_signal_connect_object (priv->manager,
+ "object-added",
+ G_CALLBACK (photos_organize_collection_list_object_added),
+ self,
+ 0);
+ g_signal_connect_object (priv->manager,
+ "object-removed",
+ G_CALLBACK (photos_organize_collection_list_object_removed),
+ self,
+ 0);
+
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self), photos_organize_collection_list_update_header_func,
NULL, NULL);
+ gtk_list_box_set_sort_func (GTK_LIST_BOX (self), photos_organize_collection_list_sort_func, NULL, NULL);
+
+ //g_signal_connect () //TODO destoy signal
+
+ job = photos_fetch_collection_state_job_new ();
+ photos_fetch_collection_state_job_run (job,
+ photos_organize_collection_list_fetch_collection_state_executed,
+ g_object_ref (self));
+}
+
+
+static void
+photos_organize_collection_list_class_init (PhotosOrganizeCollectionListClass *class)
+{
+
+}
+
+
+GtkWidget *
+photos_organize_collection_list_new ()
+{
+ return g_object_new (PHOTOS_TYPE_ORGANIZE_COLLECTION_LIST,
+ "vexpand", FALSE,
+ "margin", 0,
+ "selection-mode", GTK_SELECTION_NONE,
+ NULL);
+}
diff --git a/src/photos-organize-collection-list.h b/src/photos-organize-collection-list.h
new file mode 100644
index 0000000..a741c07
--- /dev/null
+++ b/src/photos-organize-collection-list.h
@@ -0,0 +1,79 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 Alessandro Bono
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/* Based on code from:
+ * + Documents
+ */
+
+#ifndef PHOTOS_ORGANIZE_COLLECTION_LIST_H
+#define PHOTOS_ORGANIZE_COLLECTION_LIST_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_ORGANIZE_COLLECTION_LIST (photos_organize_collection_list_get_type ())
+
+#define PHOTOS_ORGANIZE_COLLECTION_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PHOTOS_TYPE_ORGANIZE_COLLECTION_LIST, PhotosOrganizeCollectionList))
+
+#define PHOTOS_ORGANIZE_COLLECTION_LIST_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PHOTOS_TYPE_ORGANIZE_COLLECTION_LIST, PhotosOrganizeCollectionListClass))
+
+#define PHOTOS_IS_ORGANIZE_COLLECTION_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ PHOTOS_TYPE_ORGANIZE_COLLECTION_LIST))
+
+#define PHOTOS_IS_ORGANIZE_COLLECTION_LIST_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ PHOTOS_TYPE_ORGANIZE_COLLECTION_LIST))
+
+#define PHOTOS_ORGANIZE_COLLECTION_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PHOTOS_TYPE_ORGANIZE_COLLECTION_LIST, PhotosOrganizeCollectionListClass))
+
+typedef struct _PhotosOrganizeCollectionList PhotosOrganizeCollectionList;
+typedef struct _PhotosOrganizeCollectionListClass PhotosOrganizeCollectionListClass;
+typedef struct _PhotosOrganizeCollectionListPrivate PhotosOrganizeCollectionListPrivate;
+
+struct _PhotosOrganizeCollectionList
+{
+ GtkListBox parent_instance;
+ PhotosOrganizeCollectionListPrivate *priv;
+};
+
+struct _PhotosOrganizeCollectionListClass
+{
+ GtkListBoxClass parent_class;
+};
+
+gboolean photos_organize_collection_list_is_empty (PhotosOrganizeCollectionList *self);
+
+gboolean photos_organize_collection_list_is_valid_name (PhotosOrganizeCollectionList *self,
const gchar *name);
+
+GType photos_organize_collection_list_get_type (void) G_GNUC_CONST;
+
+GtkWidget *photos_organize_collection_list_new (void);
+
+G_END_DECLS
+
+#endif /* PHOTOS_ORGANIZE_COLLECTION_LIST_H */
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index c502d93..0177cba 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -66,19 +66,19 @@ enum
};
+
static void
-photos_selection_toolbar_dialog_response (GtkDialog *dialog, gint response_id, gpointer user_data)
+photos_selection_toolbar_dialog_response (GtkWindow *dialog, gpointer user_data)
{
PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (user_data);
- if (response_id != GTK_RESPONSE_CLOSE)
- return;
+ //if (response_id != GTK_RESPONSE_CLOSE)
+ // return;
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ //gtk_widget_destroy (GTK_WIDGET (dialog));
photos_selection_controller_set_selection_mode (self->priv->sel_cntrlr, FALSE);
}
-
static void
photos_selection_toolbar_collection_clicked (GtkButton *button, gpointer user_data)
{
@@ -92,7 +92,7 @@ photos_selection_toolbar_collection_clicked (GtkButton *button, gpointer user_da
dialog = photos_organize_collection_dialog_new (GTK_WINDOW (toplevel));
gtk_widget_show_all (dialog);
- g_signal_connect (dialog, "response", G_CALLBACK (photos_selection_toolbar_dialog_response), self);
+ g_signal_connect (dialog, "destroy", G_CALLBACK (photos_selection_toolbar_dialog_response), self);
}
diff --git a/src/photos.gresource.xml b/src/photos.gresource.xml
index 7fa7693..2a1fbf8 100644
--- a/src/photos.gresource.xml
+++ b/src/photos.gresource.xml
@@ -4,6 +4,7 @@
<file alias="Adwaita.css">../data/Adwaita.css</file>
<file alias="dlna-renderers-dialog.ui" preprocess="xml-stripblanks"
compressed="true">photos-dlna-renderers-dialog.ui</file>
<file alias="dnd-counter.svg" preprocess="to-pixdata">../data/dnd-counter.svg</file>
+ <file alias="organize-collection-dialog.ui" preprocess="xml-stripblanks"
compressed="true">photos-organize-collection-dialog.ui</file>
<file alias="preview-menu.ui" preprocess="xml-stripblanks"
compressed="true">photos-preview-menu.ui</file>
<file alias="selection-menu.ui" preprocess="xml-stripblanks"
compressed="true">photos-selection-menu.ui</file>
<file alias="selection-toolbar.ui" preprocess="xml-stripblanks"
compressed="true">photos-selection-toolbar.ui</file>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]