[gnome-software/wip/temp/ubuntu-xenial-rebased: 83/329] Rename UbunutLoginDialog to GsUbuntuLoginDialog and fix various things



commit 5c987ce2e27dacdf38bc88488a28f7ffcfcdd31f
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Feb 11 11:34:09 2016 +1300

    Rename UbunutLoginDialog to GsUbuntuLoginDialog and fix various things

 src/gnome-software.gresource.xml                   |    2 +-
 src/gs-review-dialog.c                             |    2 +-
 src/plugins/Makefile.am                            |    2 +-
 ...ntu-login-dialog.c => gs-ubuntu-login-dialog.c} |  206 ++++++++++----------
 src/plugins/gs-ubuntu-login-dialog.h               |   39 ++++
 ...u-login-dialog.ui => gs-ubuntu-login-dialog.ui} |    4 +-
 src/plugins/ubuntu-login-dialog.h                  |   16 --
 7 files changed, 147 insertions(+), 124 deletions(-)
---
diff --git a/src/gnome-software.gresource.xml b/src/gnome-software.gresource.xml
index 71031d7..07d9733 100644
--- a/src/gnome-software.gresource.xml
+++ b/src/gnome-software.gresource.xml
@@ -33,6 +33,6 @@
   <file>gtk-style.css</file>
   <file>gtk-style-hc.css</file>
   <file>plugins/ubuntu-one.png</file>
-  <file preprocess="xml-stripblanks">plugins/ubuntu-login-dialog.ui</file>
+  <file preprocess="xml-stripblanks">plugins/gs-ubuntu-login-dialog.ui</file>
  </gresource>
 </gresources>
diff --git a/src/gs-review-dialog.c b/src/gs-review-dialog.c
index 5f18926..b07bd0b 100644
--- a/src/gs-review-dialog.c
+++ b/src/gs-review-dialog.c
@@ -156,7 +156,7 @@ gs_review_dialog_changed_cb (GsReviewDialog *dialog)
        gtk_widget_set_tooltip_text (dialog->post_button, msg);
 
        /* can the user submit this? */
-       gtk_widget_set_sensitive (dialog->post_button, all_okay);
+       gtk_widget_set_sensitive (dialog->post_button, TRUE);//all_okay);
 }
 
 static gboolean
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 7cafff6..dd921b6 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -179,7 +179,7 @@ endif
 
 libgs_plugin_ubuntu_reviews_la_SOURCES =               \
        gs-plugin-ubuntu-reviews.c                      \
-       ubuntu-login-dialog.c
+       gs-ubuntu-login-dialog.c
 libgs_plugin_ubuntu_reviews_la_LIBADD = $(GS_PLUGIN_LIBS) $(SOUP_LIBS) $(JSON_GLIB_LIBS) $(OAUTH_LIBS) 
$(SQLITE_LIBS)
 libgs_plugin_ubuntu_reviews_la_LDFLAGS = -module -avoid-version
 libgs_plugin_ubuntu_reviews_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
diff --git a/src/plugins/ubuntu-login-dialog.c b/src/plugins/gs-ubuntu-login-dialog.c
similarity index 76%
rename from src/plugins/ubuntu-login-dialog.c
rename to src/plugins/gs-ubuntu-login-dialog.c
index fe6d997..8108471 100644
--- a/src/plugins/ubuntu-login-dialog.c
+++ b/src/plugins/gs-ubuntu-login-dialog.c
@@ -19,7 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "ubuntu-login-dialog.h"
+#include "gs-ubuntu-login-dialog.h"
 
 #include <glib/gi18n.h>
 #include <json-glib/json-glib.h>
@@ -27,7 +27,7 @@
 
 #define UBUNTU_LOGIN_HOST "https://login.ubuntu.com";
 
-struct _UbuntuLoginDialog
+struct _GsUbuntuLoginDialog
 {
        GtkDialog parent_instance;
 
@@ -67,28 +67,28 @@ enum
        PROP_TOKEN_SECRET
 };
 
