[GNOME-ABRT PATCH 1/2] Add ABRT configure application menu

Jakub Filak jfilak at redhat.com
Wed Aug 7 11:41:42 UTC 2013


Closes rhbz#993591

Signed-off-by: Jakub Filak <jfilak at redhat.com>
---
 configure.ac                        |  1 +
 src/gnome-abrt                      | 15 ++++++++++++++-
 src/gnome_abrt/views.py             |  8 ++++----
 src/gnome_abrt/wrappers/Makefile.am |  4 +++-
 src/gnome_abrt/wrappers/__init__.py |  3 ++-
 src/gnome_abrt/wrappers/common.h    |  1 +
 src/gnome_abrt/wrappers/configure.c | 15 +++++++++++++++
 src/gnome_abrt/wrappers/module.c    |  1 +
 8 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8f1a567..66bea5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,7 @@ AC_SUBST(GNOME_ABRT_VERSION)
 
 PKG_CHECK_MODULES([GTK], [gtk+-3.0])
 PKG_CHECK_MODULES([LIBREPORT_GTK], [libreport-gtk > 2.0.19-3])
+PKG_CHECK_MODULES([ABRT_GUI], [abrt_gui > 2.1.6])
 PKG_CHECK_MODULES([PYGOBJECT3], [pygobject-3.0])
 PKG_CHECK_MODULES([PYTHON], [python2])
 dnl PKG_CHECK_MODULES([PYXDG], [pyxdg >= 0.19])
diff --git a/src/gnome-abrt b/src/gnome-abrt
index 76fec32..994b883 100755
--- a/src/gnome-abrt
+++ b/src/gnome-abrt
@@ -60,7 +60,8 @@ from gnome_abrt.dbus_problems import (get_standard_problems_source,
                                       get_foreign_problems_source)
 from gnome_abrt.errors import UnavailableSource
 from gnome_abrt.l10n import _
