[Xfce4-commits] [apps/catfish] 01/01: Replace About dialog with code, enable headerbar, strip additional buttons added to the headerbar

noreply at xfce.org noreply at xfce.org
Sat Dec 28 13:18:51 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/catfish.

commit ba1f5a6e835e770905c22e7610c0d8d15f1b2879
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Dec 28 07:18:43 2019 -0500

    Replace About dialog with code, enable headerbar, strip additional buttons added to the headerbar
---
 catfish/AboutCatfishDialog.py    | 37 ----------------
 catfish/CatfishPrefsDialog.py    |  2 +-
 catfish/CatfishWindow.py         | 29 +++++++++++--
 catfish_lib/AboutDialog.py       | 54 -----------------------
 data/ui/AboutCatfishDialog.ui    | 71 ------------------------------
 data/ui/about_catfish_dialog.xml |  9 ----
 po/POTFILES.in                   |  3 --
 po/catfish.pot                   | 94 ++++++++++++++++++++--------------------
 8 files changed, 74 insertions(+), 225 deletions(-)

diff --git a/catfish/AboutCatfishDialog.py b/catfish/AboutCatfishDialog.py
deleted file mode 100644
index aeb76d3..0000000
--- a/catfish/AboutCatfishDialog.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#   Catfish - a versatile file searching tool
-#   Copyright (C) 2007-2012 Christian Dywan <christian at twotoasts.de>
-#   Copyright (C) 2012-2019 Sean Davis <bluesabre at xfce.org>
-#
-#   This program is free software: you can redistribute it and/or modify it
-#   under the terms of the GNU General Public License version 2, as published
-#   by the Free Software Foundation.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranties of
-#   MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <https://www.gnu.org/licenses/>.
-
-import logging
-
-from locale import gettext as _
-
-from catfish_lib.AboutDialog import AboutDialog
-
-logger = logging.getLogger('catfish')
-
-
-# See catfish_lib.AboutDialog.py for more details about how this class works.
-class AboutCatfishDialog(AboutDialog):
-
-    """Creates the about dialog for catfish"""
-    __gtype_name__ = "AboutCatfishDialog"
-
-    def finish_initializing(self, builder):
-        """Set up the about dialog"""
-        super(AboutCatfishDialog, self).finish_initializing(builder)
-        self.set_translator_credits(_("translator-credits"))
diff --git a/catfish/CatfishPrefsDialog.py b/catfish/CatfishPrefsDialog.py
index 459f64e..dd2df13 100644
--- a/catfish/CatfishPrefsDialog.py
+++ b/catfish/CatfishPrefsDialog.py
@@ -27,7 +27,7 @@ from catfish_lib.PrefsDialog import PrefsDialog
 logger = logging.getLogger('catfish')
 
 
-# See catfish_lib.AboutDialog.py for more details about how this class works.
+# See catfish_lib.PrefsDialog.py for more details about how this class works.
 class CatfishPrefsDialog(PrefsDialog):
 
     """Creates the about dialog for catfish"""
diff --git a/catfish/CatfishWindow.py b/catfish/CatfishWindow.py
index 8e6459e..4b37a76 100644
--- a/catfish/CatfishWindow.py
+++ b/catfish/CatfishWindow.py
@@ -40,10 +40,9 @@ gi.require_version('GdkPixbuf', '2.0')  # noqa
 gi.require_version('Gtk', '3.0')  # noqa
 from gi.repository import GLib, GObject, Pango, Gdk, GdkPixbuf, Gtk
 
-from catfish.AboutCatfishDialog import AboutCatfishDialog
 from catfish.CatfishPrefsDialog import CatfishPrefsDialog
 from catfish.CatfishSearchEngine import CatfishSearchEngine
-from catfish_lib import catfishconfig, helpers
+from catfish_lib import catfishconfig, helpers, get_version
 from catfish_lib import CatfishSettings, SudoDialog, Window
 from catfish_lib import Thumbnailer
 
@@ -124,12 +123,36 @@ class CatfishWindow(Window):
     mimetypes = dict()
     search_in_progress = False
 
