Skip to content

Commit

Permalink
Version 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ZEN committed Dec 15, 2015
1 parent 9935608 commit 7a8d007
Show file tree
Hide file tree
Showing 39 changed files with 79 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## gives unlimited permission to copy, distribute and modify it.

SUBDIRS = images
EXTRA_DIST = COPYING CREDITS INSTALL NEWS
EXTRA_DIST = COPYING CREDITS INSTALL NEWS TODO

bin_PROGRAMS = gxkb
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_CFLAGS = -O2 @GTK_CFLAGS@ @GLIB_CFLAGS@ @LIBXKLAVIER_CFLAGS@ @LIBWNCK_CFLAGS@ -DFLAGSDIR=\"$(datadir)/gxkb/flags\"
gxkb_LDADD = @GTK_LIBS@ @GLIB_LIBS@ @LIBXKLAVIER_LIBS@ @LIBWNCK_LIBS@
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
March 28 2013:
Version gxkb 0.5 released.
* reduced dependence
* fixed size of image flags layout

March 24 2013:
Version gxkb 0.4 released.
* fixed bug in search of the flags when specified any keyboard option
Expand Down
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Check the behavior of the layout with xterm in FreeBSD
2 changes: 2 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ typedef struct
t_display_type display_type; /* display layout as image ot text */
t_xkb_settings *settings; /* per-app setting and default group */

gchar *filename;

/* widgets */
GtkWidget *lb_mouse_popup;
GtkWidget *rb_mouse_popup;
Expand Down
3 changes: 3 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the home page for this package. */
#undef PACKAGE_URL