-from gnome_abrt.wrappers import show_events_list_dialog
+from gnome_abrt.wrappers import (show_events_list_dialog,
+                                 show_system_config_abrt_dialog)
 from gnome_abrt.config import get_configuration
 from gnome_abrt.dialogs import show_report_problem_with_abrt
 from gnome_abrt.url.gliburltitle import (GetURLTitleSourcePool,
@@ -239,6 +240,7 @@ class OopsApplication(Gtk.Application):
 
         menu = Gio.Menu()
         menu.append(_("_Preferences"), "app.preferences")
+        menu.append(_("_ABRT Configuration"), "app.abrt-configuration")
         menu.append(_("_Report problem with ABRT"),
                     "app.report-problem-with-abrt")
         menu.append(_("_About"), "app.about")
@@ -248,6 +250,10 @@ class OopsApplication(Gtk.Application):
         action.connect("activate", self.on_action_prefrences)
         self.add_action(action)
 
+        action = Gio.SimpleAction.new("abrt-configuration", None)
+        action.connect("activate", self.on_action_abrt_configuration)
+        self.add_action(action)
+
         action = Gio.SimpleAction.new("report-problem-with-abrt", None)
         action.connect("activate", self.on_action_report_problem_with_abrt)
         self.add_action(action)
@@ -270,6 +276,13 @@ class OopsApplication(Gtk.Application):
         else:
             show_events_list_dialog()
 
+    def on_action_abrt_configuration(self, action, parameter):
+        windows = self.get_windows()
+        if windows:
+            show_system_config_abrt_dialog(windows[0])
+        else:
+            show_system_config_abrt_dialog()
+
     #pylint: disable=W0613
     def on_action_about(self, action, parameter):
         dialog = Gtk.AboutDialog()
diff --git a/src/gnome_abrt/views.py b/src/gnome_abrt/views.py
index edc5a92..ce68674 100644
--- a/src/gnome_abrt/views.py
+++ b/src/gnome_abrt/views.py
@@ -552,10 +552,10 @@ class OopsWindow(Gtk.ApplicationWindow):
                 lnk.set_valign(Gtk.Align.START)
                 lnk_lbl = lnk.get_child()
                 # using hasattr() because this constructions abuses a knowledge
-                # of current Gtk.LinkButton implementation details
-                # works fine with gtk-3.8.2
-                # in a future version of gtk, the child will not necessarily
-                # be an instance of Gtk.Label
+                # of current Gtk.LinkButton implementation details, but there is
+                # no other way how to make a text of Gtk.LinkButton wrapped
+                # works fine with gtk-3.8.2 but in a future version of gtk, the
+                # child will not necessarily be an instance of Gtk.Label
                 if hasattr(lnk_lbl, "set_line_wrap"):
                     lnk_lbl.set_line_wrap(True)
 
diff --git a/src/gnome_abrt/wrappers/Makefile.am b/src/gnome_abrt/wrappers/Makefile.am
index 638d9b1..96985ba 100644
--- a/src/gnome_abrt/wrappers/Makefile.am
+++ b/src/gnome_abrt/wrappers/Makefile.am
@@ -15,10 +15,12 @@ _wrappers_la_CPPFLAGS = \
     $(PYTHON_CFLAGS) \
     $(PYGOBJECT3_CFLAGS) \
     $(GTK_CFLAGS) \
-    $(LIBREPORT_GTK_CFLAGS)
+    $(LIBREPORT_GTK_CFLAGS) \
+    $(ABRT_GUI_CFLAGS)
 
 _wrappers_la_LDFLAGS = \
     $(LIBREPORT_GTK_LIBS) \
+    $(ABRT_GUI_LIBS) \
     $(GTK_LIBS) \
     $(PYGOBJECT3_LIBS) \
     -module \
diff --git a/src/gnome_abrt/wrappers/__init__.py b/src/gnome_abrt/wrappers/__init__.py
index f6a9a05..ef0989f 100644
--- a/src/gnome_abrt/wrappers/__init__.py
+++ b/src/gnome_abrt/wrappers/__init__.py
@@ -15,4 +15,5 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
 
-from gnome_abrt.wrappers._wrappers import show_events_list_dialog
+from gnome_abrt.wrappers._wrappers import (show_events_list_dialog,
+                                           show_system_config_abrt_dialog)
diff --git a/src/gnome_abrt/wrappers/common.h b/src/gnome_abrt/wrappers/common.h
index 5ed49fb..772ff15 100644
--- a/src/gnome_abrt/wrappers/common.h
+++ b/src/gnome_abrt/wrappers/common.h
@@ -20,3 +20,4 @@
 
 /* module-level functions */
 PyObject *p_show_events_list_dialog(PyObject *module, PyObject *args);
+PyObject *p_show_system_config_abrt_dialog(PyObject *module, PyObject *args);
diff --git a/src/gnome_abrt/wrappers/configure.c b/src/gnome_abrt/wrappers/configure.c
index e8b54a0..cb72b0c 100644
--- a/src/gnome_abrt/wrappers/configure.c
+++ b/src/gnome_abrt/wrappers/configure.c
@@ -18,6 +18,7 @@
 */
 #include <common.h>
 #include <libreport/internal_libreport_gtk.h>
+#include <abrt/system-config-abrt.h>
 #include <pygobject.h>
 
 PyObject *p_show_events_list_dialog(PyObject *module, PyObject *args)
@@ -33,3 +34,17 @@ PyObject *p_show_events_list_dialog(PyObject *module, PyObject *args)
 
     Py_RETURN_NONE;
 }
+
+PyObject *p_show_system_config_abrt_dialog(PyObject *module, PyObject *args)
+{
+    (void)module;
+
+    PyGObject *pygtkwnd = NULL;
+    if (PyArg_ParseTuple(args, "|O", &pygtkwnd))
+    {
+        GtkWindow *wnd = pygtkwnd ? GTK_WINDOW(pygtkwnd->obj) : NULL;
+        show_system_config_abrt_dialog(wnd);
+    }
+
+    Py_RETURN_NONE;
+}
diff --git a/src/gnome_abrt/wrappers/module.c b/src/gnome_abrt/wrappers/module.c
index a10de5c..2245e19 100644
--- a/src/gnome_abrt/wrappers/module.c
+++ b/src/gnome_abrt/wrappers/module.c
@@ -21,6 +21,7 @@
 static PyMethodDef module_methods[] = {
     /* method_name, func, flags, doc_string */
     { "show_events_list_dialog", p_show_events_list_dialog, METH_VARARGS, "Open a dialog with event configurations" },
+    { "show_system_config_abrt_dialog", p_show_system_config_abrt_dialog, METH_VARARGS, "Open a dialog with ABRT configuration" },
     { NULL }
 };
 
-- 
1.8.3.1



More information about the Crash-catcher mailing list