+    def get_about_dialog(self):
+        dlg = GObject.new(Gtk.AboutDialog, use_header_bar=True)
+        dlg.set_program_name(_("Catfish File Search"))
+        dlg.set_version(get_version())
+        dlg.set_logo_icon_name("catfish")
+        dlg.set_website("https://docs.xfce.org/apps/catfish/start")
+        dlg.set_comments(_("Catfish is a versatile file searching tool."))
+        dlg.set_license_type(Gtk.License.GPL_2_0)
+        dlg.set_copyright("Copyright (C) 2007-2012 Christian Dywan <christian at twotoasts.de>\n"
+                          "Copyright (C) 2012-2019 Sean Davis <bluesabre at xfce.org>")
+        dlg.set_authors(["Christian Dywan <christian at twotoasts.de>",
+                         "Sean Davis <bluesabre at xfce.org>"])
+        dlg.set_artists(["Nancy Runge <nancy at twotoasts.de>"])
+        dlg.set_translator_credits(_("translator-credits"))
+        dlg.set_transient_for(self)
+
+        # Cleanup duplicate buttons
+        hbar = dlg.get_header_bar()
+        for child in hbar.get_children():
+            if type(child) in [Gtk.Button, Gtk.ToggleButton]:
+                child.destroy()
+
+        return dlg
+
     def finish_initializing(self, builder):
         """Set up the main window"""
         super(CatfishWindow, self).finish_initializing(builder)
         self.set_wmclass("catfish", "Catfish")
 
-        self.AboutDialog = AboutCatfishDialog
+        self.AboutDialog = self.get_about_dialog
 
         self.settings = CatfishSettings.CatfishSettings()
 
diff --git a/catfish_lib/AboutDialog.py b/catfish_lib/AboutDialog.py
deleted file mode 100644
index fc2b6d4..0000000
--- a/catfish_lib/AboutDialog.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#   Catfish - a versatile file searching tool
-#   Copyright (C) 2007-2012 Christian Dywan <christian at twotoasts.de>
-#   Copyright (C) 2012-2019 Sean Davis <bluesabre at xfce.org>
-#
-#   This program is free software: you can redistribute it and/or modify it
-#   under the terms of the GNU General Public License version 2, as published
-#   by the Free Software Foundation.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranties of
-#   MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <https://www.gnu.org/licenses/>.
-
-from gi.repository import Gtk  # pylint: disable=E0611
-
-from . helpers import get_builder
-from . catfishconfig import get_version
-
-
-class AboutDialog(Gtk.AboutDialog):
-
-    """Catfish AboutDialog"""
-    __gtype_name__ = "AboutDialog"
-
-    def __new__(cls):
-        """Special static method that's automatically called by Python when
-        constructing a new instance of this class.
-
-        Returns a fully instantiated AboutDialog object.
-        """
-        builder = get_builder('AboutCatfishDialog')
-        new_object = builder.get_object("about_catfish_dialog")
-        new_object.finish_initializing(builder)
-        return new_object
-
-    def finish_initializing(self, builder):
-        """Called while initializing this instance in __new__
-
-        finish_initalizing should be called after parsing the ui definition
-        and creating a AboutDialog object with it in order
-        to finish initializing the start of the new AboutCatfishDialog
-        instance.
-
-        Put your initialization code in here and leave __init__ undefined.
-        """
-        # Get a reference to the builder and set up the signals.
-        self.builder = builder
-        self.ui = builder.get_ui(self)
-        self.set_version(get_version())
diff --git a/data/ui/AboutCatfishDialog.ui b/data/ui/AboutCatfishDialog.ui
deleted file mode 100644
index be15cbe..0000000
--- a/data/ui/AboutCatfishDialog.ui
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
-<interface>
-  <requires lib="gtk+" version="3.16"/>
-  <requires lib="about_catfish_dialog" version="1.0"/>
-  <object class="AboutCatfishDialog" id="about_catfish_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="icon_name">catfish</property>
-    <property name="type_hint">normal</property>
-    <property name="program_name">Catfish</property>
-    <property name="version">1.4.11</property>
-    <property name="copyright">Copyright (C) 2007-2012 Christian Dywan <christian at twotoasts.de>
-Copyright (C) 2012-2019 Sean Davis <bluesabre at xfce.org></property>
-    <property name="comments" translatable="yes">Catfish is a versatile file searching tool.</property>
-    <property name="website">https://docs.xfce.org/apps/catfish/start</property>
-    <property name="license">Copyright (C) 2007-2012 Christian Dywan <christian at twotoasts.de>
-Copyright (C) 2012-2019 Sean Davis <bluesabre at xfce.org>
-
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2, as published
-by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranties of
-MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <https://www.gnu.org/licenses/>.
-</property>
-    <property name="authors">Copyright (C) 2007-2012 Christian Dywan <christian at twotoasts.de>
-Copyright (C) 2012-2019 Sean Davis <bluesabre at xfce.org></property>
-    <property name="artists">Nancy Runge <nancy at twotoasts.de></property>
-    <property name="logo_icon_name">catfish</property>
-    <property name="license_type">gpl-2-0</property>
-    <child type="titlebar">
-      <object class="GtkHeaderBar" id="hbar">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="show_close_button">True</property>
-        <property name="decoration_layout">:close</property>
-      </object>
-    </child>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>
diff --git a/data/ui/about_catfish_dialog.xml b/data/ui/about_catfish_dialog.xml
deleted file mode 100644
index 3654a65..0000000
--- a/data/ui/about_catfish_dialog.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<glade-catalog name="about_catfish_dialog" domain="glade-3"
-               depends="gtk+" version="1.0">
-  <glade-widget-classes>
-    <glade-widget-class title="About Catfish Dialog" name="AboutCatfishDialog"
-                        generic-name="AboutCatfishDialog" parent="GtkAboutDialog"
-                        icon-name="widget-gtk-about-dialog"/>
-  </glade-widget-classes>
-
-</glade-catalog>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index efea239..c88157d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -18,18 +18,15 @@
 org.xfce.Catfish.desktop.in
 
 # Glade Files
