[gnome-photos] Add PhotosOrganizeCollectionDialog



commit c196596739ef639c9e3607a7d7e9fc2e72c307e0
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Apr 25 22:34:53 2012 +0200

    Add PhotosOrganizeCollectionDialog

 src/Makefile.am                         |    2 +
 src/photos-organize-collection-dialog.c |   86 +++++++++++++++++++++++++++++++
 src/photos-organize-collection-dialog.h |   71 +++++++++++++++++++++++++
 src/photos-selection-toolbar.c          |   18 ++++++-
 4 files changed, 176 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 0faaa60..f89eabd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,6 +23,8 @@ gnome_photos_SOURCES = \
 	photos-main-window.h \
 	photos-mode-controller.c \
 	photos-mode-controller.h \
+	photos-organize-collection-dialog.c \
+	photos-organize-collection-dialog.h \
 	photos-selection-controller.c \
 	photos-selection-controller.h \
 	photos-selection-toolbar.c \
diff --git a/src/photos-organize-collection-dialog.c b/src/photos-organize-collection-dialog.c
new file mode 100644
index 0000000..45a5d57
--- /dev/null
+++ b/src/photos-organize-collection-dialog.c
@@ -0,0 +1,86 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright  2012 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+
+#include "config.h"
+
+#include "photos-organize-collection-dialog.h"
+
+
+G_DEFINE_TYPE (PhotosOrganizeCollectionDialog, photos_organize_collection_dialog, GTK_TYPE_DIALOG);
+
+
+static void
+photos_organize_collection_dialog_response (GtkDialog *dialog, gint response_id)
+{
+  if (response_id != GTK_RESPONSE_ACCEPT)
+    return;
+
+  /* TODO: OrganizeCollectionView */
+}
+
+
+static void
+photos_organize_collection_dialog_init (PhotosOrganizeCollectionDialog *self)
+{
+  PhotosOrganizeCollectionDialogPrivate *priv;
+  GtkWidget *content_area;
+  GtkWidget *sw;
+
+  gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT);
+  gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_OK, GTK_RESPONSE_OK);
+  gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
+
+  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_left (sw, 5);
+  gtk_widget_set_margin_right (sw, 5);
+  gtk_widget_set_margin_bottom (sw, 3);
+
+  /* TODO: OrganizeCollectionView */
+
+  gtk_container_add (GTK_CONTAINER (content_area), sw);
+  gtk_widget_show_all (GTK_WIDGET (self));
+}
+
+
+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;
+}
+
+
+GtkWidget *
+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,
+                       "transient-for", parent,
+                       NULL);
+}
diff --git a/src/photos-organize-collection-dialog.h b/src/photos-organize-collection-dialog.h
new file mode 100644
index 0000000..5e117b4
--- /dev/null
+++ b/src/photos-organize-collection-dialog.h
@@ -0,0 +1,71 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright  2012 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef PHOTOS_ORGANIZE_COLLECTION_DIALOG_H
+#define PHOTOS_ORGANIZE_COLLECTION_DIALOG_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_ORGANIZE_COLLECTION_DIALOG (photos_organize_collection_dialog_get_type ())
+
+#define PHOTOS_ORGANIZE_COLLECTION_DIALOG(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_ORGANIZE_COLLECTION_DIALOG, PhotosOrganizeCollectionDialog))
+
+#define PHOTOS_ORGANIZE_COLLECTION_DIALOG_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+   PHOTOS_TYPE_ORGANIZE_COLLECTION_DIALOG, PhotosOrganizeCollectionDialogClass))
+
+#define PHOTOS_IS_ORGANIZE_COLLECTION_DIALOG(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_ORGANIZE_COLLECTION_DIALOG))
+
+#define PHOTOS_IS_ORGANIZE_COLLECTION_DIALOG_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+   PHOTOS_TYPE_ORGANIZE_COLLECTION_DIALOG))
+
+#define PHOTOS_ORGANIZE_COLLECTION_DIALOG_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+   PHOTOS_TYPE_ORGANIZE_COLLECTION_DIALOG, PhotosOrganizeCollectionDialogClass))
+
+typedef struct _PhotosOrganizeCollectionDialog        PhotosOrganizeCollectionDialog;
+typedef struct _PhotosOrganizeCollectionDialogClass   PhotosOrganizeCollectionDialogClass;
+typedef struct _PhotosOrganizeCollectionDialogPrivate PhotosOrganizeCollectionDialogPrivate;
+
+struct _PhotosOrganizeCollectionDialog
+{
+  GtkDialog parent_instance;
+  PhotosOrganizeCollectionDialogPrivate *priv;
+};
+
+struct _PhotosOrganizeCollectionDialogClass
+{
+  GtkDialogClass parent_class;
+};
+
+GType               photos_organize_collection_dialog_get_type           (void) G_GNUC_CONST;
+
+GtkWidget          *photos_organize_collection_dialog_new                (GtkWindow *parent);
+
+G_END_DECLS
+
+#endif /* PHOTOS_ORGANIZE_COLLECTION_DIALOG_H */
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index 56a5b17..2db18e3 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -25,6 +25,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
+#include "photos-organize-collection-dialog.h"
 #include "photos-selection-controller.h"
 #include "photos-selection-toolbar.h"
 #include "photos-utils.h"
@@ -79,18 +80,33 @@ photos_selection_toolbar_fade_out (PhotosSelectionToolbar *self)
 
 
 static void
+photos_selection_toolbar_dialog_response (GtkDialog *dialog, gint response_id, gpointer user_data)
+{
+  PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (user_data);
+
+  if (response_id != GTK_RESPONSE_OK)
+    return;
+
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  photos_selection_toolbar_fade_in (self);
+}
+
+
+static void
 photos_selection_toolbar_collection_clicked (GtkButton *button, gpointer user_data)
 {
   PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (user_data);
   PhotosSelectionToolbarPrivate *priv = self->priv;
+  GtkWidget *dialog;
   GtkWidget *toplevel;
 
   toplevel = gtk_widget_get_toplevel (priv->widget);
   if (!gtk_widget_is_toplevel (toplevel))
     return;
 
+  dialog = photos_organize_collection_dialog_new (GTK_WINDOW (toplevel));
   photos_selection_toolbar_fade_out (self);
-  /* TODO: OrganizeCollectionDialog */
+  g_signal_connect (dialog, "response", G_CALLBACK (photos_selection_toolbar_dialog_response), self);
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]