[recipes] Add a "Report Issue" item in the app menu



commit cd68dd80cc18e348be386809ad901222bf9e1bf7
Author: msbhide <maithb2410 gmail com>
Date:   Fri Mar 3 19:45:54 2017 +0530

    Add a "Report Issue" item in the app menu
    
    Add an item in the about menu that launches a browser window
    pointing at bugzilla.gnome.org to report a bug against recipes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778803

 src/gr-app.c    |   14 +++++++++++++-
 src/gr-window.c |   15 +++++++++++++++
 src/gr-window.h |    1 +
 src/menus.ui    |    4 ++++
 4 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index db4e46b..366f526 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -107,6 +107,17 @@ about_activated (GSimpleAction *action,
 }
 
 static void
+report_issue_activated (GSimpleAction *action,
+                 GVariant      *parameter,
+                 gpointer       app)
+{
+        GtkWindow *win;
+
+        win = gtk_application_get_active_window (GTK_APPLICATION (app));
+        gr_window_show_report_issue (GR_WINDOW (win));
+}
+
+static void
 news_activated (GSimpleAction *action,
                 GVariant      *parameter,
                 gpointer       app)
@@ -180,7 +191,8 @@ static GActionEntry app_entries[] =
         { "import", import_activated, NULL, NULL, NULL },
         { "details", details_activated, "(ss)", NULL, NULL },
         { "search", search_activated, "s", NULL, NULL },
-        { "quit", quit_activated, NULL, NULL, NULL }
+        { "quit", quit_activated, NULL, NULL, NULL },
+        { "report-issue", report_issue_activated, NULL, NULL, NULL }
 };
 
 static void
diff --git a/src/gr-window.c b/src/gr-window.c
index 6ac87f9..7969a0c 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -24,6 +24,8 @@
 
 #include <libgd/gd.h>
 
+#include <gtk/gtk.h>
+
 #include "gr-window.h"
 #include "gr-details-page.h"
 #include "gr-chef-dialog.h"
@@ -1182,3 +1184,16 @@ gr_window_show_news (GrWindow *window)
         gtk_widget_show_all (box);
         gr_window_present_dialog (GR_WINDOW (window), dialog);
 }
+
+void
+gr_window_show_report_issue (GrWindow *window)
+{
+        const char *uri = "https://bugzilla.gnome.org/enter_bug.cgi?product=recipes";;
+        g_autoptr(GError) error = NULL;
+
+        gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), _("Report Issue"));
+
+        gtk_show_uri_on_window (GTK_WINDOW (window), uri, GDK_CURRENT_TIME, &error);
+        if (error)
+                g_warning ("Unable to show '%s': %s", uri, error->message);
+}
diff --git a/src/gr-window.h b/src/gr-window.h
index b9a4c6e..6e9e948 100644
--- a/src/gr-window.h
+++ b/src/gr-window.h
@@ -83,6 +83,7 @@ void            gr_window_offer_shopping             (GrWindow   *window);
 
 void            gr_window_show_my_chef_information   (GrWindow   *window);
 void            gr_window_show_about_dialog          (GrWindow   *window);
+void            gr_window_show_report_issue          (GrWindow   *window);
 void            gr_window_show_news                  (GrWindow   *window);
 
 G_END_DECLS
diff --git a/src/menus.ui b/src/menus.ui
index 8ed1e1d..3d76072 100644
--- a/src/menus.ui
+++ b/src/menus.ui
@@ -23,6 +23,10 @@
         <attribute name="action">app.about</attribute>
       </item>
       <item>
+        <attribute name="label" translatable="yes">_Report Issue</attribute>
+        <attribute name="action">app.report-issue</attribute>
+      </item>
+      <item>
         <attribute name="label" translatable="yes">_Quit</attribute>
         <attribute name="action">app.quit</attribute>
       </item>


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