[gnome-photos/wip/rishi/edit-mode: 25/26] Add PhotosEditPalette



commit 47d08ae35e1e0cc267b52afe7f63c6c6304c967a
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jun 1 08:08:17 2015 +0200

    Add PhotosEditPalette

 po/POTFILES.in            |    1 +
 src/Makefile.am           |    2 +
 src/photos-edit-palette.c |  143 +++++++++++++++++++++++++++++++++++++++++++++
 src/photos-edit-palette.h |   47 +++++++++++++++
 4 files changed, 193 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a7c91b4..dc64ee9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -11,6 +11,7 @@ src/photos-application.c
 src/photos-base-item.c
 src/photos-delete-notification.c
 [type: gettext/glade]src/photos-dlna-renderers-dialog.ui
+src/photos-edit-palette.c
 src/photos-embed.c
 src/photos-empty-results-box.c
 src/photos-facebook-item.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 07f4045..193d54c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,6 +98,8 @@ gnome_photos_SOURCES = \
        photos-dropdown.h \
        photos-edit-bar.c \
        photos-edit-bar.h \
+       photos-edit-palette.c \
+       photos-edit-palette.h \
        photos-embed.c \
        photos-embed.h \
        photos-empty-results-box.c \
diff --git a/src/photos-edit-palette.c b/src/photos-edit-palette.c
new file mode 100644
index 0000000..d77aa51
--- /dev/null
+++ b/src/photos-edit-palette.c
@@ -0,0 +1,143 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 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 <glib/gi18n.h>
+
+#include "photos-edit-palette.h"
+#include "photos-operation-insta-common.h"
+
+
+struct _PhotosEditPalette
+{
+  GtkGrid parent_instance;
+};
+
+struct _PhotosEditPaletteClass
+{
+  GtkGridClass parent_class;
+};
+
+
+G_DEFINE_TYPE (PhotosEditPalette, photos_edit_palette, GTK_TYPE_GRID);
+
+
+static void
+photos_edit_palette_button_revealer_clicked (GtkButton *button, gpointer user_data)
+{
+  GtkRevealer *revealer;
+
+  revealer = GTK_REVEALER (g_object_get_data (G_OBJECT (button), "edit-details-revealer"));
+  gtk_revealer_set_reveal_child (revealer, TRUE);
+}
+
+
+static void
+photos_edit_palette_constructed (GObject *object)
+{
+  PhotosEditPalette *self = PHOTOS_EDIT_PALETTE (object);
+  GtkWidget *button;
+  GtkWidget *grid;
+  GtkWidget *revealer;
+  GtkWidget *separator;
+  gint row;
+
+  G_OBJECT_CLASS (photos_edit_palette_parent_class)->constructed (object);
+
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
+
+  button = gtk_button_new_with_label (_("Apply Filters"));
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_container_add (GTK_CONTAINER (self), button);
+  g_signal_connect (button, "clicked", G_CALLBACK (photos_edit_palette_button_revealer_clicked), self);
+
+  revealer = gtk_revealer_new ();
+  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
+  g_object_set_data (G_OBJECT (button), "edit-details-revealer", revealer);
+  gtk_container_add (GTK_CONTAINER (self), revealer);
+
+  row = 0;
+  grid = gtk_grid_new ();
+  gtk_container_add (GTK_CONTAINER (revealer), grid);
+
+  button = gtk_button_new_with_label (_("Gray"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.gray-current");
+  gtk_grid_attach (GTK_GRID (grid), button, 0, row, 1, 1);
+
+  button = gtk_button_new_with_label (_("1977"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_1977);
+  gtk_grid_attach (GTK_GRID (grid), button, 1, row, 1, 1);
+  row++;
+
+  button = gtk_button_new_with_label (_("Brannan"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_BRANNAN);
+  gtk_grid_attach (GTK_GRID (grid), button, 0, row, 1, 1);
+
+  button = gtk_button_new_with_label (_("Gotham"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_GOTHAM);
+  gtk_grid_attach (GTK_GRID (grid), button, 1, row, 1, 1);
+  row++;
+
+  button = gtk_button_new_with_label (_("Nashville"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_NASHVILLE);
+  gtk_grid_attach (GTK_GRID (grid), button, 0, row, 1, 1);
+  row++;
+
+  separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+  gtk_container_add (GTK_CONTAINER (self), separator);
+
+  gtk_widget_show_all (GTK_WIDGET (self));
+}
+
+
+static void
+photos_edit_palette_init (PhotosEditPalette *self)
+{
+  /* GtkStyleContext *context; */
+
+  /* context = gtk_widget_get_style_context (GTK_WIDGET (self)); */
+  /* gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLBAR); */
+}
+
+
+static void
+photos_edit_palette_class_init (PhotosEditPaletteClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  object_class->constructed = photos_edit_palette_constructed;
+}
+
+
+GtkWidget *
+photos_edit_palette_new (void)
+{
+  return g_object_new (PHOTOS_TYPE_EDIT_PALETTE,
+                       "border-width", 30,
+                       "row-spacing", 6,
+                       "vexpand", TRUE,
+                       NULL);
+}
diff --git a/src/photos-edit-palette.h b/src/photos-edit-palette.h
new file mode 100644
index 0000000..f8150c1
--- /dev/null
+++ b/src/photos-edit-palette.h
@@ -0,0 +1,47 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 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_EDIT_PALETTE_H
+#define PHOTOS_EDIT_PALETTE_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_EDIT_PALETTE (photos_edit_palette_get_type ())
+
+#define PHOTOS_EDIT_PALETTE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_EDIT_PALETTE, PhotosEditPalette))
+
+#define PHOTOS_IS_EDIT_PALETTE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_EDIT_PALETTE))
+
+typedef struct _PhotosEditPalette      PhotosEditPalette;
+typedef struct _PhotosEditPaletteClass PhotosEditPaletteClass;
+
+GType                  photos_edit_palette_get_type               (void) G_GNUC_CONST;
+
+GtkWidget             *photos_edit_palette_new                    (void);
+
+G_END_DECLS
+
+#endif /* PHOTOS_EDIT_PALETTE_H */


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