]> git.meshlink.io Git - catta/commitdiff
Replace libglade with GtkBuilder
authorRobert Ancell <robert.ancell@gmail.com>
Thu, 30 Jul 2009 07:27:19 +0000 (17:27 +1000)
committerLennart Poettering <lennart@poettering.net>
Sat, 14 Nov 2009 01:35:46 +0000 (02:35 +0100)
avahi-discover-standalone/Makefile.am
avahi-discover-standalone/avahi-discover.glade [deleted file]
avahi-discover-standalone/avahi-discover.gladep [deleted file]
avahi-discover-standalone/avahi-discover.ui [new file with mode: 0644]
avahi-discover-standalone/main.c
avahi-python/avahi-discover/Makefile.am
avahi-python/avahi-discover/SimpleGladeApp.py [deleted file]
avahi-python/avahi-discover/avahi-discover.in
configure.ac
po/POTFILES.in
po/POTFILES.skip

index 542aeae6f87ffc95ea238c7b92be197d4d580789..133ff4d9c5ba7354714556c2f9ef49feca5f4667 100644 (file)
@@ -20,7 +20,7 @@
 AM_CFLAGS=-I$(top_srcdir)
 
 interfaces = \
-        avahi-discover.glade
+        avahi-discover.ui
 
 # This cool debug trap works on i386/gcc only
 AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
@@ -35,7 +35,7 @@ avahi_discover_standalone_SOURCES = \
 
 avahi_discover_standalone_CFLAGS = \
        $(AM_CFLAGS) \
-       $(GLIB20_CFLAGS) $(GTK20_CFLAGS) $(GLADE20_CFLAGS)\
+       $(GLIB20_CFLAGS) $(GTK20_CFLAGS) \
        -DAVAHI_INTERFACES_DIR=\"$(interfacesdir)\"
 
 avahi_discover_standalone_LDADD = \
@@ -43,7 +43,7 @@ avahi_discover_standalone_LDADD = \
        ../avahi-common/libavahi-common.la \
        ../avahi-glib/libavahi-glib.la \
        ../avahi-core/libavahi-core.la  \
-       $(GLIB20_LIBS) $(GTK20_LIBS) $(GLADE20_LIBS)
+       $(GLIB20_LIBS) $(GTK20_LIBS)
 
 interfaces_DATA = $(interfaces)
 
@@ -58,5 +58,4 @@ endif
 endif
 
 EXTRA_DIST = \