-[type: gettext/glade]data/ui/AboutCatfishDialog.ui
 [type: gettext/glade]data/ui/CatfishPreferences.ui
 [type: gettext/glade]data/ui/CatfishWindow.ui
 
 # Python Files
 catfish/__init__.py
-catfish/AboutCatfishDialog.py
 catfish/CatfishPrefsDialog.py
 catfish/CatfishSearchEngine.py
 catfish/CatfishWindow.py
 catfish_lib/__init__.py
-catfish_lib/AboutDialog.py
 catfish_lib/Builder.py
 catfish_lib/catfishconfig.py
 catfish_lib/CatfishSettings.py
diff --git a/po/catfish.pot b/po/catfish.pot
index 49fa8b7..9e1aa58 100644
--- a/po/catfish.pot
+++ b/po/catfish.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-12-27 06:51-0500\n"
+"POT-Creation-Date: 2019-12-28 07:17-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -18,7 +18,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 
 #: ../org.xfce.Catfish.desktop.in.h:1 ../data/ui/CatfishWindow.ui.h:28
-#: ../catfish/CatfishWindow.py:731
+#: ../catfish/CatfishWindow.py:128 ../catfish/CatfishWindow.py:754
 msgid "Catfish File Search"
 msgstr ""
 
@@ -35,10 +35,6 @@ msgstr ""
 msgid "files;find;locate;lookup;search;"
 msgstr ""
 
-#: ../data/ui/AboutCatfishDialog.ui.h:1
-msgid "Catfish is a versatile file searching tool."
-msgstr ""
-
 #: ../data/ui/CatfishPreferences.ui.h:1
 msgid "Catfish Preferences"
 msgstr ""
@@ -213,11 +209,11 @@ msgstr ""
 msgid "File Type"
 msgstr ""
 
-#: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1290
+#: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1313
 msgid "Modified"
 msgstr ""
 
-#: ../data/ui/CatfishWindow.ui.h:29 ../catfish/CatfishWindow.py:1740
+#: ../data/ui/CatfishWindow.ui.h:29 ../catfish/CatfishWindow.py:1763
 msgid "Results will be displayed as soon as they are found."
 msgstr ""
 
@@ -227,7 +223,7 @@ msgstr ""
 
 #. Restore Cancel button
 #. Buttons
-#: ../data/ui/CatfishWindow.ui.h:31 ../catfish/CatfishWindow.py:684
+#: ../data/ui/CatfishWindow.ui.h:31 ../catfish/CatfishWindow.py:707
 #: ../catfish_lib/SudoDialog.py:196
 msgid "Cancel"
 msgstr ""
@@ -341,166 +337,170 @@ msgid ""
 "displayed."
 msgstr ""
 
