Commit 588d039a authored by Leandro Resende Mattioli's avatar Leandro Resende Mattioli Committed by Jonh Wendell
Browse files

Use GtkBuilder instead of libglade. Fixes bug #580209.

parent 321c1970
......@@ -39,7 +39,6 @@ GNOME_DOC_INIT
GLIB_REQUIRED=2.17.0
GTK_REQUIRED=2.13.1
LIBGLADE_REQUIRED=2.6.0
GCONF_REQUIRED=2.16.0
GTHREAD_REQUIRED=2.0.0
GTK_VNC_REQUIRED=0.3.8
......@@ -69,7 +68,6 @@ PKG_CHECK_MODULES(VINAGRE, \
glib-2.0 >= $GLIB_REQUIRED \
gio-2.0 >= $GLIB_REQUIRED \
gtk+-2.0 >= $GTK_REQUIRED \
libglade-2.0 >= $LIBGLADE_REQUIRED \
gconf-2.0 >= $GCONF_REQUIRED \
gthread-2.0 >= $GTHREAD_REQUIRED \
gnome-keyring-1 \
......@@ -80,7 +78,6 @@ AC_SUBST(VINAGRE_LIBS)
PKG_CHECK_MODULES(VNC, \
gtk-vnc-1.0 >= $GTK_VNC_REQUIRED \
libglade-2.0 >= $LIBGLADE_REQUIRED \
libxml-2.0 >= $XML_REQUIRED
)
AC_SUBST(VNC_CFLAGS)
......
SUBDIRS = icons pixmaps
gladedir = $(datadir)/vinagre
glade_DATA = vinagre.glade
gtkbuilderdir = $(datadir)/vinagre
gtkbuilder_DATA = vinagre.ui
man_MANS = vinagre.1
......
This diff is collapsed.
......@@ -20,7 +20,6 @@
*/
#include <glib/gi18n.h>
#include <glade/glade.h>
#include <vncdisplay.h>
#include <gdk/gdkkeysyms.h>
......@@ -415,8 +414,8 @@ ask_credential (VinagreVncTab *vnc_tab,
gchar **username,
gchar **password)
{
GladeXML *xml;
const char *glade_file;
GtkBuilder *xml;
const char *ui_file;
GtkWidget *password_dialog, *host_label, *save_credential_check;
GtkWidget *password_label, *username_label, *image;
gchar *name, *label;
......@@ -425,26 +424,33 @@ ask_credential (VinagreVncTab *vnc_tab,
VinagreTab *tab = VINAGRE_TAB (vnc_tab);
VinagreConnection *conn = vinagre_tab_get_conn (tab);
glade_file = vinagre_utils_get_glade_filename ();
xml = glade_xml_new (glade_file, NULL, NULL);
ui_file = vinagre_utils_get_ui_filename ();
GError* error = NULL;
xml = gtk_builder_new ();
if (!gtk_builder_add_from_file (xml, ui_file, &error))
{
g_warning (_("Couldn't load builder file: &s"), error->message);
g_error_free (error);
}
password_dialog = glade_xml_get_widget (xml, "auth_required_dialog");
password_dialog = GTK_WIDGET (gtk_builder_get_object (xml, "auth_required_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(password_dialog),
GTK_WINDOW(vinagre_tab_get_window (tab)));
host_label = glade_xml_get_widget (xml, "host_label");
host_label = GTK_WIDGET (gtk_builder_get_object (xml, "host_label"));
name = vinagre_connection_get_best_name (conn);
label = g_strdup_printf ("<i>%s</i>", name);
gtk_label_set_markup (GTK_LABEL (host_label), label);
g_free (name);
g_free (label);
control.uname = glade_xml_get_widget (xml, "username_entry");
control.pw = glade_xml_get_widget (xml, "password_entry");
control.button = glade_xml_get_widget (xml, "ok_button");
password_label = glade_xml_get_widget (xml, "password_label");
username_label = glade_xml_get_widget (xml, "username_label");
save_credential_check = glade_xml_get_widget (xml, "save_credential_check");
control.uname = GTK_WIDGET (gtk_builder_get_object (xml, "username_entry"));
control.pw = GTK_WIDGET (gtk_builder_get_object (xml, "password_entry"));
control.button = GTK_WIDGET (gtk_builder_get_object (xml, "ok_button"));
password_label = GTK_WIDGET (gtk_builder_get_object (xml, "password_label"));
username_label = GTK_WIDGET (gtk_builder_get_object (xml, "username_label"));
save_credential_check = GTK_WIDGET (gtk_builder_get_object (xml, "save_credential_check"));
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (control.button), image);
......
......@@ -3,7 +3,7 @@
data/GNOME_VinagreApplet.xml
data/vinagre.desktop.in.in
data/vinagre-file.desktop.in.in
data/vinagre.glade
data/vinagre.ui
data/vinagre.schemas.in.in
data/vinagre-mime.xml.in
data/vinagre-ui.xml
......
......@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glade/glade.h>
#include <string.h>
#include <glib/gi18n.h>
......@@ -41,17 +40,22 @@ show_dialog_folder (VinagreBookmarks *book,
VinagreBookmarksEntry *entry,
gboolean is_add)
{
GladeXML *xml;
GtkBuilder *xml;
GtkWidget *dialog, *box, *tree, *name_entry, *save_button;
const gchar *name;
xml = glade_xml_new (vinagre_utils_get_glade_filename (),
"bookmarks_add_edit_folder_dialog",
NULL);
dialog = glade_xml_get_widget (xml, "bookmarks_add_edit_folder_dialog");
name_entry = glade_xml_get_widget (xml, "edit_bookmark_folder_name_entry");
box = glade_xml_get_widget (xml, "folder_box1");
save_button= glade_xml_get_widget (xml, "save_button");
GError* error = NULL;
xml = gtk_builder_new ();
if (!gtk_builder_add_from_file (xml, vinagre_utils_get_ui_filename (), &error))
{
g_warning (_("Couldn't load builder file: &s"), error->message);
g_error_free (error);
}
dialog = GTK_WIDGET (gtk_builder_get_object (xml, "bookmarks_add_edit_folder_dialog"));
name_entry = GTK_WIDGET (gtk_builder_get_object (xml, "edit_bookmark_folder_name_entry"));
box = GTK_WIDGET (gtk_builder_get_object (xml, "folder_box1"));
save_button= GTK_WIDGET (gtk_builder_get_object (xml, "save_button"));
gtk_window_set_transient_for (GTK_WINDOW (dialog), window);
gtk_entry_set_text (GTK_ENTRY (name_entry), vinagre_bookmarks_entry_get_name (entry));
......@@ -123,7 +127,7 @@ show_dialog_conn (VinagreBookmarks *book,
{
gchar *str, *host, *error_str, *protocol;
gint port;
GladeXML *xml;
GtkBuilder *xml;
GtkWidget *dialog, *host_entry, *name_entry, *fs_check;
GtkWidget *folder_box, *tree, *save_button, *plugin_box;
GtkWidget *plugin_options, *protocol_label;
......@@ -132,17 +136,22 @@ show_dialog_conn (VinagreBookmarks *book,
VinagrePlugin *plugin;
gchar **props;
xml = glade_xml_new (vinagre_utils_get_glade_filename (),
"bookmarks_add_edit_conn_dialog",
NULL);
dialog = glade_xml_get_widget (xml, "bookmarks_add_edit_conn_dialog");
name_entry = glade_xml_get_widget (xml, "edit_bookmark_name_entry");
host_entry = glade_xml_get_widget (xml, "edit_bookmark_host_entry");
fs_check = glade_xml_get_widget (xml, "fullscreen_check");
folder_box = glade_xml_get_widget (xml, "folder_box");
plugin_box = glade_xml_get_widget (xml, "plugin_options_vbox");
save_button = glade_xml_get_widget (xml, "save_button");
protocol_label = glade_xml_get_widget (xml, "protocol_label");
GError* error = NULL;
xml = gtk_builder_new ();
if (!gtk_builder_add_from_file (xml, vinagre_utils_get_ui_filename (), &error))
{
g_warning (_("Couldn't load builder file: &s"), error->message);
g_error_free (error);
}
dialog = GTK_WIDGET (gtk_builder_get_object (xml, "bookmarks_add_edit_conn_dialog"));
name_entry = GTK_WIDGET (gtk_builder_get_object (xml, "edit_bookmark_name_entry"));
host_entry = GTK_WIDGET (gtk_builder_get_object (xml, "edit_bookmark_host_entry"));
fs_check = GTK_WIDGET (gtk_builder_get_object (xml, "fullscreen_check"));
folder_box = GTK_WIDGET (gtk_builder_get_object (xml, "folder_box"));
plugin_box = GTK_WIDGET (gtk_builder_get_object (xml, "plugin_options_vbox"));
save_button = GTK_WIDGET (gtk_builder_get_object (xml, "save_button"));
protocol_label = GTK_WIDGET (gtk_builder_get_object (xml, "protocol_label"));
gtk_window_set_transient_for (GTK_WINDOW (dialog), window);
conn = vinagre_bookmarks_entry_get_conn (entry);
......
......@@ -25,7 +25,6 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <string.h>
#ifdef VINAGRE_ENABLE_AVAHI
......@@ -40,7 +39,7 @@
#include "vinagre-plugin.h"
typedef struct {
GladeXML *xml;
GtkBuilder *xml;
GtkWidget *dialog;
GtkWidget *protocol_combo;
GtkWidget *protocol_description_label;
......@@ -366,16 +365,23 @@ VinagreConnection *vinagre_connect (VinagreWindow *window)
gint result;
VinagreConnectDialog dialog;
dialog.xml = glade_xml_new (vinagre_utils_get_glade_filename (), "connect_dialog", NULL);
dialog.dialog = glade_xml_get_widget (dialog.xml, "connect_dialog");
GError* error = NULL;
dialog.xml = gtk_builder_new ();
if (!gtk_builder_add_from_file (dialog.xml, vinagre_utils_get_ui_filename (), &error))
{
g_warning (_("Couldn't load builder file: &s"), error->message);
g_error_free (error);
}
dialog.dialog = GTK_WIDGET (gtk_builder_get_object (dialog.xml, "connect_dialog"));
gtk_window_set_transient_for (GTK_WINDOW (dialog.dialog), GTK_WINDOW (window));
dialog.protocol_combo = glade_xml_get_widget (dialog.xml, "protocol_combo");
dialog.protocol_description_label = glade_xml_get_widget (dialog.xml, "protocol_description_label");
dialog.host_entry = glade_xml_get_widget (dialog.xml, "host_entry");
dialog.find_button = glade_xml_get_widget (dialog.xml, "find_button");
dialog.fullscreen_check = glade_xml_get_widget (dialog.xml, "fullscreen_check");
dialog.plugin_box = glade_xml_get_widget (dialog.xml, "plugin_options_vbox");
dialog.protocol_combo = GTK_WIDGET (gtk_builder_get_object (dialog.xml, "protocol_combo"));
dialog.protocol_description_label = GTK_WIDGET (gtk_builder_get_object (dialog.xml, "protocol_description_label"));
dialog.host_entry = GTK_WIDGET (gtk_builder_get_object (dialog.xml, "host_entry"));
dialog.find_button = GTK_WIDGET (gtk_builder_get_object (dialog.xml, "find_button"));
dialog.fullscreen_check = GTK_WIDGET (gtk_builder_get_object (dialog.xml, "fullscreen_check"));
dialog.plugin_box = GTK_WIDGET (gtk_builder_get_object (dialog.xml, "plugin_options_vbox"));
setup_protocol (&dialog);
setup_combo (dialog.host_entry);
......
......@@ -20,7 +20,6 @@
#include <gconf/gconf-client.h>
#include <glib/gi18n.h>
#include <glade/glade.h>
#include "vinagre-prefs.h"
#include "vinagre-utils.h"
......@@ -478,10 +477,10 @@ vinagre_prefs_class_init (VinagrePrefsClass *klass)
/* Preferences dialog */
typedef struct {
GladeXML *xml;
GtkWidget *dialog;
GtkWidget *show_tabs;
GtkWidget *show_accels;
GtkBuilder *xml;
GtkWidget *dialog;
GtkWidget *show_tabs;
GtkWidget *show_accels;
} VinagrePrefsDialog;
static void
......@@ -530,12 +529,19 @@ vinagre_prefs_dialog_show (VinagreWindow *window)
dialog = g_new (VinagrePrefsDialog, 1);
dialog->xml = glade_xml_new (vinagre_utils_get_glade_filename (), NULL, NULL);
dialog->dialog = glade_xml_get_widget (dialog->xml, "preferences_dialog");
GError* error = NULL;
dialog->xml = gtk_builder_new ();
if (!gtk_builder_add_from_file (dialog->xml, vinagre_utils_get_ui_filename (), &error))
{
g_warning (_("Couldn't load builder file: &s"), error->message);
g_error_free (error);
}
dialog->dialog = GTK_WIDGET (gtk_builder_get_object (dialog->xml, "preferences_dialog"));
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (window));
dialog->show_tabs = glade_xml_get_widget (dialog->xml, "always_show_tabs_check");
dialog->show_accels = glade_xml_get_widget (dialog->xml, "show_accels_check");
dialog->show_tabs = GTK_WIDGET (gtk_builder_get_object (dialog->xml, "always_show_tabs_check"));
dialog->show_accels = GTK_WIDGET (gtk_builder_get_object (dialog->xml, "show_accels_check"));
vinagre_prefs_dialog_setup (dialog);
......
......@@ -24,7 +24,6 @@
#endif
#include <glib/gi18n.h>
#include <glade/glade.h>
#include <gnome-keyring.h>
#include "vinagre-tab.h"
......
......@@ -22,7 +22,7 @@
#include <glib/gi18n.h>
#include "vinagre-utils.h"
#define VINAGRE_GLADE_FILE "vinagre.glade"
#define VINAGRE_UI_FILE "vinagre.ui"
#define VINAGRE_UI_XML_FILE "vinagre-ui.xml"
#ifdef HAVE_CONFIG_H
......@@ -119,12 +119,12 @@ vinagre_utils_toggle_widget_visible (GtkWidget *widget)
}
const gchar *
vinagre_utils_get_glade_filename (void)
vinagre_utils_get_ui_filename (void)
{
if (g_file_test (VINAGRE_GLADE_FILE, G_FILE_TEST_EXISTS))
return VINAGRE_GLADE_FILE;
if (g_file_test (VINAGRE_UI_FILE, G_FILE_TEST_EXISTS))
return VINAGRE_UI_FILE;
else
return VINAGRE_DATADIR "/" VINAGRE_GLADE_FILE;
return VINAGRE_DATADIR "/" VINAGRE_UI_FILE;
}
const gchar *
......
......@@ -43,7 +43,7 @@ void vinagre_utils_show_many_errors (const gchar *title,
void vinagre_utils_toggle_widget_visible (GtkWidget *widget);
const gchar *vinagre_utils_get_glade_filename (void);
const gchar *vinagre_utils_get_ui_filename (void);
const gchar *vinagre_utils_get_ui_xml_filename (void);
gchar *vinagre_utils_escape_underscores (const gchar *text,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment