# Path: meld/ui/bufferselectors.py
# class EncodingSelector(FilteredListSelector, Gtk.Grid):
#     # The subclassing here is weird; the Selector must directly
#     # subclass Gtk.Grid, or the template building explodes.
# 
#     __gtype_name__ = 'EncodingSelector'
# 
#     __gsignals__ = {
#         'encoding-selected': (
#             GObject.SignalFlags.RUN_FIRST | GObject.SignalFlags.ACTION,
#             None, (GtkSource.Encoding,)),
#     }
# 
#     # These exist solely to make subclassing easier.
#     value_accessor = 'get_charset'
#     change_signal_name = 'encoding-selected'
# 
#     entry = Gtk.Template.Child('entry')
#     treeview = Gtk.Template.Child('treeview')
# 
#     def populate_model(self):
#         for enc in GtkSource.Encoding.get_all():
#             self.liststore.append((self.get_value_label(enc), enc))
# 
#     def get_value_label(self, enc):
#         return _('{name} ({charset})').format(
#             name=enc.get_name(), charset=enc.get_charset())
# 
# class SourceLangSelector(FilteredListSelector, Gtk.Grid):
# 
#     __gtype_name__ = "SourceLangSelector"
# 
#     __gsignals__ = {
#         'language-selected': (
#             GObject.SignalFlags.RUN_FIRST | GObject.SignalFlags.ACTION,
#             None, (GtkSource.Language,)),
#     }
# 
#     # These exist solely to make subclassing easier.
#     value_accessor = 'get_id'
#     change_signal_name = 'language-selected'
# 
#     entry = Gtk.Template.Child('entry')
#     treeview = Gtk.Template.Child('treeview')
# 
#     def populate_model(self):
#         self.liststore.append((_("Plain Text"), None))
#         manager = GtkSource.LanguageManager.get_default()
#         for lang_id in manager.get_language_ids():
#             lang = manager.get_language(lang_id)
#             self.liststore.append((lang.get_name(), lang))
# 
#     def get_value_label(self, lang):
#         if not lang:
#             return _("Plain Text")
#         return lang.get_name()


from gi.repository import GObject, Gtk, GtkSource, Pango
from meld.conf import _
from meld.ui.bufferselectors import EncodingSelector, SourceLangSelector
# 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, see <http://www.gnu.org/licenses/>.




class MeldStatusMenuButton(Gtk.MenuButton):
    """Compact menu button with arrow indicator for use in a status bar

    Implementation based on gedit-status-menu-button.c
    Copyright (C) 2008 - Jesse van den Kieboom
    """

    __gtype_name__ = "MeldStatusMenuButton"

    style = b"""
    * {
      padding: 1px 8px 2px 4px;
      border: 0;
      outline-width: 0;

# Path: meld/ui/bufferselectors.py
# class EncodingSelector(FilteredListSelector, Gtk.Grid):
#     # The subclassing here is weird; the Selector must directly
#     # subclass Gtk.Grid, or the template building explodes.
# 
#     __gtype_name__ = 'EncodingSelector'
# 
#     __gsignals__ = {
#         'encoding-selected': (
#             GObject.SignalFlags.RUN_FIRST | GObject.SignalFlags.ACTION,
#             None, (GtkSource.Encoding,)),
#     }
# 
#     # These exist solely to make subclassing easier.
#     value_accessor = 'get_charset'
#     change_signal_name = 'encoding-selected'
# 
#     entry = Gtk.Template.Child('entry')
#     treeview = Gtk.Template.Child('treeview')
# 
#     def populate_model(self):
#         for enc in GtkSource.Encoding.get_all():
#             self.liststore.append((self.get_value_label(enc), enc))
# 
#     def get_value_label(self, enc):
#         return _('{name} ({charset})').format(
#             name=enc.get_name(), charset=enc.get_charset())
# 
# class SourceLangSelector(FilteredListSelector, Gtk.Grid):
# 
#     __gtype_name__ = "SourceLangSelector"
# 
#     __gsignals__ = {
#         'language-selected': (
#             GObject.SignalFlags.RUN_FIRST | GObject.SignalFlags.ACTION,
#             None, (GtkSource.Language,)),
#     }
# 
#     # These exist solely to make subclassing easier.
#     value_accessor = 'get_id'
#     change_signal_name = 'language-selected'
# 
#     entry = Gtk.Template.Child('entry')
#     treeview = Gtk.Template.Child('treeview')
# 
#     def populate_model(self):
#         self.liststore.append((_("Plain Text"), None))
#         manager = GtkSource.LanguageManager.get_default()
#         for lang_id in manager.get_language_ids():
#             lang = manager.get_language(lang_id)
#             self.liststore.append((lang.get_name(), lang))
# 
#     def get_value_label(self, lang):
#         if not lang:
#             return _("Plain Text")
#         return lang.get_name()


# Path: meld/ui/statusbar.py
from gi.repository import GObject, Gtk, GtkSource, Pango
from meld.conf import _
from meld.ui.bufferselectors import EncodingSelector, SourceLangSelector

# 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, see <http://www.gnu.org/licenses/>.




class MeldStatusMenuButton(Gtk.MenuButton):
    """Compact menu button with arrow indicator for use in a status bar

    Implementation based on gedit-status-menu-button.c
    Copyright (C) 2008 - Jesse van den Kieboom
    """

    __gtype_name__ = "MeldStatusMenuButton"

    style = b"""
    * {
      padding: 1px 8px 2px 4px;
      border: 0;
      outline-width: 0;

    }