-       $(interfaces) \
-       avahi-discover.gladep
+       $(interfaces)
diff --git a/avahi-discover-standalone/avahi-discover.glade b/avahi-discover-standalone/avahi-discover.glade
deleted file mode 100644 (file)
index bb456c2..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkWindow" id="main_window">
-  <property name="visible">True</property>
-  <property name="title" translatable="yes">Avahi Discovery</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="default_width">500</property>
-  <property name="default_height">400</property>
-  <property name="resizable">True</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_NORMAL</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <signal handler="gtk_main_quit" name="destroy" after="False"/>
-
-  <child>
-    <widget class="GtkVBox" id="vbox1">
-      <property name="border_width">12</property>
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">12</property>
-
-      <child>
-       <widget class="GtkScrolledWindow" id="scrolledwindow1">
-         <property name="visible">True</property>
-         <property name="can_focus">True</property>
-         <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-         <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-         <property name="shadow_type">GTK_SHADOW_IN</property>
-         <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-         <child>
-           <widget class="GtkTreeView" id="tree_view">
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="headers_visible">True</property>
-             <property name="rules_hint">False</property>
-             <property name="reorderable">False</property>
-             <property name="enable_search">True</property>
-             <property name="fixed_height_mode">False</property>
-             <property name="hover_selection">False</property>
-             <property name="hover_expand">False</property>
-             <signal name="cursor_changed" handler="on_tree_view_cursor_changed" last_modification_time="Sat, 30 Jul 2005 21:39:13 GMT"/>
-           </widget>
-         </child>
-       </widget>
-       <packing>
-         <property name="padding">0</property>
-         <property name="expand">True</property>
-         <property name="fill">True</property>
-       </packing>
-      </child>
-
-      <child>
-       <widget class="GtkLabel" id="info_label">
-         <property name="visible">True</property>
-         <property name="can_focus">True</property>
-         <property name="label" translatable="yes">&lt;i&gt;No service currently selected.&lt;/i&gt;</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">True</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>
-    </widget>
-  </child>
-</widget>
-
-</glade-interface>
diff --git a/avahi-discover-standalone/avahi-discover.gladep b/avahi-discover-standalone/avahi-discover.gladep
deleted file mode 100644 (file)
index a9feaa6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
-
-<glade-project>
-  <name>Avahi-discover</name>
-  <program_name>avahi-discover</program_name>
-  <gnome_support>FALSE</gnome_support>
-</glade-project>
diff --git a/avahi-discover-standalone/avahi-discover.ui b/avahi-discover-standalone/avahi-discover.ui
new file mode 100644 (file)
index 0000000..b4b72f9
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+  <object class="GtkWindow" id="main_window">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Avahi Discovery</property>
+    <property name="type">GTK_WINDOW_TOPLEVEL</property>
+    <property name="window_position">GTK_WIN_POS_NONE</property>
+    <property name="modal">False</property>
+    <property name="default_width">500</property>
+    <property name="default_height">400</property>
+    <property name="resizable">True</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_NORMAL</property>
+    <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+    <property name="focus_on_map">True</property>
+    <signal after="False" handler="gtk_main_quit" name="destroy"/>
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="border_width">12</property>
+        <property name="visible">True</property>
+        <property name="homogeneous">False</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+            <property name="shadow_type">GTK_SHADOW_IN</property>
+            <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+            <child>
+              <object class="GtkTreeView" id="tree_view">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="headers_visible">True</property>
+                <property name="rules_hint">False</property>
+                <property name="reorderable">False</property>
+                <property name="enable_search">True</property>
+                <property name="fixed_height_mode">False</property>
+                <property name="hover_selection">False</property>
+                <property name="hover_expand">False</property>
+                <signal handler="on_tree_view_cursor_changed" last_modification_time="Sat, 30 Jul 2005 21:39:13 GMT" name="cursor_changed"/>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="info_label">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="label" translatable="yes">&lt;i&gt;No service currently selected.&lt;/i&gt;</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">True</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>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
index 90c74f310fab874e187e43a24091dffb229dcfe8..6f5a65797985a95382a0ecb631b9950feadc8190 100644 (file)
@@ -31,7 +31,6 @@
 #include <unistd.h>
 
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 
 #include <avahi-core/core.h>
 #include <avahi-core/lookup.h>
@@ -320,27 +319,27 @@ static gboolean main_window_on_delete_event(AVAHI_GCC_UNUSED GtkWidget *widget,
 }
 
 int main(int argc, char *argv[]) {
-    GladeXML *xml;
+    GtkBuilder *ui;
     AvahiServerConfig config;
     GtkTreeViewColumn *c;
     gint error;
     AvahiGLibPoll *poll_api;
 
     gtk_init(&argc, &argv);
-    glade_init();
 
     avahi_set_allocator(avahi_glib_allocator());
 
     poll_api = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
 
-    xml = glade_xml_new(AVAHI_INTERFACES_DIR"avahi-discover.glade", NULL, NULL);
-    main_window = glade_xml_get_widget(xml, "main_window");
+    ui = gtk_builder_new();
+    gtk_builder_add_from_file(ui, AVAHI_INTERFACES_DIR"avahi-discover.ui", NULL);
+    main_window = GTK_WIDGET(gtk_builder_get_object(ui, "main_window"));
     g_signal_connect(main_window, "delete-event", (GCallback) main_window_on_delete_event, NULL);
-    
-    tree_view = GTK_TREE_VIEW(glade_xml_get_widget(xml, "tree_view"));
+
+    tree_view = GTK_TREE_VIEW(gtk_builder_get_object(ui, "tree_view"));
     g_signal_connect(GTK_WIDGET(tree_view), "cursor-changed", (GCallback) tree_view_on_cursor_changed, NULL);
 
-    info_label = GTK_LABEL(glade_xml_get_widget(xml, "info_label"));
+    info_label = GTK_LABEL(gtk_builder_get_object(ui, "info_label"));
 
     tree_store = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
     gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(tree_store));
