1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
|
From: Author: Yavor Doganov <yavor@gnu.org>
Date: Tue, 09 Oct 2018 21:55:28 +0300
Subject: Avoid libgnome(ui) dependency.
This patch also fixes the window and about dialog icon.
Bug-Debian: https://bugs.debian.org/868427
Forwarded: no
---
configure.ac | 10 +---------
src/Makefile.am | 4 ++--
src/btnbox.c | 20 +++++++++-----------
src/btnbox.h | 1 +
src/global.h | 2 ++
src/main.c | 34 +++++++++++++++++++++++++++++-----
src/main.h | 2 +-
src/options.c | 16 ++++++++++++----
src/options.h | 1 -
src/rdpparse.c | 13 +++++--------
src/run.c | 4 ++--
src/srvsel.h | 1 +
src/sshbox.h | 2 +-
13 files changed, 66 insertions(+), 44 deletions(-)
diff --git a/configure.ac b/configure.ac
index 288a2db..bec12c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,21 +46,13 @@ GETTEXT_PACKAGE=$PACKAGE
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [gettext domain])
dnl Searching for GTK+ 2 includes/libs and export compiler flags
-PKG_CHECK_MODULES(GTK2, gtk+-2.0, HAVE_GTK=yes, HAVE_GTK=no)
+PKG_CHECK_MODULES(GTK2, [gtk+-2.0 gconf-2.0], HAVE_GTK=yes, HAVE_GTK=no)
if test "$HAVE_GTK" = "no"; then
AC_MSG_ERROR([cannot find GTK+ 2.0!])
fi
AC_SUBST(GTK2_CFLAGS)
AC_SUBST(GTK2_LIBS)
-dnl Searching for GNOME 2 includes/libs and export compiler flags
-PKG_CHECK_MODULES(GNOME2, libgnomeui-2.0, HAVE_GNOME2=yes, HAVE_GNOME2=no)
-if test "$HAVE_GNOME2" = "no"; then
- AC_MSG_ERROR([cannot find GNOME2 2.0!])
-fi
-AC_SUBST(GNOME2_CFLAGS)
-AC_SUBST(GNOME2_LIBS)
-
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
if test "$GCONFTOOL" = "no"; then
AC_MSG_ERROR([cannot find gconf 2.0!])
diff --git a/src/Makefile.am b/src/Makefile.am
index 0990bd7..05c45dc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,7 @@ bin_PROGRAMS = grdesktop
INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
-I$(top_srcdir)/intl \
- $(GTK2_CFLAGS) $(GNOME2_CFLAGS) \
+ $(GTK2_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
-DLOCALEDIR=\""$(datadir)/locale"\" \
-DKBPATH=\""$(kbpath)"\"
@@ -39,7 +39,7 @@ grdesktop_SOURCES = main.c main.h \
sshbox.c sshbox.h \
config.h
-grdesktop_LDADD = $(GTK2_LIBS) $(GNOME2_LIBS)
+grdesktop_LDADD = $(GTK2_LIBS)
grdesktopdir = $(datadir)/applications
grdesktop_DATA = grdesktop.desktop
diff --git a/src/btnbox.c b/src/btnbox.c
index cb06887..4d633dd 100644
--- a/src/btnbox.c
+++ b/src/btnbox.c
@@ -69,12 +69,12 @@ GtkWidget *button_box() {
void sig_connect(GtkWidget *widget, gpointer data) {
/* stop, if box is empty */
if(SHASH("hostname") == NULL) {
- gnome_error_dialog(
+ error_dialog(
_("Please select or insert a valid hostname/ip-address!"));
return;
}
if(strlen(SHASH("hostname")) <= 0) {
- gnome_error_dialog(
+ error_dialog(
_("Please select or insert a valid hostname/ip-address!"));
return;
}
@@ -94,16 +94,14 @@ void sig_cancel(GtkWidget *widget, gpointer data) {
}
void sig_about(GtkWidget *widget, gpointer data) {
- GtkWidget *about = NULL;
gchar *authors[] = { "Thorsten Sauter <tsauter@gmx.net>", NULL };
- about = gnome_about_new(_("Remotedesktop Client"), VERSION,
- _("(C) 2002-2004 Thorsten Sauter"),
- _("Gnome frontend for rdesktop"),
- (const char**)authors, NULL, NULL, NULL);
- gtk_signal_connect(GTK_OBJECT(about), "destroy",
- GTK_SIGNAL_FUNC(gtk_widget_destroy), &about);
- gtk_widget_show(about);
+ gtk_show_about_dialog(GTK_WINDOW(window_main),
+ "program-name", _("Remotedesktop Client"),
+ "version", VERSION,
+ "copyright", _("(C) 2002-2004 Thorsten Sauter"),
+ "comments", _("Gnome frontend for rdesktop"),
+ "authors", authors, NULL);
}
void sig_options(GtkWidget *widget, gpointer data) {
@@ -123,7 +121,7 @@ void sig_options(GtkWidget *widget, gpointer data) {
void sig_help(GtkWidget *widget, gpointer data) {
GError *err = NULL;
- gnome_help_display(PACKAGE, NULL, &err);
+ gtk_show_uri(NULL, "ghelp:"PACKAGE, GDK_CURRENT_TIME, &err);
if(err != NULL) {
GtkWidget *dlg = NULL;
diff --git a/src/btnbox.h b/src/btnbox.h
index 0d7bf63..08894ec 100644
--- a/src/btnbox.h
+++ b/src/btnbox.h
@@ -23,6 +23,7 @@
#ifndef __BTNBOX_H__
#define __BTNBOX_H__
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "config.h"
#include "global.h"
diff --git a/src/global.h b/src/global.h
index 8bae28b..283b84f 100644
--- a/src/global.h
+++ b/src/global.h
@@ -111,5 +111,7 @@ GtkWidget *combo_clientname;
GtkWidget *check_sshopts;
GtkWidget *btn_sshopts;
+void error_dialog(gchar *msg, ...);
+
#endif /* __CONFIG_H__ */
diff --git a/src/main.c b/src/main.c
index 57fad21..f6630f8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -22,6 +22,25 @@
#include "main.h"
+void error_dialog(gchar *msg, ...) {
+ GtkWidget *dlg;
+ gchar *dlg_msg;
+ va_list ap;
+
+ va_start(ap, msg);
+ dlg_msg = g_strdup_vprintf(msg, ap);
+ va_end(ap);
+
+ dlg = gtk_message_dialog_new(GTK_WINDOW(window_main),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", dlg_msg);
+ gtk_dialog_run (GTK_DIALOG(dlg));
+ gtk_widget_destroy(dlg);
+ g_free(dlg_msg);
+}
+
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
return(FALSE);
}
@@ -41,7 +60,7 @@ int make_gui(gchar *rdpfile) {
GtkWidget *btnBox;
GdkPixbufAnimation *animation;
- window_main = gnome_app_new("grdesktop", _("Remotedesktop Client"));
+ window_main = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_wmclass(GTK_WINDOW(window_main),
"grdesktop", "grdesktop");
gtk_container_set_border_width(GTK_CONTAINER(window_main), 0);
@@ -55,7 +74,7 @@ int make_gui(gchar *rdpfile) {
G_CALLBACK(destroy), NULL);
winBox = gtk_vbox_new(FALSE, 0);
- gnome_app_set_contents(GNOME_APP(window_main), winBox);
+ gtk_container_add(GTK_CONTAINER(window_main), winBox);
gtk_widget_show(winBox);
/* display the topic image */
@@ -141,6 +160,7 @@ int main(int argc, char *argv[]) {
gboolean opt_usage = FALSE;
gboolean opt_version = FALSE;
gboolean opt_start = FALSE;
+ gchar *dir, *icon;
#ifdef ENABLE_NLS
if(setlocale(LC_ALL, "") == NULL)
@@ -150,9 +170,13 @@ int main(int argc, char *argv[]) {
textdomain(PACKAGE);
#endif
- gnome_program_init("grdesktop", VERSION, LIBGNOMEUI_MODULE,
- argc, argv, GNOME_PARAM_APP_DATADIR, DATADIR, NULL);
- gnome_window_icon_set_default_from_file(DATADIR"/grdesktop.png");
+ gtk_init(&argc, &argv);
+ dir = g_build_path(G_DIR_SEPARATOR_S, DATADIR, "pixmaps",
+ "grdesktop", NULL);
+ icon = g_build_filename(dir, "icon.png", NULL);
+ gtk_window_set_default_icon_from_file(icon, NULL);
+ g_free(dir);
+ g_free(icon);
gconf_init(argc, argv, NULL);
gcfg = gconf_client_get_default();
diff --git a/src/main.h b/src/main.h
index c868bb5..f3b2c7b 100644
--- a/src/main.h
+++ b/src/main.h
@@ -24,8 +24,8 @@
#define __MAIN_H__
#include "config.h"
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <gnome.h>
#include <stdlib.h>
#include <stdio.h>
#include <libintl.h>
diff --git a/src/options.c b/src/options.c
index d887bb3..4ed5051 100644
--- a/src/options.c
+++ b/src/options.c
@@ -136,9 +136,16 @@ void loadKeymap(GtkListStore *model) {
/* fill the list */
kbdir = opendir(KBPATH);
if(kbdir == NULL) {
- gnome_warning_dialog(g_strdup_printf(
- _("Unable to find keyboard definitions: %s"),
- KBPATH));
+ GtkWidget *dlg;
+
+ dlg = gtk_message_dialog_new(GTK_WINDOW(window_main),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CLOSE,
+ _("Unable to find keyboard "
+ "definitions: %s"), KBPATH);
+ gtk_dialog_run(GTK_DIALOG(dlg));
+ gtk_widget_destroy(dlg);
}
if(kbdir != NULL) {
@@ -494,7 +501,7 @@ void fill_dialog() {
iSHASH("usessh"));
gtk_widget_set_sensitive(btn_sshopts, iSHASH("usessh"));
- licence_path = gnome_util_prepend_user_home(".rdesktop");
+ licence_path = g_build_filename(g_get_home_dir(), ".rdesktop", NULL);
licence_dir = opendir(licence_path);
if(licence_dir != NULL) {
struct dirent *entry = NULL;
@@ -520,6 +527,7 @@ void fill_dialog() {
licence_list = g_list_append(licence_list, g_strdup(hostname));
}
closedir(licence_dir);
+ g_free(licence_path);
if(licence_list != NULL) {
gtk_combo_set_popdown_strings(GTK_COMBO(combo_clientname),
licence_list);
diff --git a/src/options.h b/src/options.h
index f1164e7..9877f51 100644
--- a/src/options.h
+++ b/src/options.h
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
-#include <gnome.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/src/rdpparse.c b/src/rdpparse.c
index 82983b2..5561e5a 100644
--- a/src/rdpparse.c
+++ b/src/rdpparse.c
@@ -30,7 +30,7 @@ void sig_file_open(GtkWidget *widget, gpointer data) {
filesel = GTK_FILE_SELECTION(data);
filename = g_strdup(gtk_file_selection_get_filename(filesel));
if(filename[strlen(filename)-1] == '/') {
- gnome_error_dialog(_("Please select a valid rdp file!"));
+ error_dialog(_("Please select a valid rdp file!"));
sig_loadbtn(widget, NULL);
return;
}
@@ -47,7 +47,7 @@ void sig_file_save(GtkWidget *widget, gpointer data) {
filesel = GTK_FILE_SELECTION(data);
filename = g_strdup(gtk_file_selection_get_filename(filesel));
if(filename[strlen(filename)-1] == '/') {
- gnome_error_dialog(_("Please select a valid rdp file!"));
+ error_dialog(_("Please select a valid rdp file!"));
sig_savebtn(widget, NULL);
return;
}
@@ -74,8 +74,7 @@ void sig_file_save(GtkWidget *widget, gpointer data) {
file = fopen(filename, "w");
if(file == NULL) {
- gnome_error_dialog(g_strdup_printf(_("Unable to save rdp-file: %s"),
- filename));
+ error_dialog(_("Unable to save rdp-file: %s"), filename);
return;
}
@@ -135,15 +134,13 @@ gint parse_file(gchar *filename) {
gint i, ch;
if(!g_file_test(filename, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_REGULAR)) {
- gnome_error_dialog(g_strdup_printf(_("Unable to open rdp-file: %s"),
- filename));
+ error_dialog(_("Unable to open rdp-file: %s"), filename);
return(1);
}
file = fopen(filename, "r");
if(file == NULL) {
- gnome_error_dialog(g_strdup_printf(_("Unable to open rdp-file: %s"),
- filename));
+ error_dialog(_("Unable to open rdp-file: %s"), filename);
return(1);
}
diff --git a/src/run.c b/src/run.c
index 080409d..a97b0ad 100644
--- a/src/run.c
+++ b/src/run.c
@@ -98,7 +98,7 @@ void run_rdesktop() {
#endif
if(!SHASH("sshhost") || strlen(SHASH("sshhost")) <= 0) {
- gnome_error_dialog(_("No hostname for ssh tunneling available"));
+ error_dialog(_("No hostname for ssh tunneling available"));
return;
}
@@ -131,7 +131,7 @@ void run_rdesktop() {
loadServers(); /* make sure, we reload the available servers */
if((ret != TRUE) || (estatus != 0)) {
- gnome_error_dialog(std_err);
+ error_dialog(std_err);
return;
}
diff --git a/src/srvsel.h b/src/srvsel.h
index 9e577a1..5710093 100644
--- a/src/srvsel.h
+++ b/src/srvsel.h
@@ -23,6 +23,7 @@
#ifndef __SRVSEL_H__
#define __SRVSEL_H__
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/src/sshbox.h b/src/sshbox.h
index f030b5f..05bd94a 100644
--- a/src/sshbox.h
+++ b/src/sshbox.h
@@ -23,8 +23,8 @@
#ifndef __SSHBOX_H__
#define __SSHBOX_H__
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <gnome.h>
#include "config.h"
#include "global.h"
|