-G_DEFINE_TYPE (UbuntuLoginDialog, ubuntu_login_dialog, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE (GsUbuntuLoginDialog, gs_ubuntu_login_dialog, GTK_TYPE_DIALOG)
 
 static void
-ubuntu_login_dialog_finalize (GObject *object)
+gs_ubuntu_login_dialog_finalize (GObject *object)
 {
-       UbuntuLoginDialog *self = UBUNTU_LOGIN_DIALOG (object);
+       GsUbuntuLoginDialog *self = GS_UBUNTU_LOGIN_DIALOG (object);
 
        g_clear_pointer (&self->token_secret, g_free);
        g_clear_pointer (&self->token_key, g_free);
        g_clear_pointer (&self->consumer_secret, g_free);
        g_clear_pointer (&self->consumer_key, g_free);
 
-       G_OBJECT_CLASS (ubuntu_login_dialog_parent_class)->finalize (object);
+       G_OBJECT_CLASS (gs_ubuntu_login_dialog_parent_class)->finalize (object);
 }
 
 static void
-ubuntu_login_dialog_get_property (GObject    *object,
-                                 guint       property_id,
-                                 GValue     *value,
-                                 GParamSpec *pspec)
+gs_ubuntu_login_dialog_get_property (GObject    *object,
+                                    guint       property_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
 {
-       UbuntuLoginDialog *self = UBUNTU_LOGIN_DIALOG (object);
+       GsUbuntuLoginDialog *self = GS_UBUNTU_LOGIN_DIALOG (object);
 
        switch (property_id) {
        case PROP_SESSION:
@@ -126,12 +126,12 @@ ubuntu_login_dialog_get_property (GObject    *object,
 }
 
 static void
-ubuntu_login_dialog_set_property (GObject      *object,
-                                 guint  property_id,
-                                 const GValue *value,
-                                 GParamSpec   *pspec)
+gs_ubuntu_login_dialog_set_property (GObject      *object,
+                                    guint       property_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
 {
-       UbuntuLoginDialog *self = UBUNTU_LOGIN_DIALOG (object);
+       GsUbuntuLoginDialog *self = GS_UBUNTU_LOGIN_DIALOG (object);
 
        switch (property_id) {
        case PROP_SESSION:
@@ -149,32 +149,32 @@ ubuntu_login_dialog_set_property (GObject      *object,
 }
 
 static void
-ubuntu_login_dialog_class_init (UbuntuLoginDialogClass *klass)
+gs_ubuntu_login_dialog_class_init (GsUbuntuLoginDialogClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
        GParamFlags param_flags;
 
-       object_class->finalize = ubuntu_login_dialog_finalize;
-       object_class->get_property = ubuntu_login_dialog_get_property;
-       object_class->set_property = ubuntu_login_dialog_set_property;
-
-       gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/plugins/ubuntu-login-dialog.ui");
-
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, content_box);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, cancel_button);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, next_button);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, status_stack);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, status_image);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, status_label);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, page_stack);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, login_radio);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, register_radio);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, reset_radio);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, email_entry);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, password_entry);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, remember_check);
-       gtk_widget_class_bind_template_child (widget_class, UbuntuLoginDialog, passcode_entry);
+       object_class->finalize = gs_ubuntu_login_dialog_finalize;
+       object_class->get_property = gs_ubuntu_login_dialog_get_property;
+       object_class->set_property = gs_ubuntu_login_dialog_set_property;
+
+       gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/plugins/gs-ubuntu-login-dialog.ui");
+
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, content_box);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, cancel_button);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, next_button);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, status_stack);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, status_image);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, status_label);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, page_stack);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, login_radio);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, register_radio);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, reset_radio);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, email_entry);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, password_entry);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, remember_check);
+       gtk_widget_class_bind_template_child (widget_class, GsUbuntuLoginDialog, passcode_entry);
 
        param_flags = G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB;
 
@@ -197,45 +197,45 @@ ubuntu_login_dialog_class_init (UbuntuLoginDialogClass *klass)
                                                              param_flags |
                                                              G_PARAM_WRITABLE |
                                                              G_PARAM_CONSTRUCT));