index a44a071a502cc8aa9bb4f75798bb74478f484637..7a16472bb8f8c3c4a1b52fb1fd766d52a6e720ed 100644 (file)
@@ -21,7 +21,6 @@ AM_CFLAGS=-I$(top_srcdir)
 
 EXTRA_DIST = \
        __init__.py \
-       SimpleGladeApp.py \
        avahi-discover.in \
        avahi-discover.desktop.in.in
 
@@ -42,7 +41,7 @@ pythonscripts += \
        avahi-discover
 desktop_DATA += avahi-discover.desktop
 @INTLTOOL_DESKTOP_RULE@
-avahi_discover_PYTHON += __init__.py SimpleGladeApp.py
+avahi_discover_PYTHON += __init__.py
 endif
 
 if HAVE_DBM
@@ -50,7 +49,7 @@ pythonscripts += \
        avahi-discover
 desktop_DATA += avahi-discover.desktop
 @INTLTOOL_DESKTOP_RULE@
-avahi_discover_PYTHON += __init__.py SimpleGladeApp.py
+avahi_discover_PYTHON += __init__.py
 endif
 
 avahi-discover.desktop.in: avahi-discover.desktop.in.in
diff --git a/avahi-python/avahi-discover/SimpleGladeApp.py b/avahi-python/avahi-discover/SimpleGladeApp.py
deleted file mode 100644 (file)
index 90c598c..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-"""
- SimpleGladeApp.py
- Module that provides an object oriented abstraction to pygtk and libglade.
- Copyright (C) 2004 Sandino Flores Moreno
-"""
-
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import sys
-import re
-
-import tokenize
-import gtk
-import gtk.glade
-import weakref
-import inspect
-
-__version__ = "1.0"
-__author__ = 'Sandino "tigrux" Flores-Moreno'
-
-def bindtextdomain(app_name, locale_dir=None):
-    """    
-    Bind the domain represented by app_name to the locale directory locale_dir.
-    It has the effect of loading translations, enabling applications for different
-    languages.
-
-    app_name:
-        a domain to look for translations, tipically the name of an application.
-
-    locale_dir:
-        a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
-        If omitted or None, then the current binding for app_name is used.
-    """    
-    try:
-        import locale
-        import gettext
-        locale.setlocale(locale.LC_ALL, "")
-        gtk.glade.bindtextdomain(app_name, locale_dir)
-        gettext.install(app_name, locale_dir, unicode=1)
-    except (IOError,locale.Error), e:
-        print "Warning", app_name, e
-        __builtins__.__dict__["_"] = lambda x : x
-
-
-class SimpleGladeApp:
-
-    def __init__(self, path, root=None, domain=None, **kwargs):
-        """
-        Load a glade file specified by glade_filename, using root as
-        root widget and domain as the domain for translations.
-
-        If it receives extra named arguments (argname=value), then they are used
-        as attributes of the instance.
-
-        path:
-            path to a glade filename.
-            If glade_filename cannot be found, then it will be searched in the
-            same directory of the program (sys.argv[0])
-
-        root:
-            the name of the widget that is the root of the user interface,
-            usually a window or dialog (a top level widget).
-            If None or ommited, the full user interface is loaded.
-
-        domain:
-            A domain to use for loading translations.
-            If None or ommited, no translation is loaded.
-
-        **kwargs:
-            a dictionary representing the named extra arguments.
-            It is useful to set attributes of new instances, for example:
-                glade_app = SimpleGladeApp("ui.glade", foo="some value", bar="another value")
-            sets two attributes (foo and bar) to glade_app.
-        """        
-        if os.path.isfile(path):
-            self.glade_path = path
-        else:
-            glade_dir = os.path.dirname( sys.argv[0] )
-            self.glade_path = os.path.join(glade_dir, path)
-        for key, value in kwargs.items():
-            try:
-                setattr(self, key, weakref.proxy(value) )
-            except TypeError:
-                setattr(self, key, value)
-        self.glade = None
-        self.install_custom_handler(self.custom_handler)
-        self.glade = self.create_glade(self.glade_path, root, domain)
-        if root:
-            self.main_widget = self.get_widget(root)
-        else:
-            self.main_widget = None
-        self.normalize_names()
-        self.add_callbacks(self)
-        self.new()
-
-    def __repr__(self):
-        class_name = self.__class__.__name__
-        if self.main_widget:
-            root = gtk.Widget.get_name(self.main_widget)
-            repr = '%s(path="%s", root="%s")' % (class_name, self.glade_path, root)
-        else:
-            repr = '%s(path="%s")' % (class_name, self.glade_path)
-        return repr
-
-    def new(self):
-        """
-        Method called when the user interface is loaded and ready to be used.
-        At this moment, the widgets are loaded and can be refered as self.widget_name
-        """
-        pass
-
-    def add_callbacks(self, callbacks_proxy):
-        """
-        It uses the methods of callbacks_proxy as callbacks.
-        The callbacks are specified by using:
-            Properties window -> Signals tab
-            in glade-2 (or any other gui designer like gazpacho).
-
-        Methods of classes inheriting from SimpleGladeApp are used as
-        callbacks automatically.
-
-        callbacks_proxy:
-            an instance with methods as code of callbacks.
-            It means it has methods like on_button1_clicked, on_entry1_activate, etc.
-        """        
-        self.glade.signal_autoconnect(callbacks_proxy)
-
-    def normalize_names(self):
-        """
-        It is internally used to normalize the name of the widgets.
-        It means a widget named foo:vbox-dialog in glade
-        is refered self.vbox_dialog in the code.
-
-        It also sets a data "prefixes" with the list of
-        prefixes a widget has for each widget.
-        """
-        for widget in self.get_widgets():
-            widget_name = gtk.Widget.get_name(widget)
-            prefixes_name_l = widget_name.split(":")
-            prefixes = prefixes_name_l[ : -1]
-            widget_api_name = prefixes_name_l[-1]
-            widget_api_name = "_".join( re.findall(tokenize.Name, widget_api_name) )
-            gtk.Widget.set_name(widget, widget_api_name)
-            if hasattr(self, widget_api_name):
-                raise AttributeError("instance %s already has an attribute %s" % (self,widget_api_name))
-            else:
-                setattr(self, widget_api_name, widget)
-                if prefixes:
-                    gtk.Widget.set_data(widget, "prefixes", prefixes)
-
-    def add_prefix_actions(self, prefix_actions_proxy):
-        """
-        By using a gui designer (glade-2, gazpacho, etc)
-        widgets can have a prefix in theirs names
-        like foo:entry1 or foo:label3
-        It means entry1 and label3 has a prefix action named foo.
-
-        Then, prefix_actions_proxy must have a method named prefix_foo which
-        is called everytime a widget with prefix foo is found, using the found widget
-        as argument.
-
-        prefix_actions_proxy:
-            An instance with methods as prefix actions.
-            It means it has methods like prefix_foo, prefix_bar, etc.
-        """        
-        prefix_s = "prefix_"
-        prefix_pos = len(prefix_s)
-
-        is_method = lambda t : callable( t[1] )
-        is_prefix_action = lambda t : t[0].startswith(prefix_s)
-        drop_prefix = lambda (k,w): (k[prefix_pos:],w)
-
-        members_t = inspect.getmembers(prefix_actions_proxy)
-        methods_t = filter(is_method, members_t)
-        prefix_actions_t = filter(is_prefix_action, methods_t)
-        prefix_actions_d = dict( map(drop_prefix, prefix_actions_t) )
-
-        for widget in self.get_widgets():
-            prefixes = gtk.Widget.get_data(widget, "prefixes")
-            if prefixes:
-                for prefix in prefixes:
-                    if prefix in prefix_actions_d:
-                        prefix_action = prefix_actions_d[prefix]
-                        prefix_action(widget)
-
-    def custom_handler(self,
-            glade, function_name, widget_name,
-            str1, str2, int1, int2):
-        """
-        Generic handler for creating custom widgets, internally used to
-        enable custom widgets (custom widgets of glade).
-
-        The custom widgets have a creation function specified in design time.
-        Those creation functions are always called with str1,str2,int1,int2 as
-        arguments, that are values specified in design time.
-
-        Methods of classes inheriting from SimpleGladeApp are used as
-        creation functions automatically.
-
-        If a custom widget has create_foo as creation function, then the
-        method named create_foo is called with str1,str2,int1,int2 as arguments.
-        """
-        try:
-            handler = getattr(self, function_name)
-            return handler(str1, str2, int1, int2)
-        except AttributeError:
-            return None
-
-    def gtk_widget_show(self, widget, *args):
-        """
-        Predefined callback.
-        The widget is showed.
-        Equivalent to widget.show()
-        """
-        widget.show()
-
-    def gtk_widget_hide(self, widget, *args):
-        """
-        Predefined callback.
-        The widget is hidden.
-        Equivalent to widget.hide()
-        """
-        widget.hide()
-
-    def gtk_widget_grab_focus(self, widget, *args):
-        """
-        Predefined callback.
-        The widget grabs the focus.
-        Equivalent to widget.grab_focus()
-        """
-        widget.grab_focus()
-
-    def gtk_widget_destroy(self, widget, *args):
-        """
-        Predefined callback.
-        The widget is destroyed.
-        Equivalent to widget.destroy()
-        """
-        widget.destroy()
-
-    def gtk_window_activate_default(self, window, *args):
-        """
-        Predefined callback.
-        The default widget of the window is activated.
-        Equivalent to window.activate_default()
-        """
-        widget.activate_default()
-
-    def gtk_true(self, *args):
-        """
-        Predefined callback.
-        Equivalent to return True in a callback.
-        Useful for stopping propagation of signals.
-        """
-        return True
-
-    def gtk_false(self, *args):
-        """
-        Predefined callback.
-        Equivalent to return False in a callback.
-        """
-        return False
-
-    def gtk_main_quit(self, *args):
-        """
-        Predefined callback.
-        Equivalent to self.quit()
-        """
-        self.quit()
-
-    def main(self):
-        """
-        Starts the main loop of processing events.
-        The default implementation calls gtk.main()
-
-        Useful for applications that needs a non gtk main loop.
-        For example, applications based on gstreamer needs to override
-        this method with gst.main()
-
-        Do not directly call this method in your programs.
-        Use the method run() instead.
-        """
-        gtk.main()
-
-    def quit(self):
-        """
-        Quit processing events.
-        The default implementation calls gtk.main_quit()
-        
-        Useful for applications that needs a non gtk main loop.
-        For example, applications based on gstreamer needs to override
-        this method with gst.main_quit()
-        """
-        gtk.main_quit()
-
-    def run(self):
-        """
-        Starts the main loop of processing events checking for Control-C.
-
-        The default implementation checks wheter a Control-C is pressed,
-        then calls on_keyboard_interrupt().
-
-        Use this method for starting programs.
-        """
-        try:
-            self.main()
-        except KeyboardInterrupt:
-            self.on_keyboard_interrupt()
-
-    def on_keyboard_interrupt(self):
-        """
-        This method is called by the default implementation of run()
-        after a program is finished by pressing Control-C.
-        """
-        pass
-
-    def install_custom_handler(self, custom_handler):
-        gtk.glade.set_custom_handler(custom_handler)
-
-    def create_glade(self, glade_path, root, domain):
-        return gtk.glade.XML(self.glade_path, root, domain)
-
-    def get_widget(self, widget_name):
-        return self.glade.get_widget(widget_name)
-
-    def get_widgets(self):
-        return self.glade.get_widget_prefix("")        
index 055842476f006ccb7e2eee8da21731a02af6e27e..6c22f45568598a337df556dc51ca68e43b21f3f0 100755 (executable)
@@ -23,9 +23,6 @@ import os, sys
 
 try:
     import avahi, gettext, gtk, gobject, dbus, avahi.ServiceTypeDatabase
