diff --git a/capplets/display/Makefile.am b/capplets/display/Makefile.am index d8f7d105e..ff0bcdf38 100644 --- a/capplets/display/Makefile.am +++ b/capplets/display/Makefile.am @@ -1,8 +1,8 @@ # This is used in GNOMECC_CAPPLETS_CFLAGS cappletname = display -gladedir = $(pkgdatadir)/glade -dist_glade_DATA = display-capplet.glade +uidir = $(pkgdatadir)/ui +dist_ui_DATA = display-capplet.ui bin_PROGRAMS = gnome-display-properties @@ -37,7 +37,7 @@ desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) INCLUDES = $(DISPLAY_CAPPLET_CFLAGS) \ $(GNOMECC_CAPPLETS_CFLAGS) \ - -DGLADEDIR="\"$(gladedir)\"" \ + -DUIDIR="\"$(uidir)\"" \ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" diff --git a/capplets/display/build.sh b/capplets/display/build.sh index 4268ab7b4..6d0fc447a 100644 --- a/capplets/display/build.sh +++ b/capplets/display/build.sh @@ -1 +1 @@ -gcc -g -Wall `pkg-config --cflags --libs gtk+-2.0 libglade-2.0` -I../ ../randrwrap.c ../monitor-db.c xrandr-capplet.c ../edid-parse.c ../display-name.c scrollarea.c foo-marshal.c -o capplet +gcc -g -Wall `pkg-config --cflags --libs gtk+-2.0` -I../ ../randrwrap.c ../monitor-db.c xrandr-capplet.c ../edid-parse.c ../display-name.c scrollarea.c foo-marshal.c -o capplet diff --git a/capplets/display/display-capplet.glade b/capplets/display/display-capplet.glade deleted file mode 100644 index d94770bb3..000000000 --- a/capplets/display/display-capplet.glade +++ /dev/null @@ -1,541 +0,0 @@ - - - - - - - 5 - Display Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 2 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - True - True - True - gtk-apply - True - GTK_RELIEF_NORMAL - True - -10 - - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 5 - True - False - 12 - - - - True - <i>Drag the monitors to set their place</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 0 - 0 - - - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - True - _Mirror screens - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - _Detect Monitors - True - GTK_RELIEF_NORMAL - True - - - 0 - False - False - GTK_PACK_END - - - - - 0 - False - False - - - - - - True - True - False - - - - True - <b>Monitor</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - 0 - False - False - - - - - - True - 3 - 5 - False - 6 - 12 - - - - True - Include _panel - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 3 - 5 - 1 - 2 - shrink|fill - - - - - - - True - _Resolution: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - resolution_combo - - - 1 - 2 - 1 - 2 - shrink|fill - - - - - - - True - Re_fresh rate: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - refresh_combo - - - 1 - 2 - 2 - 3 - shrink|fill - - - - - - - True - R_otation: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - rotation_combo - - - 3 - 4 - 2 - 3 - shrink|fill - - - - - - - True - False - True - - - 2 - 3 - 1 - 2 - expand|shrink|fill - - - - - - - True - False - True - - - 2 - 3 - 2 - 3 - - - - - - - True - Normal -Left -Right -Upside-down - - False - True - - - 4 - 5 - 2 - 3 - - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - - - - 0 - 1 - 0 - 3 - fill - - - - - - True - False - 12 - - - - True - True - On - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Off - True - GTK_RELIEF_NORMAL - True - False - False - True - monitor_on_radio - - - 0 - False - False - - - - - 1 - 5 - 0 - 1 - fill - fill - - - - - 0 - False - True - - - - - - True - <b>Panel icon</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - True - _Show displays in panel - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - - 0 - False - False - - - - - 0 - True - True - - - - - - - diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index 9399732f4..dca6d49f9 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include "scrollarea.h" @@ -2110,38 +2109,47 @@ apply_button_clicked_cb (GtkButton *button, gpointer data) app->apply_button_clicked_timestamp = gtk_get_current_event_time (); } +static GtkWidget* +_gtk_builder_get_widget (GtkBuilder *builder, const gchar *name) +{ + return GTK_WIDGET (gtk_builder_get_object (builder, name)); +} + static void run_application (App *app) { -#ifndef GLADEDIR -#define GLADEDIR "." +#ifndef UIDIR +#define UIDIR "." #endif -#define GLADE_FILE GLADEDIR "/display-capplet.glade" - GladeXML *xml; +#define UI_FILE UIDIR "/display-capplet.ui" + GtkBuilder *builder; GtkWidget *align; GError *error; - xml = glade_xml_new (GLADE_FILE, NULL, NULL); - if (!xml) + error = NULL; + builder = gtk_builder_new (); + + if (gtk_builder_add_from_file (builder, UI_FILE, &error) == 0) { - g_warning ("Could not open " GLADE_FILE); + g_warning ("Could not parse UI definition: %s", error->message); + g_error_free (error); + g_object_unref (builder); return; } - error = NULL; app->screen = gnome_rr_screen_new (gdk_screen_get_default (), on_screen_changed, app, &error); if (!app->screen) { error_message (NULL, _("Could not get screen information"), error->message); g_error_free (error); - g_object_unref (xml); + g_object_unref (builder); return; } app->client = gconf_client_get_default (); - app->dialog = glade_xml_get_widget (xml, "dialog"); + app->dialog = _gtk_builder_get_widget (builder, "dialog"); g_signal_connect_after (app->dialog, "map-event", G_CALLBACK (dialog_map_event_cb), app); @@ -2149,43 +2157,49 @@ run_application (App *app) gtk_window_set_icon_name (GTK_WINDOW (app->dialog), "gnome-display-properties"); - app->current_monitor_event_box = glade_xml_get_widget (xml, "current_monitor_event_box"); - app->current_monitor_label = glade_xml_get_widget (xml, "current_monitor_label"); + app->current_monitor_event_box = _gtk_builder_get_widget (builder, + "current_monitor_event_box"); + app->current_monitor_label = _gtk_builder_get_widget (builder, + "current_monitor_label"); - app->monitor_on_radio = glade_xml_get_widget (xml, "monitor_on_radio"); - app->monitor_off_radio = glade_xml_get_widget (xml, "monitor_off_radio"); + app->monitor_on_radio = _gtk_builder_get_widget (builder, + "monitor_on_radio"); + app->monitor_off_radio = _gtk_builder_get_widget (builder, + "monitor_off_radio"); g_signal_connect (app->monitor_on_radio, "toggled", G_CALLBACK (monitor_on_off_toggled_cb), app); g_signal_connect (app->monitor_off_radio, "toggled", G_CALLBACK (monitor_on_off_toggled_cb), app); - app->resolution_combo = glade_xml_get_widget (xml, "resolution_combo"); + app->resolution_combo = _gtk_builder_get_widget (builder, + "resolution_combo"); g_signal_connect (app->resolution_combo, "changed", G_CALLBACK (on_resolution_changed), app); - app->refresh_combo = glade_xml_get_widget (xml, "refresh_combo"); + app->refresh_combo = _gtk_builder_get_widget (builder, "refresh_combo"); g_signal_connect (app->refresh_combo, "changed", G_CALLBACK (on_rate_changed), app); - app->rotation_combo = glade_xml_get_widget (xml, "rotation_combo"); + app->rotation_combo = _gtk_builder_get_widget (builder, "rotation_combo"); g_signal_connect (app->rotation_combo, "changed", G_CALLBACK (on_rotation_changed), app); - app->clone_checkbox = glade_xml_get_widget (xml, "clone_checkbox"); + app->clone_checkbox = _gtk_builder_get_widget (builder, "clone_checkbox"); g_signal_connect (app->clone_checkbox, "toggled", G_CALLBACK (on_clone_changed), app); - g_signal_connect (glade_xml_get_widget (xml, "detect_displays_button"), + g_signal_connect (_gtk_builder_get_widget (builder, "detect_displays_button"), "clicked", G_CALLBACK (on_detect_displays), app); - app->show_icon_checkbox = glade_xml_get_widget (xml, "show_notification_icon"); + app->show_icon_checkbox = _gtk_builder_get_widget (builder, + "show_notification_icon"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->show_icon_checkbox), gconf_client_get_bool (app->client, SHOW_ICON_KEY, NULL)); g_signal_connect (app->show_icon_checkbox, "toggled", G_CALLBACK (on_show_icon_toggled), app); - app->panel_checkbox = glade_xml_get_widget (xml, "panel_checkbox"); + app->panel_checkbox = _gtk_builder_get_widget (builder, "panel_checkbox"); make_text_combo (app->resolution_combo, 4); make_text_combo (app->refresh_combo, 3); @@ -2206,20 +2220,20 @@ run_application (App *app) g_signal_connect (app->area, "viewport_changed", G_CALLBACK (on_viewport_changed), app); - align = glade_xml_get_widget (xml, "align"); + align = _gtk_builder_get_widget (builder, "align"); gtk_container_add (GTK_CONTAINER (align), app->area); /* Until we have help to show, we'll just hide the Help button */ hide_help_button (app); - app->apply_button = glade_xml_get_widget (xml, "apply_button"); + app->apply_button = _gtk_builder_get_widget (builder, "apply_button"); g_signal_connect (app->apply_button, "clicked", G_CALLBACK (apply_button_clicked_cb), app); on_screen_changed (app->screen, app); - g_object_unref (xml); + g_object_unref (builder); restart: switch (gtk_dialog_run (GTK_DIALOG (app->dialog))) diff --git a/po/POTFILES.in b/po/POTFILES.in index 7b1ad0616..21528f846 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -38,7 +38,7 @@ capplets/default-applications/gnome-at-session.desktop.in.in capplets/default-applications/gnome-da-capplet.c capplets/default-applications/gnome-default-applications-properties.glade capplets/default-applications/gnome-default-applications.xml.in -capplets/display/display-capplet.glade +[type: gettext/glade]capplets/display/display-capplet.ui capplets/display/display-properties.desktop.in.in capplets/display/xrandr-capplet.c capplets/keybindings/00-multimedia-key.xml.in