ede-autostart will use warning icon from icon theme.

Apply keyboard settings at ede startup.
Do not change keyboard layout if it is the same as previous.
This commit is contained in:
Sanel Zukan 2009-11-16 11:40:52 +00:00
parent cc9725582c
commit 94fb06d386
4 changed files with 40 additions and 350 deletions

View File

@ -19,12 +19,10 @@
#include <stdio.h>
#include <unistd.h>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl.H>
#include <FL/Fl_Check_Browser.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl.H>
#include <edelib/String.h>
#include <edelib/StrUtil.h>
@ -37,11 +35,13 @@
#include <edelib/Run.h>
#include <edelib/FileTest.h>
#include <edelib/MessageBox.h>
#include <edelib/Window.h>
#include <edelib/IconLoader.h>
#include "icons/warning.xpm"
EDELIB_NS_USING_AS(Window, AppWindow)
EDELIB_NS_USING(String)
EDELIB_NS_USING(DesktopFile)
EDELIB_NS_USING(IconLoader)
EDELIB_NS_USING(list)
EDELIB_NS_USING(dir_list)
EDELIB_NS_USING(system_config_dirs)
@ -52,6 +52,7 @@ EDELIB_NS_USING(ask)
EDELIB_NS_USING(file_test)
EDELIB_NS_USING(FILE_TEST_IS_REGULAR)
EDELIB_NS_USING(FILE_TEST_IS_EXECUTABLE)
EDELIB_NS_USING(ICON_SIZE_MEDIUM)
#define CHECK_ARGV(argv, pshort, plong) ((strcmp(argv, pshort) == 0) || (strcmp(argv, plong) == 0))
@ -83,9 +84,8 @@ typedef list<String>::iterator StringListIter;
typedef list<DialogEntry*> DialogEntryList;
typedef list<DialogEntry*>::iterator DialogEntryListIter;
static Fl_Window* dialog_win;
static AppWindow* dialog_win;
static Fl_Check_Browser* cbrowser;
static Fl_Pixmap warnpix((const char**)warning_xpm);
static char* get_basename(const char* path) {
char* p = strrchr(path, '/');
@ -174,11 +174,14 @@ static void dialog_close_cb(Fl_Widget*, void* e) {
static void run_autostart_dialog(DialogEntryList& l) {
DialogEntryList* ptr = (DialogEntryList*)&l;
dialog_win = new Fl_Window(370, 305, _("Autostart warning"));
dialog_win = new AppWindow(370, 305, _("Autostart warning"));
dialog_win->begin();
Fl_Box* img = new Fl_Box(10, 10, 65, 60);
img->image(warnpix);
Fl_Box* txt = new Fl_Box(80, 10, 280, 60, _("The following applications are registered for starting. Please chose what to do next"));
Fl_Image* ii = (Fl_Image*)IconLoader::get("dialog-warning", ICON_SIZE_MEDIUM);
img->image(ii);
Fl_Box* txt = new Fl_Box(80, 10, 280, 60, _("The following applications are "
"registered for starting. Please choose what to do next"));
txt->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_WRAP);
cbrowser = new Fl_Check_Browser(10, 75, 350, 185);

View File

@ -1,319 +0,0 @@
/* XPM */
static char * warning_xpm[] = {
"32 32 284 2",
" c None",
". c #D04D00",
"+ c #D24E00",
"@ c #C64900",
"# c #E37B00",
"$ c #D14E00",
"% c #D55600",
"& c #FCBF00",
"* c #EE9A00",
"= c #FFC700",
"- c #DA6500",
"; c #FFD32E",
"> c #FFFDCB",
", c #CB4C00",
"' c #F4AA02",
") c #FFF3AB",
"! c #FFFFE1",
"~ c #B44300",
"{ c #E37C00",
"] c #FFDE58",
"^ c #FFFFE0",
"/ c #FFFFDF",
"( c #FFDE56",
"_ c #F9BF0D",
": c #FFF9C3",
"< c #C6C6B8",
"[ c #969696",
"} c #FFF8C1",
"| c #BD4600",
"1 c #E99002",
"2 c #FFEA7C",
"3 c #EDEDD4",
"4 c #979797",
"5 c #989898",
"6 c #949494",
"7 c #D9D9C6",
"8 c #FFEA7A",
"9 c #E98F01",
"0 c #D85F00",
"a c #FFDA26",
"b c #FFFCCD",
"c c #E5E5C8",
"d c #C9C9B6",
"e c #FFFCCB",
"f c #FFD924",
"g c #C94B00",
"h c #F1AB01",
"i c #FFF292",
"j c #FFFFD3",
"k c #EBEBC7",
"l c #959595",
"m c #929292",
"n c #DCDCBC",
"o c #FFFFD1",
"p c #FFF28C",
"q c #DD7100",
"r c #FFE43F",
"s c #FFFEC5",
"t c #FFFFCB",
"u c #FFFFCC",
"v c #989894",
"w c #919191",
"x c #909090",
"y c #8E8E8E",
"z c #F8F8C6",
"A c #FFFFC7",
"B c #FFFEBF",
"C c #FFE236",
"D c #F9CC0A",
"E c #FFF99D",
"F c #FFFFC4",
"G c #FFFFC3",
"H c #B7B7A1",
"I c #8B8B8B",
"J c #8A8A8A",
"K c #9E9E93",
"L c #FFFFC1",
"M c #FFFFBE",
"N c #FFFFBC",
"O c #FFF892",
"P c #F9CB06",
"Q c #B84500",
"R c #E68D00",
"S c #FFEC51",
"T c #FFFFBA",
"U c #FFFFB9",
"V c #FFFFBB",
"W c #D1D1A6",
"X c #838383",
"Y c #B8B898",
"Z c #FFFFB6",
"` c #FFFFB3",
" . c #FFFFAF",
".. c #FFFFAB",
"+. c #FFEA43",
"@. c #D55700",
"#. c #FCDB13",
"$. c #FFFB97",
"%. c #FFFFAE",
"&. c #EEEEA8",
"*. c #7A7A7A",
"=. c #797979",
"-. c #DCDC9E",
";. c #FFFFA9",
">. c #FFFFA5",
",. c #FFFFA1",
"'. c #FFFF9E",
"). c #FFFB82",
"!. c #FCDA0C",
"~. c #EEAC00",
"{. c #FFF356",
"]. c #FFFFA4",
"^. c #FFFFA2",
"/. c #FFFFA3",
"(. c #8B8B79",
"_. c #6E6E6E",
":. c #FFFF9D",
"<. c #FFFF9B",
"[. c #FFFF98",
"}. c #FFFF93",
"|. c #FFFF8D",
"1. c #FFFF8B",
"2. c #FFF243",
"3. c #DA6B00",
"4. c #FFEB18",
"5. c #FFFE8A",
"6. c #FFFF92",
"7. c #FFFF94",
"8. c #A7A776",
"9. c #88886C",
"0. c #FFFF8A",
"a. c #FFFF87",
"b. c #FFFF82",
"c. c #FFFF7C",
"d. c #FFFF78",
"e. c #FFFD6D",
"f. c #FFEA0E",
"g. c #F4C400",
"h. c #FFF854",
"i. c #FFFF81",
"j. c #FFFF80",
"k. c #F4F47C",
"l. c #E9E978",
"m. c #FFFF7A",
"n. c #FFFF77",
"o. c #FFFF73",
"p. c #FFFF6F",
"q. c #FFFF6B",
"r. c #FFFF65",
"s. c #FFFF62",
"t. c #FFF73A",
"u. c #E38A00",
"v. c #FFF21E",
"w. c #FFFF69",
"x. c #FFFF6E",
"y. c #FFFF6C",
"z. c #FFFF66",
"A. c #FFFF5F",
"B. c #FFFF5C",
"C. c #FFFF57",
"D. c #FFFF53",
"E. c #FFFF4D",
"F. c #FFFF4A",
"G. c #FFF111",
"H. c #D55800",
"I. c #F9DD01",
"J. c #FFFC43",
"K. c #FFFF58",
"L. c #FFFF5B",
"M. c #B5B54D",
"N. c #46463C",
"O. c #373737",
"P. c #9A9A44",
"Q. c #FFFF50",
"R. c #FFFF4C",
"S. c #FFFF49",
"T. c #FFFF45",
"U. c #FFFF40",
"V. c #FFFF3D",
"W. c #FFFF3A",
"X. c #FFFB29",
"Y. c #F9DD00",
"Z. c #E9A100",
"`. c #FFF819",
" + c #FFFF41",
".+ c #FFFF43",
"++ c #FFFF48",
"@+ c #FFFF47",
"#+ c #FFFF46",
"$+ c #3C3C31",
"%+ c #2E2E2E",
"&+ c #2C2C2C",
"*+ c #292929",
"=+ c #E4E43A",
"-+ c #FFFF39",
";+ c #FFFF37",
">+ c #FFFF33",
",+ c #FFFF30",
"'+ c #FFFF2C",
")+ c #FFFF29",
"!+ c #FFFF27",
"~+ c #FFF70D",
"{+ c #D86300",
"]+ c #FCED05",
"^+ c #FFFE25",
"/+ c #FFFF2D",
"(+ c #FFFF32",
"_+ c #FFFF31",
":+ c #323225",
"<+ c #232323",
"[+ c #202020",
"}+ c #1E1E1E",
"|+ c #E3E326",
"1+ c #FFFF25",
"2+ c #FFFF22",
"3+ c #FFFF20",
"4+ c #FFFF1E",
"5+ c #FFFF1B",
"6+ c #FFFF19",
"7+ c #FFFF17",
"8+ c #FFFE13",
"9+ c #FCED02",
"0+ c #C54900",
"a+ c #F1C500",
"b+ c #FFFB0E",
"c+ c #FFFF1A",
"d+ c #FFFF1D",
"e+ c #FFFF1F",
"f+ c #A9A91C",
"g+ c #191919",
"h+ c #181818",
"i+ c #6E6E16",
"j+ c #FFFF14",
"k+ c #FFFF13",
"l+ c #FFFF11",
"m+ c #FFFF0F",
"n+ c #FFFF0D",
"o+ c #FFFF0B",
"p+ c #FFFF0A",
"q+ c #FFFF08",
"r+ c #FFFB04",
"s+ c #DD7A00",
"t+ c #FFFE00",
"u+ c #FFFE0F",
"v+ c #FFFF15",
"w+ c #FFFF16",
"x+ c #FFFF12",
"y+ c #FFFF10",
"z+ c #FFFF0E",
"A+ c #FFFF0C",
"B+ c #FFFF09",
"C+ c #FFFF07",
"D+ c #FFFF06",
"E+ c #FFFF05",
"F+ c #FFFE02",
"G+ c #E08500",
"H+ c #F4D300",
"I+ c #F5D50C",
"J+ c #F5D50D",
"K+ c #F5D50E",
"L+ c #F5D60F",
"M+ c #F5D610",
"N+ c #F4D50B",
"O+ c #F4D509",
"P+ c #F4D408",
"Q+ c #F4D407",
"R+ c #F4D406",
"S+ c #F4D405",
"T+ c #F4D404",
"U+ c #F4D403",
"V+ c #F4D302",
"W+ c #F4D301",
"X+ c #CA4B00",
"Y+ c #D35104",
"Z+ c #D35307",
"`+ c #D35408",
" @ c #D45409",
".@ c #D4550A",
"+@ c #D35206",
"@@ c #D35105",
"#@ c #D35003",
"$@ c #D24F02",
"%@ c #D24F01",
"&@ c #B14200",
" ",
" ",
" . + + @ ",
" + # # + ",
" $ % & & % @ ",
" + * = = * + ",
" $ - ; > > ; - , ",
" . + ' ) ! ! ) ' + ~ ",
" $ { ] ^ / / / ( { . ",
" . % _ : < [ [ < } _ % | ",
" + 1 2 3 [ 4 5 6 7 8 9 + ",
" $ 0 a b c [ [ [ 6 d e f 0 g ",
" + h i j k l l 6 m n o p h + ",
" + q r s t u v w x y z A B C q . ",
" . + D E F G F H I J K L M N O P + Q ",
" + R S T U T V W X X Y Z ` ...+.R + ",
" $ @.#.$. .%. . .&.*.=.-.;.>.,.'.).!.@.@ ",
" + ~.{.].,.,.^./.,.(._.:.<.[.}.|.1.2.~.+ ",
" $ 3.4.5.6.6.7.7.7.6.8.9.|.0.a.b.c.d.e.f.3., ",
" . + g.h.i.j.i.b.b.i.i.k.l.m.n.o.p.q.r.s.t.g.+ ~ ",
" $ u.v.w.q.x.x.p.x.x.y.q.w.z.s.A.B.C.D.E.F.G.u.. ",
" . H.I.J.C.K.L.B.B.L.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.H.| ",
" + Z.`. +.+T.++++++@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+Z.+ ",
" $ {+]+^+/+,+(+(+(+(+(+_+:+<+[+}+|+1+2+3+4+5+6+7+8+9+{+0+ ",
" + a+b+c+5+d+e+e+3+3+e+e+f+g+h+i+7+j+k+l+m+n+o+p+q+r+a++ ",
"$ s+t+u+k+j+v+w+7+w+7+v+v+j+k+x+y+m+z+A+A+B+q+C+D+E+F+t+s+, ",
"+ G+H+I+J+K+L+L+M+M+M+L+L+K+J+J+N+O+O+P+Q+R+S+T+U+V+W+H+G++ ",
"X++ + Y+Z+`+`+ @.@.@ @ @ @`+`+Z++@@@+@@@Y+Y+#@$@%@%@%@+ + &@ ",
" ",
" ",
" ",
" "};

View File

@ -171,31 +171,34 @@ static void save_config(const String &layout) {
r.save(CONFIG_NAME);
}
static void apply_changes_on_x(const char *current) {
/*
* believe me, it is easier to call this command than to reimplmement a mess for
* uploading keyboard layout on X server!
*/
String setxkbmap = file_path("setxkbmap");
if(setxkbmap.empty()) {
alert(_("Unable to find 'setxkbmap' tool.\n\nThis tool is used as helper tool for "
"easier keyboard setup and is standard tool shipped with every X package. "
"Please install it first and run this program again."));
} else {
int ret = run_sync("%s %s", setxkbmap.c_str(), current);
/* do not show dialog since we can fail if config has bad entry when called from apply_chages_from_config() */
if(ret != 0)
E_WARNING(E_STRLOC ": 'setxkbmap %s' failed with %i\n", current, ret);
}
static void apply_changes_on_x(const char *current, const String* previous) {
if(repeat_press->value())
XAutoRepeatOn(fl_display);
else
XAutoRepeatOff(fl_display);
/* force panel applet to re-read config file to see if flag should be displayed or not*/
/* do not do anything if selected layout is the same as previous */
if(!previous || *previous != current) {
/*
* believe me, it is easier to call this command than to reimplmement a mess for
* uploading keyboard layout on X server!
*/
String setxkbmap = file_path("setxkbmap");
if(setxkbmap.empty()) {
alert(_("Unable to find 'setxkbmap' tool.\n\nThis tool is used as helper tool for "
"easier keyboard setup and is standard tool shipped with every X package. "
"Please install it first and run this program again."));
} else {
int ret = run_sync("%s %s", setxkbmap.c_str(), current);
/* do not show dialog since we can fail if config has bad entry when called from apply_chages_from_config() */
if(ret != 0)
E_WARNING(E_STRLOC ": 'setxkbmap %s' failed with %i\n", current, ret);
}
}
/* force panel applet to re-read config file to see if flag should be displayed or not */
foreign_callback_call(PANEL_APPLET_ID);
XFlush(fl_display);
}
static void apply_chages_from_config(void) {
@ -208,7 +211,7 @@ static void apply_chages_from_config(void) {
return;
/* TODO: this should be validated somehow */
apply_changes_on_x(buf);
apply_changes_on_x(buf, NULL);
}
int main(int argc, char **argv) {
@ -285,7 +288,7 @@ int main(int argc, char **argv) {
char *n = xkb_rules->layouts.desc[i - 1].name;
save_config(n);
apply_changes_on_x(n);
apply_changes_on_x(n, &cl);
}
if(xkb_rules)

View File

@ -1,3 +1,6 @@
#!/bin/sh
# Apply common settings at EDE startup. This script should not be called manually;
# it is called from evoke.
ede-bell-conf --apply
ede-keyboard-conf --apply