#1 Fix build without intltool and port to gtk3
Merged 2 years ago by jvanek. Opened 2 years ago by akurtakov.
akurtakov/system-switch-java master  into  master

file modified
+1 -1
@@ -13,7 +13,7 @@ 

  dist_python_DATA = $(PACKAGE).glade

  

  $(PACKAGE).desktop: $(PACKAGE).desktop.in

- 	@INTLTOOL_MERGE@ --desktop-style $(srcdir)/po $< $@

+ 	$(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@

  

  EXTRA_DIST = switch_java_globals.py.in $(PACKAGE).desktop.in COPYING.icon

  

file modified
-1
@@ -3,6 +3,5 @@ 

  set -x -e

  

  glib-gettextize --force

- intltoolize -f

  autoreconf --force --install

  

file modified
+2 -2
@@ -3,10 +3,10 @@ 

  

  AM_INIT_AUTOMAKE([no-dist-gzip dist-xz -Wall])

  

+ AM_GNU_GETTEXT_VERSION([0.19.7])

+ AM_GNU_GETTEXT([external])

  GETTEXT_PACKAGE=system-switch-java

  AC_SUBST([GETTEXT_PACKAGE])

- AM_GLIB_GNU_GETTEXT

- IT_PROG_INTLTOOL

  

  AM_PATH_PYTHON

  

file added
+78
@@ -0,0 +1,78 @@ 

+ # Makefile variables for PO directory in any package using GNU gettext.

+ 

+ # Usually the message domain is the same as the package name.

+ DOMAIN = $(PACKAGE)

+ 

+ # These two variables depend on the location of this directory.

+ subdir = po

+ top_builddir = ..

+ 

+ # These options get passed to xgettext.

+ XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3

+ 

+ # This is the copyright holder that gets inserted into the header of the

+ # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding

+ # package.  (Note that the msgstr strings, extracted from the package's

+ # sources, belong to the copyright holder of the package.)  Translators are

+ # expected to transfer the copyright for their translations to this person

+ # or entity, or to disclaim their copyright.  The empty string stands for

+ # the public domain; in this case the translators are expected to disclaim

+ # their copyright.

+ COPYRIGHT_HOLDER = Free Software Foundation, Inc.

+ 

+ # This tells whether or not to prepend "GNU " prefix to the package

+ # name that gets inserted into the header of the $(DOMAIN).pot file.

+ # Possible values are "yes", "no", or empty.  If it is empty, try to

+ # detect it automatically by scanning the files in $(top_srcdir) for

+ # "GNU packagename" string.

+ PACKAGE_GNU =

+ 

+ # This is the email address or URL to which the translators shall report

+ # bugs in the untranslated strings:

+ # - Strings which are not entire sentences, see the maintainer guidelines

+ #   in the GNU gettext documentation, section 'Preparing Strings'.

+ # - Strings which use unclear terms or require additional context to be

+ #   understood.

+ # - Strings which make invalid assumptions about notation of date, time or

+ #   money.

+ # - Pluralisation problems.

+ # - Incorrect English spelling.

+ # - Incorrect formatting.

+ # It can be your email address, or a mailing list address where translators

+ # can write to without being subscribed, or the URL of a web page through

+ # which the translators can contact you.

+ MSGID_BUGS_ADDRESS =

+ 

+ # This is the list of locale categories, beyond LC_MESSAGES, for which the

+ # message catalogs shall be used.  It is usually empty.

+ EXTRA_LOCALE_CATEGORIES =

+ 

+ # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'

+ # context.  Possible values are "yes" and "no".  Set this to yes if the

+ # package uses functions taking also a message context, like pgettext(), or

+ # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.

+ USE_MSGCTXT = no

+ 

+ # These options get passed to msgmerge.

+ # Useful options are in particular:

+ #   --previous            to keep previous msgids of translated messages,

+ #   --quiet               to reduce the verbosity.

+ MSGMERGE_OPTIONS =

+ 

+ # These options get passed to msginit.

+ # If you want to disable line wrapping when writing PO files, add

+ # --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and

+ # MSGINIT_OPTIONS.

+ MSGINIT_OPTIONS =

+ 

+ # This tells whether or not to regenerate a PO file when $(DOMAIN).pot

+ # has changed.  Possible values are "yes" and "no".  Set this to no if

+ # the POT file is checked in the repository and the version control

+ # program ignores timestamps.

+ PO_DEPENDS_ON_POT = no

+ 

+ # This tells whether or not to forcibly update $(DOMAIN).pot and

+ # regenerate PO files on "make dist".  Possible values are "yes" and

+ # "no".  Set this to no if the POT file and PO files are maintained

+ # externally.

+ DIST_DEPENDS_ON_UPDATE_PO = yes

file modified
+29 -23
@@ -16,8 +16,9 @@ 

  # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

  # 02110-1301 USA.

  

- import gtk

- import gtk.glade

+ import gi

+ gi.require_version("Gtk", "3.0")

+ from gi.repository import Gtk

  from switch_java_functions import *

  from switch_java_globals import DATA_ROOT_DIR, PACKAGE_NAME

  
@@ -27,27 +28,27 @@ 

  

      def main(self, java_identifiers, default_java, pretty_names):

          # Initialize UI.

-         xml = gtk.glade.XML(DATA_ROOT_DIR + '/' + PACKAGE_NAME + '/' +

-                             PACKAGE_NAME + '.glade',

-                             None, domain=PACKAGE_NAME)

-         self.dialog = xml.get_widget('dialog')

+         builder = Gtk.Builder()

+         builder.add_from_file(DATA_ROOT_DIR + '/' + PACKAGE_NAME + '/' +

+                             PACKAGE_NAME + '.glade')

+         self.dialog = builder.get_object('dialog')

          self.dialog.set_title(TITLE_MESSAGE)

-         radio_vbox = xml.get_widget('radio-vbox')

-         xml.get_widget('instruction-label').set_text(INSTRUCTION_MESSAGE)

-         xml.get_widget('selection-label').set_markup('<b>'

+         radio_vbox = builder.get_object('radio-vbox')

+         builder.get_object('instruction-label').set_text(INSTRUCTION_MESSAGE)

+         builder.get_object('selection-label').set_markup('<b>'

                                                       + SELECTION_MESSAGE

                                                       + '</b>')

-         ok_button = xml.get_widget('ok-button')

+         ok_button = builder.get_object('ok-button')

          # Initialize alternatives list.

          self.radio_buttons = {}

          self.alternatives = {}

          for java in java_identifiers:

              if len(self.radio_buttons) == 0:

-                 self.radio_buttons[java] = gtk.RadioButton(None,

+                 self.radio_buttons[java] = Gtk.RadioButton.new_with_label_from_widget(None,

                                                             pretty_names[java])

                  group_button = self.radio_buttons[java]

              else:

-                 self.radio_buttons[java] = gtk.RadioButton(group_button,

+                 self.radio_buttons[java] = Gtk.RadioButton.new_with_label_from_widget(group_button,

                                                             pretty_names[java])

              radio_vbox.pack_start(self.radio_buttons[java], False, False, 0)

              self.radio_buttons[java].set_use_underline(False);
@@ -61,17 +62,17 @@ 

          self.radio_buttons[default_java].grab_focus()

          ok_button.connect('clicked', self.ok_button_clicked)

          ok_button.set_sensitive(False)

-         xml.get_widget('cancel-button').connect('clicked',

+         builder.get_object('cancel-button').connect('clicked',

                                                  self.cancel_button_clicked)

          self.dialog.connect('delete-event', self.dialog_delete_event)

-         self.dialog.connect('hide', gtk.main_quit)

+         self.dialog.connect('hide', Gtk.main_quit)

          self.dialog.set_icon_from_file(DATA_ROOT_DIR + '/pixmaps/'

                                         + PACKAGE_NAME + '.png')

          self.dialog.show()

-         gtk.main()

+         Gtk.main()

  

      def dialog_delete_event(self, *args):

-         gtk.main_quit()

+         Gtk.main_quit()

  

      def ok_button_clicked(self, button):

          for radio_button in self.radio_buttons.values():
@@ -79,20 +80,25 @@ 

                  switch_java(self.alternatives[radio_button])

                  break

          self.dialog.hide()

-         gtk.main_quit()

+         Gtk.main_quit()

  

      def cancel_button_clicked(self, button):

          self.dialog.hide()

-         gtk.main_quit()

+         Gtk.main_quit()

  

      def show_dialog(self, message):

-         dialog = gtk.MessageDialog(None,

-                                    gtk.DIALOG_MODAL

-                                    | gtk.DIALOG_DESTROY_WITH_PARENT,

-                                    gtk.MESSAGE_INFO,

-                                    gtk.BUTTONS_OK,

+         dialog = Gtk.MessageDialog(None,

+                                    Gtk.DialogFlags.MODAL

+                                    | Gtk.DialogFlags.DESTROY_WITH_PARENT,

+                                    Gtk.MessageType.INFO,

+                                    Gtk.ButtonsType.OK,

                                     message)

          dialog.set_title(TITLE_MESSAGE)

          dialog.set_icon_from_file(DATA_ROOT_DIR + '/pixmaps/' + PACKAGE_NAME + '.png')

          dialog.run()

          dialog.destroy()

+         

+ 

+ if __name__ == '__main__':

+     mainDialog.show_dialog("test")

+      

\ No newline at end of file

@@ -2,8 +2,8 @@ 

  Encoding=UTF-8

  X-Desktop-File-Install-Version=0.2

  Categories=System;Settings;

- _Name=Java Toolset

- _Comment=Change the default Java toolset

+ Name=Java Toolset

+ Comment=Change the default Java toolset

  Exec=/usr/bin/system-switch-java

  Terminal=false

  Type=Application

file modified
+149 -178
@@ -1,184 +1,155 @@ 

- <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->

- <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

- 

- <glade-interface>

-   <widget class="GtkDialog" id="dialog">

+ <?xml version="1.0" encoding="UTF-8"?>

+ <!-- Generated with glade 3.22.1 -->

+ <!--*- mode: xml -*-->

+ <interface>

+   <requires lib="gtk+" version="3.0"/>

+   <object class="GtkDialog" id="dialog">

+     <property name="can_focus">False</property>

      <property name="border_width">5</property>

-     <property name="type">GTK_WINDOW_TOPLEVEL</property>

-     <property name="window_position">GTK_WIN_POS_NONE</property>

-     <property name="modal">False</property>

      <property name="resizable">False</property>

-     <property name="destroy_with_parent">False</property>

-     <property name="decorated">True</property>

-     <property name="skip_taskbar_hint">False</property>

-     <property name="skip_pager_hint">False</property>

-     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>

-     <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>

-     <property name="focus_on_map">True</property>

-     <property name="urgency_hint">False</property>

-     <property name="has_separator">False</property>

- 

+     <property name="type_hint">dialog</property>

+     <child>

+       <placeholder/>

+     </child>

      <child internal-child="vbox">

-       <widget class="GtkVBox" id="dialog-vbox1">

- 	<property name="visible">True</property>

- 	<property name="homogeneous">False</property>

- 	<property name="spacing">2</property>

- 

- 	<child internal-child="action_area">

- 	  <widget class="GtkHButtonBox" id="dialog-action_area1">

- 	    <property name="visible">True</property>

- 	    <property name="layout_style">GTK_BUTTONBOX_END</property>

- 

- 	    <child>

- 	      <widget class="GtkButton" id="ok-button">

- 		<property name="visible">True</property>

- 		<property name="can_default">True</property>

- 		<property name="has_default">True</property>

- 		<property name="can_focus">True</property>

- 		<property name="label">gtk-ok</property>

-         <property name="use_stock">True</property>

-         <property name="relief">GTK_RELIEF_NORMAL</property>

-         <property name="focus_on_click">True</property>

-          </widget>

+       <object class="GtkBox" id="dialog-vbox1">

+         <property name="visible">True</property>

+         <property name="can_focus">False</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>

+             <child>

+               <object class="GtkButton" id="ok-button">

+                 <property name="label">gtk-ok</property>

+                 <property name="visible">True</property>

+                 <property name="can_focus">True</property>

+                 <property name="can_default">True</property>

+                 <property name="has_default">True</property>

+                 <property name="receives_default">False</property>

+                 <property name="use_stock">True</property>

+               </object>

+               <packing>

+                 <property name="expand">True</property>

+                 <property name="fill">True</property>

+                 <property name="position">0</property>

+               </packing>

+             </child>

+             <child>

+               <object class="GtkButton" id="cancel-button">

+                 <property name="label">gtk-cancel</property>

+                 <property name="visible">True</property>

+                 <property name="can_focus">True</property>

+                 <property name="can_default">True</property>

+                 <property name="has_default">True</property>

+                 <property name="receives_default">False</property>

+                 <property name="use_stock">True</property>

+               </object>

+               <packing>

+                 <property name="expand">True</property>

+                 <property name="fill">True</property>

+                 <property name="position">1</property>

+               </packing>

+             </child>

+           </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>

-          <widget class="GtkButton" id="cancel-button">

-         <property name="visible">True</property>

-         <property name="can_default">True</property>

-         <property name="has_default">True</property>

-         <property name="can_focus">True</property>

-         <property name="label">gtk-cancel</property>

- 		<property name="use_stock">True</property>

- 		<property name="relief">GTK_RELIEF_NORMAL</property>

- 		<property name="focus_on_click">True</property>

- 	      </widget>

- 	    </child>

- 

- 	  </widget>

- 	  <packing>

- 	    <property name="padding">0</property>

- 	    <property name="expand">False</property>

- 	    <property name="fill">True</property>

- 	    <property name="pack_type">GTK_PACK_END</property>

- 	  </packing>

- 	</child>

- 

- 	<child>

- 	  <widget class="GtkVBox" id="vbox19">

- 	    <property name="border_width">5</property>

- 	    <property name="visible">True</property>

- 	    <property name="homogeneous">False</property>

- 	    <property name="spacing">6</property>

- 

- 	    <child>

- 	      <widget class="GtkHBox" id="hbox3">

- 		<property name="visible">True</property>

- 

- 		<child>

- 		  <widget class="GtkLabel" id="instruction-label">

- 		    <property name="visible">True</property>

- 		    <property name="use_underline">False</property>

- 		    <property name="use_markup">False</property>

- 		    <property name="justify">GTK_JUSTIFY_LEFT</property>

- 		    <property name="wrap">True</property>

- 		    <property name="selectable">False</property>

- 		    <property name="xalign">0</property>

- 		    <property name="yalign">0.5</property>

- 		    <property name="xpad">0</property>

- 		    <property name="ypad">6</property>

- 		    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>

- 		    <property name="width_chars">-1</property>

- 		    <property name="single_line_mode">False</property>

- 		    <property name="angle">0</property>

- 		  </widget>

- 		  <packing>

- 		    <property name="padding">0</property>

- 		    <property name="expand">False</property>

- 		    <property name="fill">False</property>

- 		  </packing>

- 		</child>

- 

- 	      </widget>

- 	      <packing>

- 		<property name="padding">0</property>

- 		<property name="expand">False</property>

- 		<property name="fill">True</property>

- 	      </packing>

- 	    </child>

- 

- 	    <child>

- 	      <widget class="GtkVBox" id="vbox20">

- 		<property name="visible">True</property>

- 		<property name="homogeneous">False</property>

- 		<property name="spacing">6</property>

- 

- 		<child>

- 		  <widget class="GtkLabel" id="selection-label">

- 		    <property name="visible">True</property>

- 		    <property name="use_underline">False</property>

- 		    <property name="use_markup">True</property>

- 		    <property name="justify">GTK_JUSTIFY_LEFT</property>

- 		    <property name="wrap">False</property>

- 		    <property name="selectable">False</property>

- 		    <property name="xalign">0</property>

- 		    <property name="yalign">0.5</property>

- 		    <property name="xpad">0</property>

- 		    <property name="ypad">0</property>

- 		    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>

- 		    <property name="width_chars">-1</property>

- 		    <property name="single_line_mode">False</property>

- 		    <property name="angle">0</property>

- 		  </widget>

- 		  <packing>

- 		    <property name="padding">0</property>

- 		    <property name="expand">False</property>

- 		    <property name="fill">False</property>

- 		  </packing>

- 		</child>

- 

- 		<child>

- 		  <widget class="GtkAlignment" id="alignment13">

- 		    <property name="visible">True</property>

- 		    <property name="xalign">0.5</property>

- 		    <property name="yalign">0.5</property>

- 		    <property name="xscale">1</property>

- 		    <property name="yscale">1</property>

- 		    <property name="top_padding">0</property>

- 		    <property name="bottom_padding">0</property>

- 		    <property name="left_padding">12</property>

- 		    <property name="right_padding">0</property>

- 

- 		    <child>

- 		      <widget class="GtkVBox" id="radio-vbox">

- 			<property name="visible">True</property>

- 			<property name="homogeneous">False</property>

- 			<property name="spacing">6</property>

- 

- 		      </widget>

- 		    </child>

- 

- 		  </widget>

- 		  <packing>

- 		    <property name="padding">0</property>

- 		    <property name="expand">True</property>

- 		    <property name="fill">True</property>

- 		  </packing>

- 		</child>

- 

- 	      </widget>

- 	      <packing>

- 		<property name="padding">0</property>

- 		<property name="expand">True</property>

- 		<property name="fill">True</property>

- 	      </packing>

- 	    </child>

- 

-       </widget>

-     </child>

- 

-       </widget>

+           <object class="GtkBox" id="vbox19">

+             <property name="visible">True</property>

+             <property name="can_focus">False</property>

+             <property name="border_width">5</property>

+             <property name="orientation">vertical</property>

+             <property name="spacing">6</property>

+             <child>

+               <object class="GtkBox" id="hbox3">

+                 <property name="visible">True</property>

+                 <property name="can_focus">False</property>

+                 <child>

+                   <object class="GtkLabel" id="instruction-label">

+                     <property name="visible">True</property>

+                     <property name="can_focus">False</property>

+                     <property name="margin_top">6</property>

+                     <property name="margin_bottom">6</property>

+                     <property name="wrap">True</property>

+                     <property name="xalign">0</property>

+                     <property name="yalign">0.5</property>

+                   </object>

+                   <packing>

+                     <property name="expand">False</property>

+                     <property name="fill">False</property>

+                     <property name="position">0</property>

+                   </packing>

+                 </child>

+               </object>

+               <packing>

+                 <property name="expand">False</property>

+                 <property name="fill">True</property>

+                 <property name="position">0</property>

+               </packing>

+             </child>

+             <child>

+               <object class="GtkBox" id="vbox20">

+                 <property name="visible">True</property>

+                 <property name="can_focus">False</property>

+                 <property name="orientation">vertical</property>

+                 <property name="spacing">6</property>

+                 <child>

+                   <object class="GtkLabel" id="selection-label">

+                     <property name="visible">True</property>

+                     <property name="can_focus">False</property>

+                     <property name="use_markup">True</property>

+                     <property name="xalign">0</property>

+                     <property name="yalign">0.5</property>

+                   </object>

+                   <packing>

+                     <property name="expand">False</property>

+                     <property name="fill">False</property>

+                     <property name="position">0</property>

+                   </packing>

+                 </child>

+                 <child>

+                   <object class="GtkAlignment" id="alignment13">

+                     <property name="visible">True</property>

+                     <property name="can_focus">False</property>

+                     <property name="left_padding">12</property>

+                     <child>

+                       <object class="GtkBox" id="radio-vbox">

+                         <property name="visible">True</property>

+                         <property name="can_focus">False</property>

+                         <property name="orientation">vertical</property>

+                         <property name="spacing">6</property>

+                       </object>

+                     </child>

+                   </object>

+                   <packing>

+                     <property name="expand">True</property>

+                     <property name="fill">True</property>

+                     <property name="position">1</property>

+                   </packing>

+                 </child>

+               </object>

+               <packing>

+                 <property name="expand">True</property>

+                 <property name="fill">True</property>

+                 <property name="position">1</property>

+               </packing>

+             </child>

+           </object>

+           <packing>

+             <property name="expand">False</property>

+             <property name="fill">True</property>

+             <property name="position">1</property>

+           </packing>

+         </child>

+       </object>

      </child>

- 

-   </widget>

- </glade-interface>

+   </object>

+ </interface>

Intltool is gone in fedora 30 and gtk2 doesn't work under wayland.

1 new commit added

  • Port to Gtk3.
2 years ago

2 new commits added

  • Port to Gtk3.
  • Fix build without intltool.
2 years ago

Thank you very much for grat work. How is this applicable down to f29+f30?
Also thnak you for being customemr of s-s-j. I try it aproc once per year to see if it still works, but it is moreover designed quite bullet proof.

Pull-Request has been merged by jvanek

2 years ago