diff --git a/Makefile.am b/Makefile.am index 4ad3b52..53fdf84 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,10 @@ ## This Makefile.am is free software; the Free Software Foundation ## gives unlimited permission to copy, distribute and modify it. +SUBDIRS = images +EXTRA_DIST = COPYING CREDITS INSTALL NEWS + bin_PROGRAMS = gxkb -gxkb_SOURCES = gxkb.c xkb-callbacks.c xkb-config.c xkb-util.c -gxkb_CFLAGS = @GTK_CFLAGS@ @GLIB_CFLAGS@ @LIBXKLAVIER_CFLAGS@ @LIBWNCK_CFLAGS@ -gxkb_LDFLAGS = @GTK_LIBS@ @GLIB_LIBS@ @LIBXKLAVIER_LIBS@ @LIBWNCK_LIBS@ +gxkb_SOURCES = gxkb.c xkb-callbacks.c xkb-config.c xkb-util.c common.h xkb-callbacks.h xkb-config.h xkb-util.h +gxkb_CFLAGS = @GTK_CFLAGS@ @GLIB_CFLAGS@ @LIBXKLAVIER_CFLAGS@ @LIBWNCK_CFLAGS@ -DFLAGSDIR=\"$(datadir)/gxkb/flags\" +gxkb_LDADD = @GTK_LIBS@ @GLIB_LIBS@ @LIBXKLAVIER_LIBS@ @LIBWNCK_LIBS@ diff --git a/NEWS b/NEWS index 3863374..b6ae679 100644 --- a/NEWS +++ b/NEWS @@ -1,2 +1,11 @@ +March 19 2013: +Version gxkb 0.3 released. + * add left-click menu with keyboard layout options + * add right-click menu with 'exit' and 'about' options + * add icons + March 18 2013: -Version gxkb 2.0 released. +Version gxkb 0.2 released. + +March 11 2013: +Initial code base. \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/TODO b/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/common.h b/common.h index 0687f0f..7e66911 100644 --- a/common.h +++ b/common.h @@ -53,7 +53,8 @@ typedef struct t_xkb_settings *settings; /* per-app setting and default group */ /* widgets */ - GtkWidget *popup; + GtkWidget *lb_mouse_popup; + GtkWidget *rb_mouse_popup; /* */ } t_xkb; diff --git a/configure.ac b/configure.ac index 8816cef..cd575eb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,14 +1,14 @@ -AC_INIT([gxkb], [2.0], [zen@root.ua]) +AC_INIT([gxkb], [0.3], [zen@root.ua]) AM_INIT_AUTOMAKE([-Wall -Werror foreign ]) AC_CONFIG_SRCDIR([gxkb.c]) AC_CONFIG_HEADERS([config.h]) AC_PROG_CC AC_HEADER_STDC PKG_PROG_PKG_CONFIG([0.20]) -PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.24.10]) -PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.32.4]) -PKG_CHECK_MODULES(LIBXKLAVIER, [libxklavier >= 5.2.1]) -PKG_CHECK_MODULES(LIBWNCK, [libwnck-1.0 >= 2.30.7]) +PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.20.0]) +PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.24.0]) +PKG_CHECK_MODULES(LIBXKLAVIER, [libxklavier >= 5.0]) +PKG_CHECK_MODULES(LIBWNCK, [libwnck-1.0 >= 2.30.0]) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) AC_SUBST(GLIB_CFLAGS) @@ -19,13 +19,7 @@ AC_SUBST(LIBWNCK_CFLAGS) AC_SUBST(LIBWNCK_LIBS) AC_DEFINE(WNCK_I_KNOW_THIS_IS_UNSTABLE, 1, [libwnck is happy with this]) AC_DEFINE(HAVE_CONFIG_H,1,[Include config.h]) -if test "x$prefix" = "xNONE" ; then - prefix="/usr/local" -fi -if test "x$exec_prefix" = "xNONE" ; then - exec_prefix=$prefix -fi #AC_CONFIG_FILES([ #Makefile #]) -AC_OUTPUT([Makefile]) \ No newline at end of file +AC_OUTPUT([Makefile images/Makefile]) diff --git a/gxkb.c b/gxkb.c index a3d0d4a..0f9c2a6 100644 --- a/gxkb.c +++ b/gxkb.c @@ -41,8 +41,7 @@ void xkb_initialize_menu (t_xkb *xkb); void xkb_refresh (t_xkb *xkb); -GdkPixbuf * text_to_gtk_pixbuf (t_xkb *xkb, gchar *text); - +void xkb_about (t_xkb *xkb); /* ================================================================== * * Implementation * * ================================================================== */ @@ -80,11 +79,11 @@ xkb_new (GtkStatusIcon *tray) xkb->settings = g_new0 (t_xkb_settings, 1); xkb->tray = tray; - g_signal_connect (G_OBJECT(xkb->tray), "activate", G_CALLBACK (xkb_tray_icon_clicked), xkb); - g_signal_connect (G_OBJECT(xkb->tray), "scroll-event", G_CALLBACK (xkb_tray_icon_scrolled), xkb); + g_signal_connect(G_OBJECT(xkb->tray), "activate", G_CALLBACK (xkb_tray_icon_clicked), xkb); + g_signal_connect(G_OBJECT(xkb->tray), "scroll-event", G_CALLBACK (xkb_tray_icon_scrolled), xkb); g_signal_connect(G_OBJECT(xkb->tray), "popup-menu", G_CALLBACK(xkb_tray_icon_popup_menu), xkb); - wnck_screen = wnck_screen_get_default (); + wnck_screen = wnck_screen_get_default(); g_signal_connect (G_OBJECT (wnck_screen), "active-window-changed", G_CALLBACK (xkb_active_window_changed), xkb); g_signal_connect (G_OBJECT (wnck_screen), "window-closed", @@ -106,7 +105,8 @@ xkb_free (t_xkb *xkb) g_free (xkb->settings); g_object_unref (xkb->tray); - gtk_widget_destroy (xkb->popup); + gtk_widget_destroy (xkb->rb_mouse_popup); + gtk_widget_destroy (xkb->lb_mouse_popup); } void @@ -117,7 +117,7 @@ xkb_save_config (t_xkb *xkb, const gchar *config_file) GKeyFile *cfg_file = g_key_file_new(); g_key_file_set_list_separator (cfg_file, ','); - g_key_file_set_integer(cfg_file, "xkb config", "display_type", xkb->display_type); + //g_key_file_set_integer(cfg_file, "xkb config", "display_type", xkb->display_type); g_key_file_set_integer(cfg_file, "xkb config", "group_policy", xkb->settings->group_policy); g_key_file_set_integer(cfg_file, "xkb config", "default_group", xkb->settings->default_group); g_key_file_set_boolean(cfg_file, "xkb config", "never_modify_config", xkb->settings->never_modify_config); @@ -154,7 +154,7 @@ xkb_load_config (t_xkb *xkb, const gchar *filename) return FALSE; } - xkb->display_type = g_key_file_get_integer(cfg_file, "xkb config", "display_type", &error); + //xkb->display_type = g_key_file_get_integer(cfg_file, "xkb config", "display_type", &error); xkb->settings->group_policy = g_key_file_get_integer(cfg_file, "xkb config", "group_policy", &error); if (xkb->settings->group_policy != GROUP_POLICY_GLOBAL) { @@ -186,7 +186,7 @@ xkb_load_default (t_xkb *xkb) { xkb->settings->kbd_config = g_new0 (t_xkb_kbd_config, 1); } - xkb->display_type = DISPLAY_TYPE_TEXT; + //xkb->display_type = DISPLAY_TYPE_TEXT; xkb->settings->group_policy = GROUP_POLICY_PER_APPLICATION; xkb->settings->never_modify_config = FALSE; xkb->settings->kbd_config->model = g_strdup("pc105"); @@ -199,18 +199,42 @@ xkb_load_default (t_xkb *xkb) void xkb_initialize_menu (t_xkb *xkb) { + if (G_UNLIKELY (xkb == NULL)) return; + + // Right button click menu + GtkWidget *mi; + + if (xkb->rb_mouse_popup) + gtk_widget_destroy (xkb->rb_mouse_popup); + + xkb->rb_mouse_popup = gtk_menu_new(); + + mi = gtk_image_menu_item_new_from_stock(GTK_STOCK_DIALOG_INFO, NULL); + g_signal_connect(G_OBJECT(mi), "activate", (GCallback)xkb_about, NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (xkb->rb_mouse_popup), mi); + gtk_widget_show (mi); + + mi = gtk_menu_item_new (); + gtk_widget_show (mi); + gtk_menu_shell_append (GTK_MENU_SHELL (xkb->rb_mouse_popup), mi); + gtk_widget_set_sensitive (mi, FALSE); + + mi = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL); + g_signal_connect(G_OBJECT(mi), "activate", (GCallback)gtk_main_quit, NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (xkb->rb_mouse_popup), mi); + gtk_widget_show (mi); + + // Left cutton click menu gint i; GdkPixbuf *handle = NULL; - GdkPixbuf *pixbuf; + gchar *imgfilename; GtkWidget *image; GtkWidget *menu_item; - if (G_UNLIKELY (xkb == NULL)) return; + if (xkb->lb_mouse_popup) + gtk_widget_destroy (xkb->lb_mouse_popup); - if (xkb->popup) - gtk_widget_destroy (xkb->popup); - - xkb->popup = gtk_menu_new (); + xkb->lb_mouse_popup = gtk_menu_new (); gint width, height; gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height); @@ -219,12 +243,15 @@ xkb_initialize_menu (t_xkb *xkb) { gchar *layout_string; + imgfilename = xkb_util_get_flag_filename (xkb_config_get_group_name (i)); + handle = gdk_pixbuf_new_from_file_at_scale(imgfilename, width, height, TRUE, NULL); + g_free (imgfilename); + layout_string = xkb_util_get_layout_string (xkb_config_get_group_name (i), xkb_config_get_variant (i)); - layout_string = g_ascii_strup (layout_string, -1); - handle = text_to_gtk_pixbuf(xkb, layout_string); + layout_string = g_ascii_strup (layout_string, -1); menu_item = gtk_image_menu_item_new_with_label (layout_string); g_free (layout_string); @@ -236,90 +263,49 @@ xkb_initialize_menu (t_xkb *xkb) { image = gtk_image_new (); - pixbuf = gdk_pixbuf_scale_simple (handle, width, height, GDK_INTERP_BILINEAR); - - gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf); + gtk_image_set_from_pixbuf (GTK_IMAGE (image), handle); gtk_widget_show (image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image); - g_object_unref (G_OBJECT (pixbuf)); g_object_unref (handle); } gtk_widget_show (menu_item); - gtk_menu_shell_append (GTK_MENU_SHELL (xkb->popup), menu_item); + gtk_menu_shell_append (GTK_MENU_SHELL (xkb->lb_mouse_popup), menu_item); } - - GtkWidget *sep = gtk_separator_menu_item_new(); - gtk_menu_shell_append (GTK_MENU_SHELL (xkb->popup), sep); - gtk_widget_show (sep); - menu_item = gtk_image_menu_item_new_with_label ("Quit"); - - g_signal_connect (G_OBJECT (menu_item), "activate", - G_CALLBACK (gtk_main_quit), NULL); - - image = gtk_image_new_from_stock(GTK_STOCK_QUIT, GTK_ICON_SIZE_MENU); - - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image); - gtk_widget_show (menu_item); - - gtk_menu_shell_append (GTK_MENU_SHELL (xkb->popup), menu_item); } void xkb_refresh(t_xkb *xkb) { - gchar *text = g_ascii_strup(xkb_util_get_layout_string (xkb_config_get_group_name (-1), - xkb_config_get_variant (-1)), -1); - - GdkPixbuf * pixmap = text_to_gtk_pixbuf(xkb, text); - gtk_status_icon_set_from_pixbuf(xkb->tray, pixmap); + gchar *text = xkb_util_get_layout_string (xkb_config_get_group_name (-1), + xkb_config_get_variant (-1)); + gchar *filepath = xkb_util_get_flag_filename(text); g_free(text); -} - -GdkPixbuf * -text_to_gtk_pixbuf(t_xkb *xkb, gchar *text) -{ - GtkWidget *scratch = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_realize (scratch); - PangoLayout *layout = gtk_widget_create_pango_layout (scratch, NULL); - gtk_widget_destroy (scratch); - - gchar *markup = g_strdup_printf ("%s", text); - pango_layout_set_markup (layout, markup, -1); - g_free (markup); - - int width = 0; - int heigth = 0; - pango_layout_get_size (layout, &width, &heigth); - - // offset for draw label centered - int woffset = (width/PANGO_SCALE+4)/2-(width/PANGO_SCALE)/2; - int hoffset = (width/PANGO_SCALE+4)/2-(width/PANGO_SCALE)/2; - - width = width/PANGO_SCALE+4; - heigth = heigth/PANGO_SCALE+4; - GdkPixbuf *pb = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, heigth); + GdkPixbuf * pixmap = gdk_pixbuf_new_from_file_at_size(filepath, 24, 24, NULL); - gdk_pixbuf_fill(pb, 0xffffffff); + if (!pixmap) + return; - GdkPixmap *pm = gdk_pixmap_new (NULL, width, heigth, 24); - GdkGC *gc = gdk_gc_new (pm); - gdk_draw_pixbuf (pm, gc, pb, 0, 0, 0, 0, width, heigth, GDK_RGB_DITHER_NONE, 0, 0); - - gdk_draw_layout (pm, gc, woffset, hoffset, layout); - - - g_object_unref(layout); - gdk_gc_unref(gc); + gtk_status_icon_set_from_pixbuf(xkb->tray, pixmap); +} - GdkPixbuf *ret = gdk_pixbuf_get_from_drawable (NULL, pm, NULL, 0, 0, 0, 0, width, heigth); - g_object_unref(pm); - g_object_unref(pb); - return ret; +void +xkb_about(t_xkb *xkb) +{ + GtkWidget *about_dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s\nX11 Keyboard switcher\nAuthor: Dmitriy Poltavchenko <%s>", PACKAGE_STRING, PACKAGE_BUGREPORT); + /* Destroy the dialog when the user responds to it (e.g. clicks a button) */ + g_signal_connect_swapped (about_dialog, "response", + G_CALLBACK (gtk_widget_hide), + about_dialog); + gtk_widget_show (about_dialog); } int main (int argc, char *argv[]) @@ -357,7 +343,7 @@ int main (int argc, char *argv[]) if (xkb_config_initialize (xkb->settings, xkb_state_changed, xkb)) { - xkb_config_update_settings(xkb->settings); + //xkb_config_update_settings(xkb->settings); xkb_refresh(xkb); xkb_initialize_menu (xkb); } @@ -375,3 +361,5 @@ int main (int argc, char *argv[]) return 0; } + + diff --git a/images/Makefile.am b/images/Makefile.am new file mode 100644 index 0000000..65ba1b1 --- /dev/null +++ b/images/Makefile.am @@ -0,0 +1,37 @@ +imagesdir = @datarootdir@/gxkb/flags +images_DATA = \ + am.png \ + bg.png \ + by.png \ + cz.png \ + de.png \ + ee.png \ + gb.png \ + es.png \ + fi.png \ + fr.png \ + ge.png \ + gr.png \ + hr.png \ + hu.png \ + is.png \ + it.png \ + kz.png \ + lt.png \ + lv.png \ + no.png \ + pl.png \ + pt.png \ + ro.png \ + ru.png \ + se.png \ + si.png \ + sk.png \ + sr.png \ + ua.png \ + us.png \ + uz.png \ + zz.png + + +EXTRA_DIST = $(images_DATA) diff --git a/images/am.png b/images/am.png new file mode 100644 index 0000000..cda5bf4 Binary files /dev/null and b/images/am.png differ diff --git a/images/bg.png b/images/bg.png new file mode 100644 index 0000000..53c2146 Binary files /dev/null and b/images/bg.png differ diff --git a/images/by.png b/images/by.png new file mode 100644 index 0000000..38fb092 Binary files /dev/null and b/images/by.png differ diff --git a/images/cz.png b/images/cz.png new file mode 100644 index 0000000..cf85d7b Binary files /dev/null and b/images/cz.png differ diff --git a/images/de.png b/images/de.png new file mode 100644 index 0000000..574cd68 Binary files /dev/null and b/images/de.png differ diff --git a/images/ee.png b/images/ee.png new file mode 100644 index 0000000..21ae08f Binary files /dev/null and b/images/ee.png differ diff --git a/images/es.png b/images/es.png new file mode 100644 index 0000000..37f7397 Binary files /dev/null and b/images/es.png differ diff --git a/images/fi.png b/images/fi.png new file mode 100644 index 0000000..35709bd Binary files /dev/null and b/images/fi.png differ diff --git a/images/fr.png b/images/fr.png new file mode 100644 index 0000000..1f6af6b Binary files /dev/null and b/images/fr.png differ diff --git a/images/gb.png b/images/gb.png new file mode 100644 index 0000000..6d19609 Binary files /dev/null and b/images/gb.png differ diff --git a/images/ge.png b/images/ge.png new file mode 100644 index 0000000..d74e97e Binary files /dev/null and b/images/ge.png differ diff --git a/images/gr.png b/images/gr.png new file mode 100644 index 0000000..e7f9eca Binary files /dev/null and b/images/gr.png differ diff --git a/images/hr.png b/images/hr.png new file mode 100644 index 0000000..26ed85e Binary files /dev/null and b/images/hr.png differ diff --git a/images/hu.png b/images/hu.png new file mode 100644 index 0000000..43d0412 Binary files /dev/null and b/images/hu.png differ diff --git a/images/is.png b/images/is.png new file mode 100644 index 0000000..5a42b36 Binary files /dev/null and b/images/is.png differ diff --git a/images/it.png b/images/it.png new file mode 100644 index 0000000..566d6f5 Binary files /dev/null and b/images/it.png differ diff --git a/images/kz.png b/images/kz.png new file mode 100644 index 0000000..b04e9c9 Binary files /dev/null and b/images/kz.png differ diff --git a/images/lt.png b/images/lt.png new file mode 100644 index 0000000..04a441e Binary files /dev/null and b/images/lt.png differ diff --git a/images/lv.png b/images/lv.png new file mode 100644 index 0000000..e73d05c Binary files /dev/null and b/images/lv.png differ diff --git a/images/no.png b/images/no.png new file mode 100644 index 0000000..845391d Binary files /dev/null and b/images/no.png differ diff --git a/images/pl.png b/images/pl.png new file mode 100644 index 0000000..76dce10 Binary files /dev/null and b/images/pl.png differ diff --git a/images/pt.png b/images/pt.png new file mode 100644 index 0000000..69da10b Binary files /dev/null and b/images/pt.png differ diff --git a/images/ro.png b/images/ro.png new file mode 100644 index 0000000..9e7d80c Binary files /dev/null and b/images/ro.png differ diff --git a/images/ru.png b/images/ru.png new file mode 100644 index 0000000..0ba5741 Binary files /dev/null and b/images/ru.png differ diff --git a/images/se.png b/images/se.png new file mode 100644 index 0000000..e32a4f0 Binary files /dev/null and b/images/se.png differ diff --git a/images/si.png b/images/si.png new file mode 100644 index 0000000..ebc69ec Binary files /dev/null and b/images/si.png differ diff --git a/images/sk.png b/images/sk.png new file mode 100644 index 0000000..d00b38e Binary files /dev/null and b/images/sk.png differ diff --git a/images/sr.png b/images/sr.png new file mode 100644 index 0000000..788f284 Binary files /dev/null and b/images/sr.png differ diff --git a/images/ua.png b/images/ua.png new file mode 100644 index 0000000..e114e77 Binary files /dev/null and b/images/ua.png differ diff --git a/images/us.png b/images/us.png new file mode 100644 index 0000000..e3e5580 Binary files /dev/null and b/images/us.png differ diff --git a/images/uz.png b/images/uz.png new file mode 100644 index 0000000..b34939f Binary files /dev/null and b/images/uz.png differ diff --git a/images/zz.png b/images/zz.png new file mode 100644 index 0000000..0b02d82 Binary files /dev/null and b/images/zz.png differ diff --git a/xkb-callbacks.c b/xkb-callbacks.c index 993f393..3a20c91 100644 --- a/xkb-callbacks.c +++ b/xkb-callbacks.c @@ -5,12 +5,6 @@ * * Copyright (C) 2008 Alexander Iliev * - * Parts of this program comes from the XfKC tool: - * Copyright (C) 2006 Gauvain Pocentek - * - * A part of this file comes from the gnome keyboard capplet (control-center): - * Copyright (C) 2003 Sergey V. Oudaltsov - * * 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, or (at your option) @@ -70,10 +64,19 @@ xkb_window_closed (WnckScreen *screen, } void -xkb_tray_icon_clicked (GtkStatusIcon *btn, - gpointer data) +xkb_tray_icon_clicked (GtkStatusIcon *status_icon, gpointer data) { - xkb_config_next_group (); + if (xkb_config_get_group_count () > 2) + { + t_xkb *xkb = (t_xkb *) data; + gtk_menu_popup(GTK_MENU (xkb->lb_mouse_popup), + NULL, NULL, gtk_status_icon_position_menu, status_icon, + 0, gtk_get_current_event_time ()); + } + else + { + xkb_config_next_group (); + } } gboolean @@ -103,7 +106,7 @@ xkb_tray_icon_popup_menu (GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer data) { t_xkb *xkb = (t_xkb *) data; - gtk_menu_popup (GTK_MENU (xkb->popup), + gtk_menu_popup (GTK_MENU (xkb->rb_mouse_popup), NULL, NULL, gtk_status_icon_position_menu, status_icon, button, activate_time); } diff --git a/xkb-callbacks.h b/xkb-callbacks.h index e4e0c11..2df6452 100644 --- a/xkb-callbacks.h +++ b/xkb-callbacks.h @@ -5,12 +5,6 @@ * * Copyright (C) 2008 Alexander Iliev * - * Parts of this program comes from the XfKC tool: - * Copyright (C) 2006 Gauvain Pocentek - * - * A part of this file comes from the gnome keyboard capplet (control-center): - * Copyright (C) 2003 Sergey V. Oudaltsov - * * 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, or (at your option) @@ -53,15 +47,15 @@ void xkb_window_closed (WnckScreen *screen, WnckWindow *window, t_xkb *xkb); -void xkb_tray_icon_popup_menu (GtkStatusIcon *status_icon, guint button, - guint activate_time, gpointer data); +void xkb_tray_icon_clicked (GtkStatusIcon *status_icon, gpointer data); -void xkb_tray_icon_clicked (GtkStatusIcon *btn, - gpointer data); gboolean xkb_tray_icon_scrolled (GtkStatusIcon *btn, GdkEventScroll *event, gpointer data); +void xkb_tray_icon_popup_menu (GtkStatusIcon *status_icon, guint button, + guint activate_time, gpointer data); + #endif diff --git a/xkb-config.c b/xkb-config.c index 81e468a..b28a191 100644 --- a/xkb-config.c +++ b/xkb-config.c @@ -5,12 +5,6 @@ * * Copyright (C) 2008 Alexander Iliev * - * Parts of this program comes from the XfKC tool: - * Copyright (C) 2006 Gauvain Pocentek - * - * A part of this file comes from the gnome keyboard capplet (control-center): - * Copyright (C) 2003 Sergey V. Oudaltsov - * * 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, or (at your option) diff --git a/xkb-config.h b/xkb-config.h index f79fb34..0202cb3 100644 --- a/xkb-config.h +++ b/xkb-config.h @@ -5,12 +5,6 @@ * * Copyright (C) 2008 Alexander Iliev * - * Parts of this program comes from the XfKC tool: - * Copyright (C) 2006 Gauvain Pocentek - * - * A part of this file comes from the gnome keyboard capplet (control-center): - * Copyright (C) 2003 Sergey V. Oudaltsov - * * 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, or (at your option) diff --git a/xkb-util.c b/xkb-util.c index d21662b..fe0cce6 100644 --- a/xkb-util.c +++ b/xkb-util.c @@ -5,12 +5,6 @@ * * Copyright (C) 2008 Alexander Iliev * - * Parts of this program comes from the XfKC tool: - * Copyright (C) 2006 Gauvain Pocentek - * - * A part of this file comes from the gnome keyboard capplet (control-center): - * Copyright (C) 2003 Sergey V. Oudaltsov - * * 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, or (at your option) @@ -30,7 +24,6 @@ #include "xkb-util.h" - gchar* xkb_util_get_flag_filename (const gchar* group_name) { @@ -39,7 +32,14 @@ xkb_util_get_flag_filename (const gchar* group_name) if (!group_name) return NULL; - filename = g_strconcat (IMGPREFIX, "/", g_ascii_strdown(group_name, -1), ".png", NULL); + filename = g_strconcat (FLAGSDIR, "/", g_ascii_strdown(group_name, -1), ".png", NULL); + + if (!g_file_test(filename, G_FILE_TEST_EXISTS)) + { + filename = g_strconcat (FLAGSDIR, "/", "zz.png", NULL); + if (!g_file_test(filename, G_FILE_TEST_EXISTS)) + return NULL; + } return filename; } diff --git a/xkb-util.h b/xkb-util.h index 9e4d109..325d3dd 100644 --- a/xkb-util.h +++ b/xkb-util.h @@ -5,12 +5,6 @@ * * Copyright (C) 2008 Alexander Iliev * - * Parts of this program comes from the XfKC tool: - * Copyright (C) 2006 Gauvain Pocentek - * - * A part of this file comes from the gnome keyboard capplet (control-center): - * Copyright (C) 2003 Sergey V. Oudaltsov - * * 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, or (at your option) @@ -33,9 +27,6 @@ # include "config.h" #endif -#define PREFIX "." -#define IMGPREFIX PREFIX "/images" - #include #include #include