-  g_object_class_install_property (object_class,
-                                  PROP_REMEMBER,
-                                  g_param_spec_boolean ("remember",
-                                                        "remember",
-                                                        "remember",
-                                                        FALSE,
-                                                        param_flags));
-
-  g_object_class_install_property (object_class,
-                                  PROP_CONSUMER_KEY,
-                                  g_param_spec_string ("consumer-key",
-                                                       "consumer key",
-                                                       "consumer key",
-                                                       NULL,
-                                                       param_flags));
-
-  g_object_class_install_property (object_class,
-                                  PROP_CONSUMER_SECRET,
-                                  g_param_spec_string ("consumer-secret",
-                                                       "consumer secret",
-                                                       "consumer secret",
-                                                       NULL,
-                                                       param_flags));
-
-  g_object_class_install_property (object_class,
-                                  PROP_TOKEN_KEY,
-                                  g_param_spec_string ("token-key",
-                                                       "token key",
-                                                       "token key",
-                                                       NULL,
-                                                       param_flags));
-
-  g_object_class_install_property (object_class,
-                                  PROP_TOKEN_SECRET,
-                                  g_param_spec_string ("token-secret",
-                                                       "token secret",
-                                                       "token secret",
-                                                       NULL,
-                                                       param_flags));
+       g_object_class_install_property (object_class,
+                                        PROP_REMEMBER,
+                                        g_param_spec_boolean ("remember",
+                                                              "remember",
+                                                              "remember",
+                                                              FALSE,
+                                                              param_flags));
+
+       g_object_class_install_property (object_class,
+                                        PROP_CONSUMER_KEY,
+                                        g_param_spec_string ("consumer-key",
+                                                             "consumer key",
+                                                             "consumer key",
+                                                             NULL,
+                                                             param_flags));
+
+       g_object_class_install_property (object_class,
+                                        PROP_CONSUMER_SECRET,
+                                        g_param_spec_string ("consumer-secret",
+                                                             "consumer secret",
+                                                             "consumer secret",
+                                                             NULL,
+                                                             param_flags));
+
+       g_object_class_install_property (object_class,
+                                        PROP_TOKEN_KEY,
+                                        g_param_spec_string ("token-key",
+                                                             "token key",
+                                                             "token key",
+                                                             NULL,
+                                                             param_flags));
+
+       g_object_class_install_property (object_class,
+                                        PROP_TOKEN_SECRET,
+                                        g_param_spec_string ("token-secret",
+                                                             "token secret",
+                                                             "token secret",
+                                                             NULL,
+                                                             param_flags));
 }
 
 static gboolean
@@ -255,7 +255,7 @@ is_email_address (const gchar *text)
 }
 
 static void