-    from avahi_discover.SimpleGladeApp import SimpleGladeApp
-    gtk.glade.bindtextdomain(@GETTEXT_PACKAGE@, @LOCALEDIR@)
-    gtk.glade.textdomain(@GETTEXT_PACKAGE@)
     _ = gettext.gettext
 except ImportError, e:
     print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus.\n Error: %s" % e
@@ -52,15 +49,20 @@ def error_msg(msg):
     d.run()
     d.destroy()
 
-glade_dir = "@interfacesdir@"
+ui_dir = "@interfacesdir@"
 
 service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase()
 
-class Main_window(SimpleGladeApp):
-    def __init__(self, path="avahi-discover.glade", root="main_window", domain=None, **kwargs):
-        path = os.path.join(glade_dir, path)
+class Main_window:
+    def __init__(self, path="avahi-discover.ui", root="main_window", domain=None, **kwargs):
+        path = os.path.join(ui_dir, path)
         gtk.window_set_default_icon_name("network-wired")
-        SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
+        self.ui = gtk.Builder()
+        self.ui.add_from_file(path)
+        self.ui.connect_signals(self)
+        self.tree_view = self.ui.get_object("tree_view")
+        self.info_label = self.ui.get_object("info_label")
+        self.new()
 
     def on_tree_view_cursor_changed(self, widget, *args):
         (model, iter) = widget.get_selection().get_selected()