/* Define to the version of this package. */
#undef PACKAGE_VERSION

Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([gxkb], [0.4.1], [zen@root.ua])
AC_INIT([gxkb], [0.5], [zen@root.ua])
AM_INIT_AUTOMAKE([-Wall -Werror foreign ])
AC_CONFIG_SRCDIR([gxkb.c])
AC_CONFIG_HEADERS([config.h])
Expand All @@ -21,4 +21,5 @@ LIBXKLAVIER_VERSION=`pkg-config --modversion libxklavier | sed 's/\.//;s/\..*//g
AC_DEFINE_UNQUOTED(LIBXKLAVIER_VERSION, ${LIBXKLAVIER_VERSION}, [libxklavier version])
AC_DEFINE(WNCK_I_KNOW_THIS_IS_UNSTABLE, 1, [libwnck is happy with this])
AC_DEFINE(HAVE_CONFIG_H,1,[Include config.h])
AC_PREFIX_DEFAULT(/usr)
AC_OUTPUT([Makefile images/Makefile])
94 changes: 64 additions & 30 deletions gxkb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
*/
#include <stdlib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <libxklavier/xklavier.h>
#include <libwnck/libwnck.h>
#include <getopt.h>
#include "common.h"
#include "xkb-config.h"
#include "xkb-util.h"
Expand All @@ -21,13 +23,13 @@
* ----------------------------------------------------------------- */

void xkb_state_changed (gint current_group,
gboolean config_changed,
gpointer user_data);
gboolean config_changed,
gpointer user_data);

void xkb_set_group (GtkStatusIcon *item,
gpointer data);
gpointer data);

t_xkb * xkb_new (GtkStatusIcon *plugin);
t_xkb * xkb_new ();

void xkb_free (t_xkb *xkb);

Expand Down Expand Up @@ -69,15 +71,15 @@ xkb_set_group (GtkStatusIcon *item,
}

t_xkb *
xkb_new (GtkStatusIcon *tray)
xkb_new ()
{
t_xkb *xkb;
WnckScreen *wnck_screen;

xkb = g_slice_new0 (t_xkb);
xkb->settings = NULL;
xkb->settings = g_new0 (t_xkb_settings, 1);
xkb->tray = tray;
xkb->tray = gtk_status_icon_new();

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);
Expand Down Expand Up @@ -147,33 +149,32 @@ xkb_save_config (t_xkb *xkb, const gchar *config_file)
gboolean
xkb_load_config (t_xkb *xkb, const gchar *filename)
{
GError *error = NULL;
GKeyFile *cfg_file = g_key_file_new();
if (!g_key_file_load_from_file(cfg_file, filename, G_KEY_FILE_KEEP_COMMENTS, &error))
if (!g_key_file_load_from_file(cfg_file, filename, G_KEY_FILE_KEEP_COMMENTS, NULL))
{
g_key_file_free(cfg_file);
return FALSE;
}

//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);
//xkb->display_type = g_key_file_get_integer(cfg_file, "xkb config", "display_type", NULL);
xkb->settings->group_policy = g_key_file_get_integer(cfg_file, "xkb config", "group_policy", NULL);
if (xkb->settings->group_policy != GROUP_POLICY_GLOBAL)
{
xkb->settings->default_group = g_key_file_get_integer(cfg_file, "xkb config", "default_group", &error);
xkb->settings->default_group = g_key_file_get_integer(cfg_file, "xkb config", "default_group", NULL);
}

xkb->settings->never_modify_config = g_key_file_get_boolean(cfg_file, "xkb config", "never_modify_config", &error);
xkb->settings->never_modify_config = g_key_file_get_boolean(cfg_file, "xkb config", "never_modify_config", NULL);

if (xkb->settings->kbd_config == NULL)
{
xkb->settings->kbd_config = g_new0 (t_xkb_kbd_config, 1);
}

xkb->settings->kbd_config->model = g_key_file_get_string(cfg_file, "xkb config", "model", &error);
xkb->settings->kbd_config->layouts = g_key_file_get_string(cfg_file, "xkb config", "layouts", &error);
xkb->settings->kbd_config->variants = g_key_file_get_string(cfg_file, "xkb config", "variants", &error);
xkb->settings->kbd_config->toggle_option = g_key_file_get_string(cfg_file, "xkb config", "toggle_option", &error);
xkb->settings->kbd_config->compose_key_position = g_key_file_get_string(cfg_file, "xkb config", "compose_key_position", &error);
xkb->settings->kbd_config->model = g_key_file_get_string(cfg_file, "xkb config", "model", NULL);
xkb->settings->kbd_config->layouts = g_key_file_get_string(cfg_file, "xkb config", "layouts", NULL);
xkb->settings->kbd_config->variants = g_key_file_get_string(cfg_file, "xkb config", "variants", NULL);
xkb->settings->kbd_config->toggle_option = g_key_file_get_string(cfg_file, "xkb config", "toggle_option", NULL);
xkb->settings->kbd_config->compose_key_position = g_key_file_get_string(cfg_file, "xkb config", "compose_key_position", NULL);

g_key_file_free(cfg_file);

Expand Down Expand Up @@ -283,29 +284,29 @@ xkb_refresh(t_xkb *xkb)
gchar *text = g_strdup(xkb_config_get_group_name (-1));
gchar *filepath = g_strdup(xkb_util_get_flag_filename(text));

GdkPixbuf * pixmap = gdk_pixbuf_new_from_file_at_size(filepath, 24, 24, NULL);
GdkPixbuf * pixmap = gdk_pixbuf_new_from_file_at_scale(filepath, 24, 24, FALSE, NULL);

g_free(text);
g_free(filepath);

if (!pixmap)
return;

gtk_status_icon_set_from_pixbuf(xkb->tray, pixmap);
gtk_status_icon_set_from_pixbuf(xkb->tray, pixmap);
}

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_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);
}

Expand All @@ -317,10 +318,42 @@ int main (int argc, char *argv[])
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
g_set_application_name ("gxkb");

GtkStatusIcon *tray_icon;
tray_icon = gtk_status_icon_new();
const struct option longopts[] =
{
{0, 0, 0, 'v'},
{0, 0, 0, 'h'},
{0, 0, 0, 0 },
};

int index;
int iarg=0;

//turn off getopt error message
opterr=0;

while(iarg != -1)
{
iarg = getopt_long(argc, argv, "s:vh", longopts, &index);

switch (iarg)
{
case 'v':
g_fprintf(stderr, "%s version %s\n", PACKAGE_TARNAME, PACKAGE_VERSION);
return 0;
break;

case 'h':
g_fprintf(stderr, "%s\n\n%s\n%s\n%s\n",
"Usage: gxkb [arguments]",
"Options:",
"-v, \t Display gxkb's version number.",
"-h, \t Show this help.");
return 0;
break;
}
}

t_xkb *xkb = xkb_new (tray_icon);
t_xkb *xkb = xkb_new ();

char *config_path = (g_getenv("XDG_CONFIG_HOME") == NULL
? g_build_filename(g_get_home_dir(), ".config", NULL)
Expand All @@ -339,6 +372,7 @@ int main (int argc, char *argv[])
if(!xkb_load_config(xkb, config_file))
{
xkb_load_default(xkb);
xkb_save_config(xkb, config_file);
}
}

Expand Down
Binary file modified images/am.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/by.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/cz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/de.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/es.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/fi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/fr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/hr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/hu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/is.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/it.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/kz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/lt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/lv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/no.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/pl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ru.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/se.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/si.png
Binary file modified images/sk.png
Binary file modified images/sr.png
Binary file modified images/ua.png
Binary file modified images/us.png
Binary file modified images/uz.png
Binary file modified images/zz.png

0 comments on commit 7a8d007

Please sign in to comment.