[gnome-software/wip/rancell/paid: 2/3] Add a stub purchase dialog



commit 63c0b6bb0043ba68c586573982ef1167346b244d
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Feb 24 11:44:19 2016 +1300

    Add a stub purchase dialog

 po/POTFILES.in                   |    2 +
 src/Makefile.am                  |    3 +
 src/gnome-software.gresource.xml |    1 +
 src/gs-purchase-dialog.c         |   58 +++++++++++++++++++++++++++
 src/gs-purchase-dialog.h         |   39 ++++++++++++++++++
 src/gs-purchase-dialog.ui        |   80 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 183 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0f37728..5235b00 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -24,6 +24,8 @@ src/gs-main.c
 src/gs-page.c
 src/gs-plugin-loader.c
 src/gs-popular-tile.c
+src/gs-purchase-dialog.c
+[type: gettext/glade]src/gs-purchase-dialog.ui
 src/gs-review-dialog.c
 [type: gettext/glade]src/gs-review-dialog.ui
 [type: gettext/glade]src/gs-review-histogram.ui
diff --git a/src/Makefile.am b/src/Makefile.am
index dbfc813..16f5af6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,7 @@ UI_FILES =                                            \
        gs-info-bar.ui                                  \
        gs-menus.ui                                     \
        gs-popular-tile.ui                              \
+       gs-purchase-dialog.ui                           \
        gs-review-dialog.ui                             \
        gs-review-histogram.ui                          \
        gs-review-row.ui                                \
@@ -159,6 +160,8 @@ gnome_software_SOURCES =                            \
        gs-plugin-private.h                             \
        gs-progress-button.c                            \
        gs-progress-button.h                            \
+       gs-purchase-dialog.c                            \
+       gs-purchase-dialog.h                            \
        gs-review.c                                     \
        gs-review.h                                     \
        gs-review-bar.c                                 \
diff --git a/src/gnome-software.gresource.xml b/src/gnome-software.gresource.xml
index 773ce8e..821352b 100644
--- a/src/gnome-software.gresource.xml
+++ b/src/gnome-software.gresource.xml
@@ -13,6 +13,7 @@
   <file preprocess="xml-stripblanks">gs-history-dialog.ui</file>
   <file preprocess="xml-stripblanks">gs-info-bar.ui</file>
   <file preprocess="xml-stripblanks">gs-popular-tile.ui</file>
+  <file preprocess="xml-stripblanks">gs-purchase-dialog.ui</file>
   <file preprocess="xml-stripblanks">gs-review-dialog.ui</file>
   <file preprocess="xml-stripblanks">gs-review-histogram.ui</file>
   <file preprocess="xml-stripblanks">gs-review-row.ui</file>
diff --git a/src/gs-purchase-dialog.c b/src/gs-purchase-dialog.c
new file mode 100644
index 0000000..2e332a1
--- /dev/null
+++ b/src/gs-purchase-dialog.c
@@ -0,0 +1,58 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2016 Canonical Ltd.
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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 <gtk/gtk.h>
+
+#include "gs-purchase-dialog.h"
+
+struct _GsPurchaseDialog
+{
+       GtkDialog        parent_instance;
+};
+
+G_DEFINE_TYPE (GsPurchaseDialog, gs_purchase_dialog, GTK_TYPE_DIALOG)
+
+static void
+gs_purchase_dialog_init (GsPurchaseDialog *dialog)
+{
+       gtk_widget_init_template (GTK_WIDGET (dialog));
+}
+
+static void
+gs_purchase_dialog_class_init (GsPurchaseDialogClass *klass)
+{
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/gs-purchase-dialog.ui");
+}
+
+GtkWidget *
+gs_purchase_dialog_new (void)
+{
+       return GTK_WIDGET (g_object_new (GS_TYPE_PURCHASE_DIALOG,
+                                        "use-header-bar", TRUE,
+                                        NULL));
+}
+
+/* vim: set noexpandtab: */
diff --git a/src/gs-purchase-dialog.h b/src/gs-purchase-dialog.h
new file mode 100644
index 0000000..e91ff21
--- /dev/null
+++ b/src/gs-purchase-dialog.h
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2016 Canonical Ltd.
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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 GS_PURCHASE_DIALOG_H
+#define GS_PURCHASE_DIALOG_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GS_TYPE_PURCHASE_DIALOG (gs_purchase_dialog_get_type ())
+
+G_DECLARE_FINAL_TYPE (GsPurchaseDialog, gs_purchase_dialog, GS, PURCHASE_DIALOG, GtkDialog)
+
+GtkWidget      *gs_purchase_dialog_new         (void);
+
+G_END_DECLS
+
+#endif /* GS_PURCHASE_DIALOG_H */
+
+/* vim: set noexpandtab: */
diff --git a/src/gs-purchase-dialog.ui b/src/gs-purchase-dialog.ui
new file mode 100644
index 0000000..453275d
--- /dev/null
+++ b/src/gs-purchase-dialog.ui
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <template class="GsReviewDialog" parent="GtkDialog">
+    <action-widgets>
+      <action-widget response="cancel">cancel_button</action-widget>
+      <action-widget response="ok">purchase_button</action-widget>
+    </action-widgets>
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes" comments="Translators: Title of the dialog box where users 
purchase apps.">Purchase</property>
+    <property name="modal">True</property>
+    <property name="default_width">600</property>
+    <property name="default_height">300</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="use_header_bar">1</property>
+    <child internal-child="headerbar">
+      <object class="GtkHeaderBar">
+        <property name="show_close_button">False</property>
+        <child>
+          <object class="GtkButton" id="cancel_button">
+            <property name="label" translatable="yes">_Cancel</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="purchase_button">
+            <property name="label" translatable="yes" comments="Translators: A button to purchase an 
app.">_Purchase</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+            <style>
+              <class name="suggested-action"/>
+            </style>
+          </object>
+          <packing>
+            <property name="pack-type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox">
+        <property name="can_focus">False</property>
+        <property name="margin_start">40</property>
+        <property name="margin_end">40</property>
+        <property name="margin_top">25</property>
+        <property name="margin_bottom">25</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">9</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+  <object class="GtkSizeGroup" id="sizegroup_folder_buttons">
+    <property name="ignore-hidden">False</property>
+    <property name="mode">horizontal</property>
+    <widgets>
+      <widget name="cancel_button"/>
+      <widget name="post_button"/>
+    </widgets>
+  </object>
+</interface>


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