-#: ../catfish/AboutCatfishDialog.py:37
-msgid "translator-credits"
-msgstr ""
-
 #. Translators: this text is displayed next to
 #. a filename that is not utf-8 encoded.
-#: ../catfish/CatfishWindow.py:100
+#: ../catfish/CatfishWindow.py:99
 #, python-format
 msgid "%s (invalid encoding)"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:256
+#: ../catfish/CatfishWindow.py:132
+msgid "Catfish is a versatile file searching tool."
+msgstr ""
+
+#: ../catfish/CatfishWindow.py:139
+msgid "translator-credits"
+msgstr ""
+
+#: ../catfish/CatfishWindow.py:279
 msgid "Unknown"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:260
+#: ../catfish/CatfishWindow.py:283
 msgid "Never"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:339
+#: ../catfish/CatfishWindow.py:362
 #, python-format
 msgid ""
 "Enter your query above to find your files\n"
 "or click the %s icon for more options."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:699
+#: ../catfish/CatfishWindow.py:722
 msgid "An error occurred while updating the database."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:701
+#: ../catfish/CatfishWindow.py:724
 msgid "Authentication failed."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:707
+#: ../catfish/CatfishWindow.py:730
 msgid "Authentication cancelled."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:713
+#: ../catfish/CatfishWindow.py:736
 msgid "Search database updated successfully."
 msgstr ""
 
 #. Set the dialog status to running.
-#: ../catfish/CatfishWindow.py:788
+#: ../catfish/CatfishWindow.py:811
 msgid "Updating..."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:822
+#: ../catfish/CatfishWindow.py:845
 msgid "Stop Search"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:823
+#: ../catfish/CatfishWindow.py:846
 msgid ""
 "Search is in progress...\n"
 "Press the cancel button or the Escape key to stop."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:832
+#: ../catfish/CatfishWindow.py:855
 msgid "Begin Search"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1110
+#: ../catfish/CatfishWindow.py:1133
 #, python-format
 msgid "\"%s\" could not be opened."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1162
+#: ../catfish/CatfishWindow.py:1185
 #, python-format
 msgid "\"%s\" could not be saved."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1179
+#: ../catfish/CatfishWindow.py:1202
 #, python-format
 msgid "\"%s\" could not be deleted."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1219
+#: ../catfish/CatfishWindow.py:1242
 #, python-format
 msgid "Save \"%s\" as..."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1254
+#: ../catfish/CatfishWindow.py:1277
 #, python-format
 msgid ""
 "Are you sure that you want to \n"
 "permanently delete \"%s\"?"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1258
+#: ../catfish/CatfishWindow.py:1281
 #, python-format
 msgid ""
 "Are you sure that you want to \n"
 "permanently delete the %i selected files?"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1261
+#: ../catfish/CatfishWindow.py:1284
 msgid "If you delete a file, it is permanently lost."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1284
+#: ../catfish/CatfishWindow.py:1307
 msgid "Filename"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1286
+#: ../catfish/CatfishWindow.py:1309
 msgid "Size"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1288
+#: ../catfish/CatfishWindow.py:1311
 msgid "Location"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1300
+#: ../catfish/CatfishWindow.py:1323
 msgid "Preview"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1308
+#: ../catfish/CatfishWindow.py:1331
 msgid "Details"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1527
+#: ../catfish/CatfishWindow.py:1550
 msgid "Today"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1529
+#: ../catfish/CatfishWindow.py:1552
 msgid "Yesterday"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1610
+#: ../catfish/CatfishWindow.py:1633
 msgid "No files found."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1612
+#: ../catfish/CatfishWindow.py:1635
 msgid ""
 "Try making your search less specific\n"
 "or try another directory."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1619
+#: ../catfish/CatfishWindow.py:1642
 msgid "1 file found."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1621
+#: ../catfish/CatfishWindow.py:1644
 #, python-format
 msgid "%i files found."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1627
+#: ../catfish/CatfishWindow.py:1650
 msgid "bytes"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1738 ../catfish/CatfishWindow.py:1748
+#: ../catfish/CatfishWindow.py:1761 ../catfish/CatfishWindow.py:1771
 msgid "Searching..."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1746
+#: ../catfish/CatfishWindow.py:1769
 #, python-format
 msgid "Searching for \"%s\""
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1835
+#: ../catfish/CatfishWindow.py:1858
 #, python-format
 msgid "Search results for \"%s\""
 msgstr ""

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list