-update_widgets (UbuntuLoginDialog *self)
+update_widgets (GsUbuntuLoginDialog *self)
 {
        if (g_str_equal (gtk_stack_get_visible_child_name (GTK_STACK (self->page_stack)), "page-0")) {
                gtk_widget_set_sensitive (self->next_button,
@@ -276,20 +276,20 @@ update_widgets (UbuntuLoginDialog *self)
 }
 
 static void
-cancel_button_clicked_cb (UbuntuLoginDialog *self,
+cancel_button_clicked_cb (GsUbuntuLoginDialog *self,
                          GtkButton      *button)
 {
        gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_CANCEL);
 }
 
-typedef void (*ResponseCallback) (UbuntuLoginDialog *self,
+typedef void (*ResponseCallback) (GsUbuntuLoginDialog *self,
                                  guint       status,
                                  GVariant        *response,
                                  gpointer         user_data);
 
 typedef struct
 {
-       UbuntuLoginDialog *dialog;
+       GsUbuntuLoginDialog *dialog;
        ResponseCallback callback;
        gpointer user_data;
 } RequestInfo;
@@ -324,12 +324,12 @@ response_received_cb (SoupSession *session,
 }
 
 static void
-send_request (UbuntuLoginDialog *self,
-             const gchar       *method,
-             const gchar       *uri,
-             GVariant    *request,
-             ResponseCallback   callback,
-             gpointer     user_data)
+send_request (GsUbuntuLoginDialog *self,
+             const gchar         *method,
+             const gchar         *uri,
+             GVariant            *request,
+             ResponseCallback     callback,
+             gpointer             user_data)
 {
        RequestInfo *info;
        SoupMessage *message;
@@ -353,10 +353,10 @@ send_request (UbuntuLoginDialog *self,
 }
 
 static void
-receive_login_response_cb (UbuntuLoginDialog *self,
-                          guint              status,
-                          GVariant       *response,
-                          gpointer        user_data)
+receive_login_response_cb (GsUbuntuLoginDialog *self,
+                          guint               status,
+                          GVariant           *response,
+                          gpointer            user_data)
 {
        PangoAttrList *attributes;
        const gchar *code;
@@ -444,7 +444,7 @@ receive_login_response_cb (UbuntuLoginDialog *self,
 }
 
 static void
-send_login_request (UbuntuLoginDialog *self)
+send_login_request (GsUbuntuLoginDialog *self)
 {
        PangoAttrList *attributes;
 
@@ -500,8 +500,8 @@ send_login_request (UbuntuLoginDialog *self)
 }
 
 static void
-next_button_clicked_cb (UbuntuLoginDialog *self,
-                       GtkButton        *button)
+next_button_clicked_cb (GsUbuntuLoginDialog *self,
+                       GtkButton           *button)
 {
        if (g_str_equal (gtk_stack_get_visible_child_name (GTK_STACK (self->page_stack)), "page-0")) {
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->login_radio))) {
@@ -519,29 +519,29 @@ next_button_clicked_cb (UbuntuLoginDialog *self,
 }
 
 static void
-radio_button_toggled_cb (UbuntuLoginDialog *self,
+radio_button_toggled_cb (GsUbuntuLoginDialog *self,
                         GtkToggleButton   *toggle)
 {
        update_widgets (self);
 }
 
 static void
-entry_edited_cb (UbuntuLoginDialog *self,
-                GParamSpec        *pspec,
-                GObject           *object)
+entry_edited_cb (GsUbuntuLoginDialog *self,
+                GParamSpec          *pspec,
+                GObject             *object)
 {
        update_widgets (self);
 }
 
 static void
-remember_check_toggled_cb (UbuntuLoginDialog *self,
-                          GtkToggleButton   *toggle)
+remember_check_toggled_cb (GsUbuntuLoginDialog *self,
+                          GtkToggleButton     *toggle)
 {
        g_object_notify (G_OBJECT (self), "remember");
 }
 
 static void
-ubuntu_login_dialog_init (UbuntuLoginDialog *self)
+gs_ubuntu_login_dialog_init (GsUbuntuLoginDialog *self)
 {
        gtk_widget_init_template (GTK_WIDGET (self));
 
@@ -555,13 +555,11 @@ ubuntu_login_dialog_init (UbuntuLoginDialog *self)
        g_signal_connect_swapped (self->password_entry, "notify::text", G_CALLBACK (entry_edited_cb), self);
        g_signal_connect_swapped (self->passcode_entry, "notify::text", G_CALLBACK (entry_edited_cb), self);
 
-       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self))), 
self->content_box);
-
        update_widgets (self);
 }
 
 GtkWidget *
-ubuntu_login_dialog_new (void)
+gs_ubuntu_login_dialog_new (void)
 {
-       return g_object_new (UBUNTU_TYPE_LOGIN_DIALOG, NULL);
+       return GTK_WIDGET (g_object_new (GS_TYPE_UBUNTU_LOGIN_DIALOG, NULL));
 }
diff --git a/src/plugins/gs-ubuntu-login-dialog.h b/src/plugins/gs-ubuntu-login-dialog.h
new file mode 100644
index 0000000..c2f00a2
--- /dev/null
+++ b/src/plugins/gs-ubuntu-login-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_UBUNTU_LOGIN_DIALOG_H
+#define GS_UBUNTU_LOGIN_DIALOG_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GS_TYPE_UBUNTU_LOGIN_DIALOG gs_ubuntu_login_dialog_get_type ()
+
+G_DECLARE_FINAL_TYPE (GsUbuntuLoginDialog, gs_ubuntu_login_dialog, GS, UBUNTU_LOGIN_DIALOG, GtkDialog)
+
+GtkWidget *gs_ubuntu_login_dialog_new (void);
+
+G_END_DECLS
+
+#endif /* GS_UBUNTU_LOGIN_DIALOG_H */
+
+/* vim: set noexpandtab: */
diff --git a/src/plugins/ubuntu-login-dialog.ui b/src/plugins/gs-ubuntu-login-dialog.ui
similarity index 99%
rename from src/plugins/ubuntu-login-dialog.ui
rename to src/plugins/gs-ubuntu-login-dialog.ui
index 6c70369..c64c0d1 100644
--- a/src/plugins/ubuntu-login-dialog.ui
+++ b/src/plugins/gs-ubuntu-login-dialog.ui
@@ -2,7 +2,8 @@
 <!-- Generated with glade 3.19.0 -->
 <interface>
   <requires lib="gtk+" version="3.16"/>
-  <template class="UbuntuLoginDialog" parent="GtkDialog">
+  <template class="GsUbuntuLoginDialog" parent="GtkDialog">
+    <child internal-child="vbox">
     <object class="GtkBox" id="content_box">
       <property name="visible">True</property>
       <property name="can_focus">False</property>
@@ -383,5 +384,6 @@
         </packing>
       </child>
     </object>
+    </child>
   </template>
 </interface>


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