@@ -264,11 +266,12 @@ class Main_window(SimpleGladeApp):
             # Just browse the domain the user wants us to browse
             self.browse_domain(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, domain)
 
-        
+    def gtk_main_quit(self, *args):
+        gtk.main_quit()
+
 def main():
     main_window = Main_window()
-
-    main_window.run()
+    gtk.main()
     
 if __name__ == "__main__":
     main()
index 9ca380c78e53551d12d74021c335e4936b304df6..8556e848fbeec36188a4e9d44ec0a160dbfaa3f6 100644 (file)
@@ -528,14 +528,9 @@ AC_ARG_ENABLE(gtk,
 
 if test "x$HAVE_GTK" = "xyes" ; then
         # Check for GTK 2.0
-        PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
+        PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.12.0 ])
         AC_SUBST(GTK20_CFLAGS)
         AC_SUBST(GTK20_LIBS)
-
-        # Check for GLADE 2.0
-        PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
-        AC_SUBST(GLADE20_CFLAGS)
-        AC_SUBST(GLADE20_LIBS)
 fi
 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
 
index f3e48ded501971814f83d909d887ea8a859ea22e..9e9a0cc648788497965c29ea0d591ebcb0801247 100644 (file)
@@ -1,6 +1,6 @@
 # List of source files which contain translatable strings.
 avahi-common/error.c
-avahi-discover-standalone/avahi-discover.glade
+[type: gettext/glade]avahi-discover-standalone/avahi-discover.ui
 avahi-python/avahi-discover/avahi-discover.desktop.in.in
 avahi-ui/avahi-ui.c
 avahi-ui/bssh.c
index 90541bbec53d193fcebda6daa2710a9f4a2d5647..ce6337d6f2b8a8ef23fd76e96dfbf4e8d747d275 100644 (file)
@@ -1,4 +1,3 @@
-avahi-discover-standalone/avahi-discover.glade
 avahi-ui/bssh.desktop.in
 avahi-ui/bvnc.desktop.in
 tests/c-plus-plus-test-gen.py