Pull Kbuild updates from Masahiro Yamada: "This is the last pull request from me. I'm grateful to have been able to continue as a maintainer for eight years. From the next cycle, Nathan and Nicolas will maintain Kbuild. - Fix a shortcut key issue in menuconfig - Fix missing rebuild of kheaders - Sort the symbol dump generated by gendwarfsyms - Support zboot extraction in scripts/extract-vmlinux - Migrate gconfig to GTK 3 - Add TAR variable to allow overriding the default tar command - Hand over Kbuild maintainership" * tag 'kbuild-v6.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (92 commits) MAINTAINERS: hand over Kbuild maintenance kheaders: make it possible to override TAR kbuild: userprogs: use correct linker when mixing clang and GNU ld kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c kconfig: lxdialog: replace strcpy with snprintf in print_autowrap kconfig: gconf: refactor text_insert_help() kconfig: gconf: remove unneeded variable in text_insert_msg kconfig: gconf: use hyphens in signals kconfig: gconf: replace GtkImageMenuItem with GtkMenuItem kconfig: gconf: Fix Back button behavior kconfig: gconf: fix single view to display dependent symbols correctly scripts: add zboot support to extract-vmlinux gendwarfksyms: order -T symtypes output by name gendwarfksyms: use preferred form of sizeof for allocation kconfig: qconf: confine {begin,end}Group to constructor and destructor kconfig: qconf: fix ConfigList::updateListAllforAll() kconfig: add a function to dump all menu entries in a tree-like format kconfig: gconf: show GTK version in About dialog kconfig: gconf: replace GtkHPaned and GtkVPaned with GtkPaned kconfig: gconf: replace GdkColor with GdkRGBA ...
Unified · Split
| @@ -4378,6 +4378,12 @@ S: 542 West 112th Street, 5N · 4377 unmodified lines | |||
| 4378 | S: New York, New York 10025 | 4378 | S: New York, New York 10025 |
| 4379 | S: USA | 4379 | S: USA |
| 4380 | 4380 | ||
| 4381 | N: Masahiro Yamada | ||
| 4382 | E: masahiroy@kernel.org | ||
| 4383 | D: Kbuild Maintainer 2017-2025 | ||
| 4384 | D: Kconfig Maintainer 2018-2025 | ||
| 4385 | S: Japan | ||
| 4386 | |||
| 4381 | N: Li Yang | 4387 | N: Li Yang |
| 4382 | E: leoli@freescale.com | 4388 | E: leoli@freescale.com |
| 4383 | D: Freescale Highspeed USB device driver | 4389 | D: Freescale Highspeed USB device driver |
| @@ -67,12 +67,12 @@ Environment variables for ``*config``: · 66 unmodified lines | |||
| 67 | with its value when saving the configuration, instead of using the | 67 | with its value when saving the configuration, instead of using the |
| 68 | default, ``CONFIG_``. | 68 | default, ``CONFIG_``. |
| 69 | 69 | ||
| 70 | Environment variables for ``{allyes/allmod/allno/rand}config``: | 70 | Environment variables for ``{allyes/allmod/allno/alldef/rand}config``: |
| 71 | 71 | ||
| 72 | ``KCONFIG_ALLCONFIG`` | 72 | ``KCONFIG_ALLCONFIG`` |
| 73 | The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also | 73 | The allyesconfig/allmodconfig/alldefconfig/allnoconfig/randconfig variants |
| 74 | use the environment variable KCONFIG_ALLCONFIG as a flag or a filename | 74 | can also use the environment variable KCONFIG_ALLCONFIG as a flag or a |
| 75 | that contains config symbols that the user requires to be set to a | 75 | filename that contains config symbols that the user requires to be set to a |
| 76 | specific value. If KCONFIG_ALLCONFIG is used without a filename where | 76 | specific value. If KCONFIG_ALLCONFIG is used without a filename where |
| 77 | KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", ``make *config`` | 77 | KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", ``make *config`` |
| 78 | checks for a file named "all{yes/mod/no/def/random}.config" | 78 | checks for a file named "all{yes/mod/no/def/random}.config" |
| @@ -13174,11 +13174,9 @@ F: mm/kasan/ · 13173 unmodified lines | |||
| 13174 | F: scripts/Makefile.kasan | 13174 | F: scripts/Makefile.kasan |
| 13175 | 13175 | ||
| 13176 | KCONFIG | 13176 | KCONFIG |
| 13177 | M: Masahiro Yamada <masahiroy@kernel.org> | ||
| 13178 | L: linux-kbuild@vger.kernel.org | 13177 | L: linux-kbuild@vger.kernel.org |
| 13179 | S: Maintained | 13178 | S: Orphan |
| 13180 | Q: https://patchwork.kernel.org/project/linux-kbuild/list/ | 13179 | Q: https://patchwork.kernel.org/project/linux-kbuild/list/ |
| 13181 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kbuild | ||
| 13182 | F: Documentation/kbuild/kconfig* | 13180 | F: Documentation/kbuild/kconfig* |
| 13183 | F: scripts/Kconfig.include | 13181 | F: scripts/Kconfig.include |
| 13184 | F: scripts/kconfig/ | 13182 | F: scripts/kconfig/ |
| @@ -13243,13 +13241,12 @@ S: Maintained · 58 unmodified lines | |||
| 13243 | F: fs/autofs/ | 13241 | F: fs/autofs/ |
| 13244 | 13242 | ||
| 13245 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) | 13243 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) |
| 13246 | M: Masahiro Yamada <masahiroy@kernel.org> | 13244 | M: Nathan Chancellor <nathan@kernel.org> |
| 13247 | R: Nathan Chancellor <nathan@kernel.org> | 13245 | M: Nicolas Schier <nicolas@fjasle.eu> |
| 13248 | R: Nicolas Schier <nicolas@fjasle.eu> | ||
| 13249 | L: linux-kbuild@vger.kernel.org | 13246 | L: linux-kbuild@vger.kernel.org |
| 13250 | S: Maintained | 13247 | S: Odd Fixes |
| 13251 | Q: https://patchwork.kernel.org/project/linux-kbuild/list/ | 13248 | Q: https://patchwork.kernel.org/project/linux-kbuild/list/ |
| 13252 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git | 13249 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git |
| 13253 | F: Documentation/kbuild/ | 13250 | F: Documentation/kbuild/ |
| 13254 | F: Makefile | 13251 | F: Makefile |
| 13255 | F: scripts/*vmlinux* | 13252 | F: scripts/*vmlinux* |
| @@ -549,6 +549,7 @@ LZMA = lzma · 548 unmodified lines | |||
| 549 | LZ4 = lz4 | 549 | LZ4 = lz4 |
| 550 | XZ = xz | 550 | XZ = xz |
| 551 | ZSTD = zstd | 551 | ZSTD = zstd |
| 552 | TAR = tar | ||
| 552 | 553 | ||
| 553 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ | 554 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ |
| 554 | -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) | 555 | -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) |
| @@ -628,7 +629,7 @@ export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN · 73 unmodified lines | |||
| 628 | export HOSTRUSTC KBUILD_HOSTRUSTFLAGS | 629 | export HOSTRUSTC KBUILD_HOSTRUSTFLAGS |
| 629 | export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL | 630 | export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL |
| 630 | export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX | 631 | export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX |
| 631 | export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD | 632 | export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD TAR |
| 632 | export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS KBUILD_PROCMACROLDFLAGS LDFLAGS_MODULE | 633 | export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS KBUILD_PROCMACROLDFLAGS LDFLAGS_MODULE |
| 633 | export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS | 634 | export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS |
| 634 | 635 | ||
| @@ -1141,7 +1142,7 @@ KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD · 506 unmodified lines | |||
| 1141 | KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) | 1142 | KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) |
| 1142 | 1143 | ||
| 1143 | # userspace programs are linked via the compiler, use the correct linker | 1144 | # userspace programs are linked via the compiler, use the correct linker |
| 1144 | ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy) | 1145 | ifdef CONFIG_CC_IS_CLANG |
| 1145 | KBUILD_USERLDFLAGS += --ld-path=$(LD) | 1146 | KBUILD_USERLDFLAGS += --ld-path=$(LD) |
| 1146 | endif | 1147 | endif |
| 1147 | 1148 | ||
| @@ -43,8 +43,8 @@ · 42 unmodified lines | |||
| 43 | * alias. | 43 | * alias. |
| 44 | */ | 44 | */ |
| 45 | #define MODULE_ALIAS_CRYPTO(name) \ | 45 | #define MODULE_ALIAS_CRYPTO(name) \ |
| 46 | __MODULE_INFO(alias, alias_userspace, name); \ | 46 | MODULE_INFO(alias, name); \ |
| 47 | __MODULE_INFO(alias, alias_crypto, "crypto-" name) | 47 | MODULE_INFO(alias, "crypto-" name) |
| 48 | 48 | ||
| 49 | struct crypto_aead; | 49 | struct crypto_aead; |
| 50 | struct crypto_instance; | 50 | struct crypto_instance; |
| @@ -165,9 +165,6 @@ extern void cleanup_module(void); · 164 unmodified lines | |||
| 165 | 165 | ||
| 166 | struct module_kobject *lookup_or_create_module_kobject(const char *name); | 166 | struct module_kobject *lookup_or_create_module_kobject(const char *name); |
| 167 | 167 | ||
| 168 | /* Generic info of form tag = "info" */ | ||
| 169 | #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) | ||
| 170 | |||
| 171 | /* For userspace: you can also call me... */ | 168 | /* For userspace: you can also call me... */ |
| 172 | #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) | 169 | #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) |
| 173 | 170 | ||
| @@ -24,18 +24,19 @@ · 23 unmodified lines | |||
| 24 | #define __MODULE_INFO_PREFIX KBUILD_MODNAME "." | 24 | #define __MODULE_INFO_PREFIX KBUILD_MODNAME "." |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #define __MODULE_INFO(tag, name, info) \ | 27 | /* Generic info of form tag = "info" */ |
| 28 | static const char __UNIQUE_ID(name)[] \ | 28 | #define MODULE_INFO(tag, info) \ |
| 29 | static const char __UNIQUE_ID(modinfo)[] \ | ||
| 29 | __used __section(".modinfo") __aligned(1) \ | 30 | __used __section(".modinfo") __aligned(1) \ |
| 30 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info | 31 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info |
| 31 | 32 | ||
| 32 | #define __MODULE_PARM_TYPE(name, _type) \ | 33 | #define __MODULE_PARM_TYPE(name, _type) \ |
| 33 | __MODULE_INFO(parmtype, name##type, #name ":" _type) | 34 | MODULE_INFO(parmtype, #name ":" _type) |
| 34 | 35 | ||
| 35 | /* One for each parameter, describing how to use it. Some files do | 36 | /* One for each parameter, describing how to use it. Some files do |
| 36 | multiple of these per line, so can't just use MODULE_INFO. */ | 37 | multiple of these per line, so can't just use MODULE_INFO. */ |
| 37 | #define MODULE_PARM_DESC(_parm, desc) \ | 38 | #define MODULE_PARM_DESC(_parm, desc) \ |
| 38 | __MODULE_INFO(parm, _parm, #_parm ":" desc) | 39 | MODULE_INFO(parm, #_parm ":" desc) |
| 39 | 40 | ||
| 40 | struct kernel_param; | 41 | struct kernel_param; |
| 41 | 42 | ||
| @@ -2655,8 +2655,8 @@ void tcp_update_ulp(struct sock *sk, struct proto *p, · 2654 unmodified lines | |||
| 2655 | void (*write_space)(struct sock *sk)); | 2655 | void (*write_space)(struct sock *sk)); |
| 2656 | 2656 | ||
| 2657 | #define MODULE_ALIAS_TCP_ULP(name) \ | 2657 | #define MODULE_ALIAS_TCP_ULP(name) \ |
| 2658 | __MODULE_INFO(alias, alias_userspace, name); \ | 2658 | MODULE_INFO(alias, name); \ |
| 2659 | __MODULE_INFO(alias, alias_tcp_ulp, "tcp-ulp-" name) | 2659 | MODULE_INFO(alias, "tcp-ulp-" name) |
| 2660 | 2660 | ||
| 2661 | #ifdef CONFIG_NET_SOCK_MSG | 2661 | #ifdef CONFIG_NET_SOCK_MSG |
| 2662 | struct sk_msg; | 2662 | struct sk_msg; |
| @@ -1,3 +1,5 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | /config_data | 2 | /config_data |
| 3 | /kheaders.md5 | 3 | /kheaders.md5 |
| 4 | /kheaders-objlist | ||
| 5 | /kheaders-srclist | ||
| @@ -159,11 +159,48 @@ filechk_cat = cat $< · 158 unmodified lines | |||
| 159 | $(obj)/config_data: $(KCONFIG_CONFIG) FORCE | 159 | $(obj)/config_data: $(KCONFIG_CONFIG) FORCE |
| 160 | $(call filechk,cat) | 160 | $(call filechk,cat) |
| 161 | 161 | ||
| 162 | # kheaders_data.tar.xz | ||
| 162 | $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz | 163 | $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz |
| 163 | 164 | ||
| 164 | quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz | 165 | quiet_cmd_kheaders_data = GEN $@ |
| 165 | cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_kheaders.sh $@ | 166 | cmd_kheaders_data = "$<" "$@" "$(obj)/kheaders-srclist" "$(obj)/kheaders-objlist" "$(KBUILD_BUILD_TIMESTAMP)" |
| 166 | $(obj)/kheaders_data.tar.xz: FORCE | 167 | cmd_kheaders_data_dep = cat $(depfile) >> $(dot-target).cmd; rm -f $(depfile) |
| 167 | $(call cmd,genikh) | ||
| 168 | 168 | ||
| 169 | clean-files := kheaders_data.tar.xz kheaders.md5 | 169 | define rule_kheaders_data |
| 170 | $(call cmd_and_savecmd,kheaders_data) | ||
| 171 | $(call cmd,kheaders_data_dep) | ||
| 172 | endef | ||
| 173 | |||
| 174 | targets += kheaders_data.tar.xz | ||
| 175 | $(obj)/kheaders_data.tar.xz: $(src)/gen_kheaders.sh $(obj)/kheaders-srclist $(obj)/kheaders-objlist $(obj)/kheaders.md5 FORCE | ||
| 176 | $(call if_changed_rule,kheaders_data) | ||
| 177 | |||
| 178 | # generated headers in objtree | ||
| 179 | # | ||
| 180 | # include/generated/utsversion.h is ignored because it is generated | ||
| 181 | # after gen_kheaders.sh is executed. (utsversion.h is unneeded for kheaders) | ||
| 182 | filechk_kheaders_objlist = \ | ||
| 183 | for d in include "arch/$(SRCARCH)/include"; do \ | ||
| 184 | find "$${d}/generated" ! -path "include/generated/utsversion.h" -a -name "*.h" -print; \ | ||
| 185 | done | ||
| 186 | |||
| 187 | $(obj)/kheaders-objlist: FORCE | ||
| 188 | $(call filechk,kheaders_objlist) | ||
| 189 | |||
| 190 | # non-generated headers in srctree | ||
| 191 | filechk_kheaders_srclist = \ | ||
| 192 | for d in include "arch/$(SRCARCH)/include"; do \ | ||
| 193 | find "$(srctree)/$${d}" -path "$(srctree)/$${d}/generated" -prune -o -name "*.h" -print; \ | ||
| 194 | done | ||
| 195 | |||
| 196 | $(obj)/kheaders-srclist: FORCE | ||
| 197 | $(call filechk,kheaders_srclist) | ||
| 198 | |||
| 199 | # Some files are symlinks. If symlinks are changed, kheaders_data.tar.xz should | ||
| 200 | # be rebuilt. | ||
| 201 | filechk_kheaders_md5sum = xargs -r -a $< stat -c %N | md5sum | ||
| 202 | |||
| 203 | $(obj)/kheaders.md5: $(obj)/kheaders-srclist FORCE | ||
| 204 | $(call filechk,kheaders_md5sum) | ||
| 205 | |||
| 206 | clean-files := kheaders.md5 kheaders-srclist kheaders-objlist | ||
| @@ -4,79 +4,34 @@ · 3 unmodified lines | |||
| 4 | # This script generates an archive consisting of kernel headers | 4 | # This script generates an archive consisting of kernel headers |
| 5 | # for CONFIG_IKHEADERS. | 5 | # for CONFIG_IKHEADERS. |
| 6 | set -e | 6 | set -e |
| 7 | sfile="$(readlink -f "$0")" | ||
| 8 | outdir="$(pwd)" | ||
| 9 | tarfile=$1 | 7 | tarfile=$1 |
| 10 | tmpdir=$outdir/${tarfile%/*}/.tmp_dir | 8 | srclist=$2 |
| 11 | 9 | objlist=$3 | |
| 12 | dir_list=" | 10 | timestamp=$4 |
| 13 | include/ | 11 | |
| 14 | arch/$SRCARCH/include/ | 12 | dir=$(dirname "${tarfile}") |
| 15 | " | 13 | tmpdir=${dir}/.tmp_dir |
| 16 | 14 | depfile=${dir}/.$(basename "${tarfile}").d | |
| 17 | # Support incremental builds by skipping archive generation | 15 | |
| 18 | # if timestamps of files being archived are not changed. | 16 | # generate dependency list. |
| 19 | 17 | { | |
| 20 | # This block is useful for debugging the incremental builds. | 18 | echo |
| 21 | # Uncomment it for debugging. | 19 | echo "deps_${tarfile} := \\" |
| 22 | # if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter; | 20 | sed 's:\(.*\): \1 \\:' "${srclist}" |
| 23 | # else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi | 21 | sed -n '/^include\/generated\/autoconf\.h$/!s:\(.*\): \1 \\:p' "${objlist}" |
| 24 | # find $all_dirs -name "*.h" | xargs ls -l > /tmp/ls-$iter | 22 | echo |
| 25 | 23 | echo "${tarfile}: \$(deps_${tarfile})" | |
| 26 | all_dirs= | 24 | echo |
| 27 | if [ "$building_out_of_srctree" ]; then | 25 | echo "\$(deps_${tarfile}):" |
| 28 | for d in $dir_list; do | 26 | |
| 29 | all_dirs="$all_dirs $srctree/$d" | 27 | } > "${depfile}" |
| 30 | done | ||
| 31 | fi | ||
| 32 | all_dirs="$all_dirs $dir_list" | ||
| 33 | |||
| 34 | # include/generated/utsversion.h is ignored because it is generated after this | ||
| 35 | # script is executed. (utsversion.h is unneeded for kheaders) | ||
| 36 | # | ||
| 37 | # When Kconfig regenerates include/generated/autoconf.h, its timestamp is | ||
| 38 | # updated, but the contents might be still the same. When any CONFIG option is | ||
| 39 | # changed, Kconfig touches the corresponding timestamp file include/config/*. | ||
| 40 | # Hence, the md5sum detects the configuration change anyway. We do not need to | ||
| 41 | # check include/generated/autoconf.h explicitly. | ||
| 42 | # | ||
| 43 | # Ignore them for md5 calculation to avoid pointless regeneration. | ||
| 44 | headers_md5="$(find $all_dirs -name "*.h" -a \ | ||
| 45 | ! -path include/generated/utsversion.h -a \ | ||
| 46 | ! -path include/generated/autoconf.h | | ||
| 47 | xargs ls -l | md5sum | cut -d ' ' -f1)" | ||
| 48 | |||
| 49 | # Any changes to this script will also cause a rebuild of the archive. | ||
| 50 | this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)" | ||
| 51 | if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi | ||
| 52 | if [ -f kernel/kheaders.md5 ] && | ||
| 53 | [ "$(head -n 1 kernel/kheaders.md5)" = "$headers_md5" ] && | ||
| 54 | [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && | ||
| 55 | [ "$(tail -n 1 kernel/kheaders.md5)" = "$tarfile_md5" ]; then | ||
| 56 | exit | ||
| 57 | fi | ||
| 58 | |||
| 59 | echo " GEN $tarfile" | ||
| 60 | 28 | ||
| 61 | rm -rf "${tmpdir}" | 29 | rm -rf "${tmpdir}" |
| 62 | mkdir "${tmpdir}" | 30 | mkdir "${tmpdir}" |
| 63 | 31 | ||
| 64 | if [ "$building_out_of_srctree" ]; then | 32 | # shellcheck disable=SC2154 # srctree is passed as an env variable |
| 65 | ( | 33 | sed "s:^${srctree}/::" "${srclist}" | ${TAR} -c -f - -C "${srctree}" -T - | ${TAR} -xf - -C "${tmpdir}" |
| 66 | cd $srctree | 34 | ${TAR} -c -f - -T "${objlist}" | ${TAR} -xf - -C "${tmpdir}" |
| 67 | for f in $dir_list | ||
| 68 | do find "$f" -name "*.h"; | ||
| 69 | done | tar -c -f - -T - | tar -xf - -C "${tmpdir}" | ||
| 70 | ) | ||
| 71 | fi | ||
| 72 | |||
| 73 | for f in $dir_list; | ||
| 74 | do find "$f" -name "*.h"; | ||
| 75 | done | tar -c -f - -T - | tar -xf - -C "${tmpdir}" | ||
| 76 | |||
| 77 | # Always exclude include/generated/utsversion.h | ||
| 78 | # Otherwise, the contents of the tarball may vary depending on the build steps. | ||
| 79 | rm -f "${tmpdir}/include/generated/utsversion.h" | ||
| 80 | 35 | ||
| 81 | # Remove comments except SDPX lines | 36 | # Remove comments except SDPX lines |
| 82 | # Use a temporary file to store directory contents to prevent find/xargs from | 37 | # Use a temporary file to store directory contents to prevent find/xargs from |
| @@ -88,12 +43,8 @@ xargs -0 -P8 -n1 \ · 5 unmodified lines | |||
| 88 | rm -f "${tmpdir}.contents.txt" | 43 | rm -f "${tmpdir}.contents.txt" |
| 89 | 44 | ||
| 90 | # Create archive and try to normalize metadata for reproducibility. | 45 | # Create archive and try to normalize metadata for reproducibility. |
| 91 | tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ | 46 | ${TAR} "${timestamp:+--mtime=$timestamp}" \ |
| 92 | --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \ | 47 | --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \ |
| 93 | -I $XZ -cf $tarfile -C "${tmpdir}/" . > /dev/null | 48 | -I "${XZ}" -cf "${tarfile}" -C "${tmpdir}/" . > /dev/null |
| 94 | |||
| 95 | echo $headers_md5 > kernel/kheaders.md5 | ||
| 96 | echo "$this_file_md5" >> kernel/kheaders.md5 | ||
| 97 | echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5 | ||
| 98 | 49 | ||
| 99 | rm -rf "${tmpdir}" | 50 | rm -rf "${tmpdir}" |
| @@ -12,13 +12,12 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | check_vmlinux() | 13 | check_vmlinux() |
| 14 | { | 14 | { |
| 15 | # Use readelf to check if it's a valid ELF | 15 | if file "$1" | grep -q 'Linux kernel.*boot executable' || |
| 16 | # TODO: find a better to way to check that it's really vmlinux | 16 | readelf -h "$1" > /dev/null 2>&1 |
| 17 | # and not just an elf | 17 | then |
| 18 | readelf -h $1 > /dev/null 2>&1 || return 1 | 18 | cat "$1" |
| 19 | 19 | exit 0 | |
| 20 | cat $1 | 20 | fi |
| 21 | exit 0 | ||
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | try_decompress() | 23 | try_decompress() |
| @@ -15,7 +15,7 @@ void cache_set(struct cache *cache, unsigned long key, int value) · 14 unmodified lines | |||
| 15 | { | 15 | { |
| 16 | struct cache_item *ci; | 16 | struct cache_item *ci; |
| 17 | 17 | ||
| 18 | ci = xmalloc(sizeof(struct cache_item)); | 18 | ci = xmalloc(sizeof(*ci)); |
| 19 | ci->key = key; | 19 | ci->key = key; |
| 20 | ci->value = value; | 20 | ci->value = value; |
| 21 | hash_add(cache->cache, &ci->hash, hash_32(key)); | 21 | hash_add(cache->cache, &ci->hash, hash_32(key)); |
| @@ -33,7 +33,7 @@ static struct die *create_die(Dwarf_Die *die, enum die_state state) · 32 unmodified lines | |||
| 33 | { | 33 | { |
| 34 | struct die *cd; | 34 | struct die *cd; |
| 35 | 35 | ||
| 36 | cd = xmalloc(sizeof(struct die)); | 36 | cd = xmalloc(sizeof(*cd)); |
| 37 | init_die(cd); | 37 | init_die(cd); |
| 38 | cd->addr = (uintptr_t)die->addr; | 38 | cd->addr = (uintptr_t)die->addr; |
| 39 | 39 | ||
| @@ -123,7 +123,7 @@ static struct die_fragment *append_item(struct die *cd) · 83 unmodified lines | |||
| 123 | { | 123 | { |
| 124 | struct die_fragment *df; | 124 | struct die_fragment *df; |
| 125 | 125 | ||
| 126 | df = xmalloc(sizeof(struct die_fragment)); | 126 | df = xmalloc(sizeof(*df)); |
| 127 | df->type = FRAGMENT_EMPTY; | 127 | df->type = FRAGMENT_EMPTY; |
| 128 | list_add_tail(&df->list, &cd->fragments); | 128 | list_add_tail(&df->list, &cd->fragments); |
| 129 | return df; | 129 | return df; |
| @@ -634,7 +634,7 @@ static int get_union_kabi_status(Dwarf_Die *die, Dwarf_Die *placeholder, · 633 unmodified lines | |||
| 634 | * Note that the user of this feature is responsible for ensuring | 634 | * Note that the user of this feature is responsible for ensuring |
| 635 | * that the structure actually remains ABI compatible. | 635 | * that the structure actually remains ABI compatible. |
| 636 | */ | 636 | */ |
| 637 | memset(&state.kabi, 0, sizeof(struct kabi_state)); | 637 | memset(&state.kabi, 0, sizeof(state.kabi)); |
| 638 | 638 | ||
| 639 | res = checkp(process_die_container(&state, NULL, die, | 639 | res = checkp(process_die_container(&state, NULL, die, |
| 640 | check_union_member_kabi_status, | 640 | check_union_member_kabi_status, |
| @@ -228,7 +228,7 @@ void kabi_read_rules(int fd) · 227 unmodified lines | |||
| 228 | if (type == KABI_RULE_TYPE_UNKNOWN) | 228 | if (type == KABI_RULE_TYPE_UNKNOWN) |
| 229 | error("unsupported kABI rule type: '%s'", field); | 229 | error("unsupported kABI rule type: '%s'", field); |
| 230 | 230 | ||
| 231 | rule = xmalloc(sizeof(struct rule)); | 231 | rule = xmalloc(sizeof(*rule)); |
| 232 | 232 | ||
| 233 | rule->type = type; | 233 | rule->type = type; |
| 234 | rule->target = xstrdup(get_rule_field(&rule_str, &left)); | 234 | rule->target = xstrdup(get_rule_field(&rule_str, &left)); |
| @@ -146,7 +146,7 @@ void symbol_read_exports(FILE *file) · 145 unmodified lines | |||
| 146 | continue; | 146 | continue; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | sym = xcalloc(1, sizeof(struct symbol)); | 149 | sym = xcalloc(1, sizeof(*sym)); |
| 150 | sym->name = name; | 150 | sym->name = name; |
| 151 | sym->addr.section = SHN_UNDEF; | 151 | sym->addr.section = SHN_UNDEF; |
| 152 | sym->state = SYMBOL_UNPROCESSED; | 152 | sym->state = SYMBOL_UNPROCESSED; |
| @@ -6,6 +6,8 @@ · 5 unmodified lines | |||
| 6 | #define _GNU_SOURCE | 6 | #define _GNU_SOURCE |
| 7 | #include <inttypes.h> | 7 | #include <inttypes.h> |
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> | ||
| 10 | #include <string.h> | ||
| 9 | #include <zlib.h> | 11 | #include <zlib.h> |
| 10 | 12 | ||
| 11 | #include "gendwarfksyms.h" | 13 | #include "gendwarfksyms.h" |
| @@ -43,7 +45,7 @@ static int type_list_append(struct list_head *list, const char *s, void *owned) · 31 unmodified lines | |||
| 43 | if (!s) | 45 | if (!s) |
| 44 | return 0; | 46 | return 0; |
| 45 | 47 | ||
| 46 | entry = xmalloc(sizeof(struct type_list_entry)); | 48 | entry = xmalloc(sizeof(*entry)); |
| 47 | entry->str = s; | 49 | entry->str = s; |
| 48 | entry->owned = owned; | 50 | entry->owned = owned; |
| 49 | list_add_tail(&entry->list, list); | 51 | list_add_tail(&entry->list, list); |
| @@ -120,7 +122,7 @@ static struct type_expansion *type_map_add(const char *name, · 70 unmodified lines | |||
| 120 | struct type_expansion *e; | 122 | struct type_expansion *e; |
| 121 | 123 | ||
| 122 | if (__type_map_get(name, &e)) { | 124 | if (__type_map_get(name, &e)) { |
| 123 | e = xmalloc(sizeof(struct type_expansion)); | 125 | e = xmalloc(sizeof(*e)); |
| 124 | type_expansion_init(e); | 126 | type_expansion_init(e); |
| 125 | e->name = xstrdup(name); | 127 | e->name = xstrdup(name); |
| 126 | 128 | ||
| @@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res) · 52 unmodified lines | |||
| 179 | return -1; | 181 | return -1; |
| 180 | } | 182 | } |
| 181 | 183 | ||
| 184 | static int cmp_expansion_name(const void *p1, const void *p2) | ||
| 185 | { | ||
| 186 | struct type_expansion *const *e1 = p1; | ||
| 187 | struct type_expansion *const *e2 = p2; | ||
| 188 | |||
| 189 | return strcmp((*e1)->name, (*e2)->name); | ||
| 190 | } | ||
| 191 | |||
| 182 | static void type_map_write(FILE *file) | 192 | static void type_map_write(FILE *file) |
| 183 | { | 193 | { |
| 184 | struct type_expansion *e; | 194 | struct type_expansion *e; |
| 185 | struct hlist_node *tmp; | 195 | struct hlist_node *tmp; |
| 196 | struct type_expansion **es; | ||
| 197 | size_t count = 0; | ||
| 198 | size_t i = 0; | ||
| 186 | 199 | ||
| 187 | if (!file) | 200 | if (!file) |
| 188 | return; | 201 | return; |
| 189 | 202 | ||
| 190 | hash_for_each_safe(type_map, e, tmp, hash) { | 203 | hash_for_each_safe(type_map, e, tmp, hash) |
| 191 | checkp(fputs(e->name, file)); | 204 | ++count; |
| 205 | es = xmalloc(count * sizeof(*es)); | ||
| 206 | hash_for_each_safe(type_map, e, tmp, hash) | ||
| 207 | es[i++] = e; | ||
| 208 | |||
| 209 | qsort(es, count, sizeof(*es), cmp_expansion_name); | ||
| 210 | |||
| 211 | for (i = 0; i < count; ++i) { | ||
| 212 | checkp(fputs(es[i]->name, file)); | ||
| 192 | checkp(fputs(" ", file)); | 213 | checkp(fputs(" ", file)); |
| 193 | type_list_write(&e->expanded, file); | 214 | type_list_write(&es[i]->expanded, file); |
| 194 | checkp(fputs("\n", file)); | 215 | checkp(fputs("\n", file)); |
| 195 | } | 216 | } |
| 217 | |||
| 218 | free(es); | ||
| 196 | } | 219 | } |
| 197 | 220 | ||
| 198 | static void type_map_free(void) | 221 | static void type_map_free(void) |
| @@ -594,7 +594,7 @@ static void check_conf(struct menu *menu) · 593 unmodified lines | |||
| 594 | default: | 594 | default: |
| 595 | if (!conf_cnt++) | 595 | if (!conf_cnt++) |
| 596 | printf("*\n* Restart config...\n*\n"); | 596 | printf("*\n* Restart config...\n*\n"); |
| 597 | rootEntry = menu_get_parent_menu(menu); | 597 | rootEntry = menu_get_menu_or_parent_menu(menu); |
| 598 | conf(rootEntry); | 598 | conf(rootEntry); |
| 599 | break; | 599 | break; |
| 600 | } | 600 | } |
| @@ -77,7 +77,7 @@ static bool is_same(const char *file1, const char *file2) · 76 unmodified lines | |||
| 77 | if (map2 == MAP_FAILED) | 77 | if (map2 == MAP_FAILED) |
| 78 | goto close2; | 78 | goto close2; |
| 79 | 79 | ||
| 80 | if (bcmp(map1, map2, st1.st_size)) | 80 | if (memcmp(map1, map2, st1.st_size)) |
| 81 | goto close2; | 81 | goto close2; |
| 82 | 82 | ||
| 83 | ret = true; | 83 | ret = true; |
| @@ -6,7 +6,7 @@ set -eu · 5 unmodified lines | |||
| 6 | cflags=$1 | 6 | cflags=$1 |
| 7 | libs=$2 | 7 | libs=$2 |
| 8 | 8 | ||
| 9 | PKG="gtk+-2.0 gmodule-2.0 libglade-2.0" | 9 | PKG=gtk+-3.0 |
| 10 | 10 | ||
| 11 | if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then | 11 | if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then |
| 12 | echo >&2 "*" | 12 | echo >&2 "*" |
| @@ -18,18 +18,11 @@ fi · 5 unmodified lines | |||
| 18 | if ! ${HOSTPKG_CONFIG} --exists $PKG; then | 18 | if ! ${HOSTPKG_CONFIG} --exists $PKG; then |
| 19 | echo >&2 "*" | 19 | echo >&2 "*" |
| 20 | echo >&2 "* Unable to find the GTK+ installation. Please make sure that" | 20 | echo >&2 "* Unable to find the GTK+ installation. Please make sure that" |
| 21 | echo >&2 "* the GTK+ 2.0 development package is correctly installed." | 21 | echo >&2 "* the GTK 3 development package is correctly installed." |
| 22 | echo >&2 "* You need $PKG" | 22 | echo >&2 "* You need $PKG" |
| 23 | echo >&2 "*" | 23 | echo >&2 "*" |
| 24 | exit 1 | 24 | exit 1 |
| 25 | fi | 25 | fi |
| 26 | 26 | ||
| 27 | if ! ${HOSTPKG_CONFIG} --atleast-version=2.0.0 gtk+-2.0; then | ||
| 28 | echo >&2 "*" | ||
| 29 | echo >&2 "* GTK+ is present but version >= 2.0.0 is required." | ||
| 30 | echo >&2 "*" | ||
| 31 | exit 1 | ||
| 32 | fi | ||
| 33 | |||
| 34 | ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} | 27 | ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} |
| 35 | ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} | 28 | ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} |
| @@ -7,10 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include "lkc.h" | 7 | #include "lkc.h" |
| 8 | #include "images.h" | 8 | #include "images.h" |
| 9 | 9 | ||
| 10 | #include <glade/glade.h> | ||
| 11 | #include <gtk/gtk.h> | 10 | #include <gtk/gtk.h> |
| 12 | #include <glib.h> | ||
| 13 | #include <gdk/gdkkeysyms.h> | ||
| 14 | 11 | ||
| 15 | #include <stdio.h> | 12 | #include <stdio.h> |
| 16 | #include <string.h> | 13 | #include <string.h> |
| @@ -18,7 +15,7 @@ · 1 unmodified line | |||
| 18 | #include <unistd.h> | 15 | #include <unistd.h> |
| 19 | #include <time.h> | 16 | #include <time.h> |
| 20 | 17 | ||
| 21 | enum { | 18 | enum view_mode { |
| 22 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW | 19 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW |
| 23 | }; | 20 | }; |
| 24 | 21 | ||
| @@ -30,29 +27,24 @@ static gint view_mode = FULL_VIEW; · 5 unmodified lines | |||
| 30 | static gboolean show_name = TRUE; | 27 | static gboolean show_name = TRUE; |
| 31 | static gboolean show_range = TRUE; | 28 | static gboolean show_range = TRUE; |
| 32 | static gboolean show_value = TRUE; | 29 | static gboolean show_value = TRUE; |
| 33 | static gboolean resizeable = FALSE; | ||
| 34 | static int opt_mode = OPT_NORMAL; | 30 | static int opt_mode = OPT_NORMAL; |
| 35 | 31 | ||
| 36 | GtkWidget *main_wnd = NULL; | 32 | static GtkWidget *main_wnd; |
| 37 | GtkWidget *tree1_w = NULL; // left frame | 33 | static GtkWidget *tree1_w; // left frame |
| 38 | GtkWidget *tree2_w = NULL; // right frame | 34 | static GtkWidget *tree2_w; // right frame |
| 39 | GtkWidget *text_w = NULL; | 35 | static GtkWidget *text_w; |
| 40 | GtkWidget *hpaned = NULL; | 36 | static GtkWidget *hpaned; |
| 41 | GtkWidget *vpaned = NULL; | 37 | static GtkWidget *vpaned; |
| 42 | GtkWidget *back_btn = NULL; | 38 | static GtkWidget *back_btn, *save_btn, *single_btn, *split_btn, *full_btn; |
| 43 | GtkWidget *save_btn = NULL; | 39 | static GtkWidget *save_menu_item; |
| 44 | GtkWidget *save_menu_item = NULL; | ||
| 45 | 40 | ||
| 46 | GtkTextTag *tag1, *tag2; | 41 | static GtkTextTag *tag1, *tag2; |
| 47 | GdkColor color; | ||
| 48 | 42 | ||
| 49 | GtkTreeStore *tree1, *tree2, *tree; | 43 | static GtkTreeStore *tree1, *tree2; |
| 50 | GtkTreeModel *model1, *model2; | 44 | static GdkPixbuf *pix_menu; |
| 51 | static GtkTreeIter *parents[256]; | ||
| 52 | static gint indent; | ||
| 53 | 45 | ||
| 54 | static struct menu *current; // current node for SINGLE view | 46 | static struct menu *browsed; // browsed menu for SINGLE/SPLIT view |
| 55 | static struct menu *browsed; // browsed node for SPLIT view | 47 | static struct menu *selected; // selected entry |
| 56 | 48 | ||
| 57 | enum { | 49 | enum { |
| 58 | COL_OPTION, COL_NAME, COL_NO, COL_MOD, COL_YES, COL_VALUE, | 50 | COL_OPTION, COL_NAME, COL_NO, COL_MOD, COL_YES, COL_VALUE, |
| @@ -61,28 +53,8 @@ enum { · 2 unmodified lines | |||
| 61 | COL_NUMBER | 53 | COL_NUMBER |
| 62 | }; | 54 | }; |
| 63 | 55 | ||
| 64 | static void display_list(void); | 56 | static void display_tree(GtkTreeStore *store, struct menu *menu); |
| 65 | static void display_tree(struct menu *menu); | 57 | static void recreate_tree(void); |
| 66 | static void display_tree_part(void); | ||
| 67 | static void update_tree(struct menu *src, GtkTreeIter * dst); | ||
| 68 | |||
| 69 | static void replace_button_icon(GladeXML *xml, GdkDrawable *window, | ||
| 70 | GtkStyle *style, gchar *btn_name, gchar **xpm) | ||
| 71 | { | ||
| 72 | GdkPixmap *pixmap; | ||
| 73 | GdkBitmap *mask; | ||
| 74 | GtkToolButton *button; | ||
| 75 | GtkWidget *image; | ||
| 76 | |||
| 77 | pixmap = gdk_pixmap_create_from_xpm_d(window, &mask, | ||
| 78 | &style->bg[GTK_STATE_NORMAL], | ||
| 79 | xpm); | ||
| 80 | |||
| 81 | button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, btn_name)); | ||
| 82 | image = gtk_image_new_from_pixmap(pixmap, mask); | ||
| 83 | gtk_widget_show(image); | ||
| 84 | gtk_tool_button_set_icon_widget(button, image); | ||
| 85 | } | ||
| 86 | 58 | ||
| 87 | static void conf_changed(bool dirty) | 59 | static void conf_changed(bool dirty) |
| 88 | { | 60 | { |
| @@ -90,465 +62,373 @@ static void conf_changed(bool dirty) · 1 unmodified line | |||
| 90 | gtk_widget_set_sensitive(save_menu_item, dirty); | 62 | gtk_widget_set_sensitive(save_menu_item, dirty); |
| 91 | } | 63 | } |
| 92 | 64 | ||
| 93 | /* Main Window Initialization */ | 65 | /* Utility Functions */ |
| 94 | static void init_main_window(const gchar *glade_file) | 66 | |
| 67 | static void text_insert_msg(const char *title, const char *msg) | ||
| 95 | { | 68 | { |
| 96 | GladeXML *xml; | 69 | GtkTextBuffer *buffer; |
| 97 | GtkWidget *widget; | 70 | GtkTextIter start, end; |
| 98 | GtkTextBuffer *txtbuf; | ||
| 99 | GtkStyle *style; | ||
| 100 | 71 | ||
| 101 | xml = glade_xml_new(glade_file, "window1", NULL); | 72 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); |
| 102 | if (!xml) | 73 | gtk_text_buffer_get_bounds(buffer, &start, &end); |
| 103 | g_error("GUI loading failed !\n"); | 74 | gtk_text_buffer_delete(buffer, &start, &end); |
| 104 | glade_xml_signal_autoconnect(xml); | 75 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); |
| 105 | 76 | ||
| 106 | main_wnd = glade_xml_get_widget(xml, "window1"); | 77 | gtk_text_buffer_get_end_iter(buffer, &end); |
| 107 | hpaned = glade_xml_get_widget(xml, "hpaned1"); | 78 | gtk_text_buffer_insert_with_tags(buffer, &end, title, -1, tag1, |
| 108 | vpaned = glade_xml_get_widget(xml, "vpaned1"); | 79 | NULL); |
| 109 | tree1_w = glade_xml_get_widget(xml, "treeview1"); | 80 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); |
| 110 | tree2_w = glade_xml_get_widget(xml, "treeview2"); | 81 | gtk_text_buffer_get_end_iter(buffer, &end); |
| 111 | text_w = glade_xml_get_widget(xml, "textview3"); | 82 | gtk_text_buffer_insert_with_tags(buffer, &end, msg, -1, tag2, |
| 83 | NULL); | ||
| 84 | } | ||
| 112 | 85 | ||
| 113 | back_btn = glade_xml_get_widget(xml, "button1"); | 86 | static void text_insert_help(struct menu *menu) |
| 114 | gtk_widget_set_sensitive(back_btn, FALSE); | 87 | { |
| 88 | struct gstr help = str_new(); | ||
| 115 | 89 | ||
| 116 | widget = glade_xml_get_widget(xml, "show_name1"); | 90 | menu_get_ext_help(menu, &help); |
| 117 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | 91 | text_insert_msg(menu_get_prompt(menu), str_get(&help)); |
| 118 | show_name); | 92 | str_free(&help); |
| 93 | } | ||
| 119 | 94 | ||
| 120 | widget = glade_xml_get_widget(xml, "show_range1"); | 95 | static void _select_menu(GtkTreeView *view, GtkTreeModel *model, |
| 121 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | 96 | GtkTreeIter *parent, struct menu *match) |
| 122 | show_range); | 97 | { |
| 98 | GtkTreeIter iter; | ||
| 99 | gboolean valid; | ||
| 123 | 100 | ||
| 124 | widget = glade_xml_get_widget(xml, "show_data1"); | 101 | valid = gtk_tree_model_iter_children(model, &iter, parent); |
| 125 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | 102 | while (valid) { |
| 126 | show_value); | 103 | struct menu *menu; |
| 127 | 104 | ||
| 128 | save_btn = glade_xml_get_widget(xml, "button3"); | 105 | gtk_tree_model_get(model, &iter, COL_MENU, &menu, -1); |
| 129 | save_menu_item = glade_xml_get_widget(xml, "save1"); | ||
| 130 | conf_set_changed_callback(conf_changed); | ||
| 131 | 106 | ||
| 132 | style = gtk_widget_get_style(main_wnd); | 107 | if (menu == match) { |
| 133 | widget = glade_xml_get_widget(xml, "toolbar1"); | 108 | GtkTreeSelection *selection; |
| 109 | GtkTreePath *path; | ||
| 134 | 110 | ||
| 135 | replace_button_icon(xml, main_wnd->window, style, | 111 | /* |
| 136 | "button4", (gchar **) xpm_single_view); | 112 | * Expand parents to reflect the selection, and |
| 137 | replace_button_icon(xml, main_wnd->window, style, | 113 | * scroll down to it. |
| 138 | "button5", (gchar **) xpm_split_view); | 114 | */ |
| 139 | replace_button_icon(xml, main_wnd->window, style, | 115 | path = gtk_tree_model_get_path(model, &iter); |
| 140 | "button6", (gchar **) xpm_tree_view); | 116 | gtk_tree_view_expand_to_path(view, path); |
| 117 | gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, | ||
| 118 | 0.5, 0.0); | ||
| 119 | gtk_tree_path_free(path); | ||
| 141 | 120 | ||
| 142 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 121 | selection = gtk_tree_view_get_selection(view); |
| 143 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", | 122 | gtk_tree_selection_select_iter(selection, &iter); |
| 144 | "foreground", "red", | ||
| 145 | "weight", PANGO_WEIGHT_BOLD, | ||
| 146 | NULL); | ||
| 147 | tag2 = gtk_text_buffer_create_tag(txtbuf, "mytag2", | ||
| 148 | /*"style", PANGO_STYLE_OBLIQUE, */ | ||
| 149 | NULL); | ||
| 150 | 123 | ||
| 151 | gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text); | 124 | text_insert_help(menu); |
| 125 | } | ||
| 152 | 126 | ||
| 153 | gtk_widget_show(main_wnd); | 127 | _select_menu(view, model, &iter, match); |
| 128 | |||
| 129 | valid = gtk_tree_model_iter_next(model, &iter); | ||
| 130 | } | ||
| 154 | } | 131 | } |
| 155 | 132 | ||
| 156 | static void init_tree_model(void) | 133 | static void select_menu(GtkTreeView *view, struct menu *match) |
| 157 | { | 134 | { |
| 158 | gint i; | 135 | _select_menu(view, gtk_tree_view_get_model(view), NULL, match); |
| 159 | |||
| 160 | tree = tree2 = gtk_tree_store_new(COL_NUMBER, | ||
| 161 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 162 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 163 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 164 | G_TYPE_POINTER, GDK_TYPE_COLOR, | ||
| 165 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
| 166 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 167 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 168 | G_TYPE_BOOLEAN); | ||
| 169 | model2 = GTK_TREE_MODEL(tree2); | ||
| 170 | |||
| 171 | for (parents[0] = NULL, i = 1; i < 256; i++) | ||
| 172 | parents[i] = (GtkTreeIter *) g_malloc(sizeof(GtkTreeIter)); | ||
| 173 | |||
| 174 | tree1 = gtk_tree_store_new(COL_NUMBER, | ||
| 175 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 176 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 177 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 178 | G_TYPE_POINTER, GDK_TYPE_COLOR, | ||
| 179 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
| 180 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 181 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 182 | G_TYPE_BOOLEAN); | ||
| 183 | model1 = GTK_TREE_MODEL(tree1); | ||
| 184 | } | 136 | } |
| 185 | 137 | ||
| 186 | static void init_left_tree(void) | 138 | static void _update_row_visibility(GtkTreeView *view) |
| 187 | { | 139 | { |
| 188 | GtkTreeView *view = GTK_TREE_VIEW(tree1_w); | 140 | GtkTreeModelFilter *filter = GTK_TREE_MODEL_FILTER(gtk_tree_view_get_model(view)); |
| 189 | GtkCellRenderer *renderer; | ||
| 190 | GtkTreeSelection *sel; | ||
| 191 | GtkTreeViewColumn *column; | ||
| 192 | |||
| 193 | gtk_tree_view_set_model(view, model1); | ||
| 194 | gtk_tree_view_set_headers_visible(view, TRUE); | ||
| 195 | gtk_tree_view_set_rules_hint(view, TRUE); | ||
| 196 | |||
| 197 | column = gtk_tree_view_column_new(); | ||
| 198 | gtk_tree_view_append_column(view, column); | ||
| 199 | gtk_tree_view_column_set_title(column, "Options"); | ||
| 200 | 141 | ||
| 201 | renderer = gtk_cell_renderer_toggle_new(); | 142 | gtk_tree_model_filter_refilter(filter); |
| 202 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 203 | renderer, FALSE); | ||
| 204 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 205 | renderer, | ||
| 206 | "active", COL_BTNACT, | ||
| 207 | "inconsistent", COL_BTNINC, | ||
| 208 | "visible", COL_BTNVIS, | ||
| 209 | "radio", COL_BTNRAD, NULL); | ||
| 210 | renderer = gtk_cell_renderer_text_new(); | ||
| 211 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 212 | renderer, FALSE); | ||
| 213 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 214 | renderer, | ||
| 215 | "text", COL_OPTION, | ||
| 216 | "foreground-gdk", | ||
| 217 | COL_COLOR, NULL); | ||
| 218 | |||
| 219 | sel = gtk_tree_view_get_selection(view); | ||
| 220 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | ||
| 221 | gtk_widget_realize(tree1_w); | ||
| 222 | } | 143 | } |
| 223 | 144 | ||
| 224 | static void renderer_edited(GtkCellRendererText * cell, | 145 | static void update_row_visibility(void) |
| 225 | const gchar * path_string, | 146 | { |
| 226 | const gchar * new_text, gpointer user_data); | 147 | if (view_mode == SPLIT_VIEW) |
| 148 | _update_row_visibility(GTK_TREE_VIEW(tree1_w)); | ||
| 149 | _update_row_visibility(GTK_TREE_VIEW(tree2_w)); | ||
| 150 | } | ||
| 227 | 151 | ||
| 228 | static void init_right_tree(void) | 152 | static void set_node(GtkTreeStore *tree, GtkTreeIter *node, struct menu *menu) |
| 229 | { | 153 | { |
| 230 | GtkTreeView *view = GTK_TREE_VIEW(tree2_w); | 154 | struct symbol *sym = menu->sym; |
| 231 | GtkCellRenderer *renderer; | 155 | tristate val; |
| 232 | GtkTreeSelection *sel; | 156 | gchar *option; |
| 233 | GtkTreeViewColumn *column; | 157 | const gchar *_no = ""; |
| 234 | gint i; | 158 | const gchar *_mod = ""; |
| 159 | const gchar *_yes = ""; | ||
| 160 | const gchar *value = ""; | ||
| 161 | GdkRGBA color; | ||
| 162 | gboolean editable = FALSE; | ||
| 163 | gboolean btnvis = FALSE; | ||
| 164 | |||
| 165 | option = g_strdup_printf("%s %s %s %s", | ||
| 166 | menu->type == M_COMMENT ? "***" : "", | ||
| 167 | menu_get_prompt(menu), | ||
| 168 | menu->type == M_COMMENT ? "***" : "", | ||
| 169 | sym && !sym_has_value(sym) ? "(NEW)" : ""); | ||
| 170 | |||
| 171 | gdk_rgba_parse(&color, menu_is_visible(menu) ? "Black" : "DarkGray"); | ||
| 235 | 172 | ||
| 236 | gtk_tree_view_set_model(view, model2); | 173 | if (!sym) |
| 237 | gtk_tree_view_set_headers_visible(view, TRUE); | 174 | goto set; |
| 238 | gtk_tree_view_set_rules_hint(view, TRUE); | ||
| 239 | 175 | ||
| 240 | column = gtk_tree_view_column_new(); | 176 | sym_calc_value(sym); |
| 241 | gtk_tree_view_append_column(view, column); | ||
| 242 | gtk_tree_view_column_set_title(column, "Options"); | ||
| 243 | 177 | ||
| 244 | renderer = gtk_cell_renderer_pixbuf_new(); | 178 | if (menu->type == M_CHOICE) { // parse children to get a final value |
| 245 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | 179 | struct symbol *def_sym = sym_calc_choice(menu); |
| 246 | renderer, FALSE); | 180 | struct menu *def_menu = NULL; |
| 247 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 248 | renderer, | ||
| 249 | "pixbuf", COL_PIXBUF, | ||
| 250 | "visible", COL_PIXVIS, NULL); | ||
| 251 | renderer = gtk_cell_renderer_toggle_new(); | ||
| 252 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 253 | renderer, FALSE); | ||
| 254 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 255 | renderer, | ||
| 256 | "active", COL_BTNACT, | ||
| 257 | "inconsistent", COL_BTNINC, | ||
| 258 | "visible", COL_BTNVIS, | ||
| 259 | "radio", COL_BTNRAD, NULL); | ||
| 260 | renderer = gtk_cell_renderer_text_new(); | ||
| 261 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 262 | renderer, FALSE); | ||
| 263 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 264 | renderer, | ||
| 265 | "text", COL_OPTION, | ||
| 266 | "foreground-gdk", | ||
| 267 | COL_COLOR, NULL); | ||
| 268 | 181 | ||
| 269 | renderer = gtk_cell_renderer_text_new(); | 182 | for (struct menu *child = menu->list; child; child = child->next) { |
| 270 | gtk_tree_view_insert_column_with_attributes(view, -1, | 183 | if (menu_is_visible(child) && child->sym == def_sym) |
| 271 | "Name", renderer, | 184 | def_menu = child; |
| 272 | "text", COL_NAME, | ||
| 273 | "foreground-gdk", | ||
| 274 | COL_COLOR, NULL); | ||
| 275 | renderer = gtk_cell_renderer_text_new(); | ||
| 276 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 277 | "N", renderer, | ||
| 278 | "text", COL_NO, | ||
| 279 | "foreground-gdk", | ||
| 280 | COL_COLOR, NULL); | ||
| 281 | renderer = gtk_cell_renderer_text_new(); | ||
| 282 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 283 | "M", renderer, | ||
| 284 | "text", COL_MOD, | ||
| 285 | "foreground-gdk", | ||
| 286 | COL_COLOR, NULL); | ||
| 287 | renderer = gtk_cell_renderer_text_new(); | ||
| 288 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 289 | "Y", renderer, | ||
| 290 | "text", COL_YES, | ||
| 291 | "foreground-gdk", | ||
| 292 | COL_COLOR, NULL); | ||
| 293 | renderer = gtk_cell_renderer_text_new(); | ||
| 294 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 295 | "Value", renderer, | ||
| 296 | "text", COL_VALUE, | ||
| 297 | "editable", | ||
| 298 | COL_EDIT, | ||
| 299 | "foreground-gdk", | ||
| 300 | COL_COLOR, NULL); | ||
| 301 | g_signal_connect(G_OBJECT(renderer), "edited", | ||
| 302 | G_CALLBACK(renderer_edited), NULL); | ||
| 303 | |||
| 304 | column = gtk_tree_view_get_column(view, COL_NAME); | ||
| 305 | gtk_tree_view_column_set_visible(column, show_name); | ||
| 306 | column = gtk_tree_view_get_column(view, COL_NO); | ||
| 307 | gtk_tree_view_column_set_visible(column, show_range); | ||
| 308 | column = gtk_tree_view_get_column(view, COL_MOD); | ||
| 309 | gtk_tree_view_column_set_visible(column, show_range); | ||
| 310 | column = gtk_tree_view_get_column(view, COL_YES); | ||
| 311 | gtk_tree_view_column_set_visible(column, show_range); | ||
| 312 | column = gtk_tree_view_get_column(view, COL_VALUE); | ||
| 313 | gtk_tree_view_column_set_visible(column, show_value); | ||
| 314 | |||
| 315 | if (resizeable) { | ||
| 316 | for (i = 0; i < COL_VALUE; i++) { | ||
| 317 | column = gtk_tree_view_get_column(view, i); | ||
| 318 | gtk_tree_view_column_set_resizable(column, TRUE); | ||
| 319 | } | 185 | } |
| 320 | } | ||
| 321 | 186 | ||
| 322 | sel = gtk_tree_view_get_selection(view); | 187 | if (def_menu) |
| 323 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | 188 | value = menu_get_prompt(def_menu); |
| 324 | } | ||
| 325 | 189 | ||
| 190 | goto set; | ||
| 191 | } | ||
| 326 | 192 | ||
| 327 | /* Utility Functions */ | 193 | switch (sym_get_type(sym)) { |
| 194 | case S_BOOLEAN: | ||
| 195 | case S_TRISTATE: | ||
| 328 | 196 | ||
| 197 | btnvis = TRUE; | ||
| 329 | 198 | ||
| 330 | static void text_insert_help(struct menu *menu) | 199 | val = sym_get_tristate_value(sym); |
| 331 | { | 200 | switch (val) { |
| 332 | GtkTextBuffer *buffer; | 201 | case no: |
| 333 | GtkTextIter start, end; | 202 | _no = "N"; |
| 334 | const char *prompt = menu_get_prompt(menu); | 203 | value = "N"; |
| 335 | struct gstr help = str_new(); | 204 | break; |
| 205 | case mod: | ||
| 206 | _mod = "M"; | ||
| 207 | value = "M"; | ||
| 208 | break; | ||
| 209 | case yes: | ||
| 210 | _yes = "Y"; | ||
| 211 | value = "Y"; | ||
| 212 | break; | ||
| 213 | } | ||
| 336 | 214 | ||
| 337 | menu_get_ext_help(menu, &help); | 215 | if (val != no && sym_tristate_within_range(sym, no)) |
| 216 | _no = "_"; | ||
| 217 | if (val != mod && sym_tristate_within_range(sym, mod)) | ||
| 218 | _mod = "_"; | ||
| 219 | if (val != yes && sym_tristate_within_range(sym, yes)) | ||
| 220 | _yes = "_"; | ||
| 221 | break; | ||
| 222 | default: | ||
| 223 | value = sym_get_string_value(sym); | ||
| 224 | editable = TRUE; | ||
| 225 | break; | ||
| 226 | } | ||
| 338 | 227 | ||
| 339 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 228 | set: |
| 340 | gtk_text_buffer_get_bounds(buffer, &start, &end); | 229 | gtk_tree_store_set(tree, node, |
| 341 | gtk_text_buffer_delete(buffer, &start, &end); | 230 | COL_OPTION, option, |
| 342 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); | 231 | COL_NAME, sym ? sym->name : "", |
| 232 | COL_NO, _no, | ||
| 233 | COL_MOD, _mod, | ||
| 234 | COL_YES, _yes, | ||
| 235 | COL_VALUE, value, | ||
| 236 | COL_MENU, (gpointer) menu, | ||
| 237 | COL_COLOR, &color, | ||
| 238 | COL_EDIT, editable, | ||
| 239 | COL_PIXBUF, pix_menu, | ||
| 240 | COL_PIXVIS, view_mode == SINGLE_VIEW && menu->type == M_MENU, | ||
| 241 | COL_BTNVIS, btnvis, | ||
| 242 | COL_BTNACT, _yes[0] == 'Y', | ||
| 243 | COL_BTNINC, _mod[0] == 'M', | ||
| 244 | COL_BTNRAD, sym && sym_is_choice_value(sym), | ||
| 245 | -1); | ||
| 343 | 246 | ||
| 344 | gtk_text_buffer_get_end_iter(buffer, &end); | 247 | g_free(option); |
| 345 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, | ||
| 346 | NULL); | ||
| 347 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | ||
| 348 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 349 | gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2, | ||
| 350 | NULL); | ||
| 351 | str_free(&help); | ||
| 352 | } | 248 | } |
| 353 | 249 | ||
| 354 | 250 | static void _update_tree(GtkTreeStore *store, GtkTreeIter *parent) | |
| 355 | static void text_insert_msg(const char *title, const char *message) | ||
| 356 | { | 251 | { |
| 357 | GtkTextBuffer *buffer; | 252 | GtkTreeModel *model = GTK_TREE_MODEL(store); |
| 358 | GtkTextIter start, end; | 253 | GtkTreeIter iter; |
| 359 | const char *msg = message; | 254 | gboolean valid; |
| 360 | 255 | ||
| 361 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 256 | valid = gtk_tree_model_iter_children(model, &iter, parent); |
| 362 | gtk_text_buffer_get_bounds(buffer, &start, &end); | 257 | while (valid) { |
| 363 | gtk_text_buffer_delete(buffer, &start, &end); | 258 | struct menu *menu; |
| 364 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); | ||
| 365 | 259 | ||
| 366 | gtk_text_buffer_get_end_iter(buffer, &end); | 260 | gtk_tree_model_get(model, &iter, COL_MENU, &menu, -1); |
| 367 | gtk_text_buffer_insert_with_tags(buffer, &end, title, -1, tag1, | ||
| 368 | NULL); | ||
| 369 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | ||
| 370 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 371 | gtk_text_buffer_insert_with_tags(buffer, &end, msg, -1, tag2, | ||
| 372 | NULL); | ||
| 373 | } | ||
| 374 | 261 | ||
| 262 | if (menu) | ||
| 263 | set_node(store, &iter, menu); | ||
| 375 | 264 | ||
| 376 | /* Main Windows Callbacks */ | 265 | _update_tree(store, &iter); |
| 266 | |||
| 267 | valid = gtk_tree_model_iter_next(model, &iter); | ||
| 268 | } | ||
| 269 | } | ||
| 377 | 270 | ||
| 378 | void on_save_activate(GtkMenuItem * menuitem, gpointer user_data); | 271 | static void update_tree(GtkTreeStore *store) |
| 379 | gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, | ||
| 380 | gpointer user_data) | ||
| 381 | { | 272 | { |
| 382 | GtkWidget *dialog, *label; | 273 | _update_tree(store, NULL); |
| 383 | gint result; | 274 | update_row_visibility(); |
| 275 | } | ||
| 384 | 276 | ||
| 385 | if (!conf_get_changed()) | 277 | static void update_trees(void) |
| 386 | return FALSE; | 278 | { |
| 279 | if (view_mode == SPLIT_VIEW) | ||
| 280 | update_tree(tree1); | ||
| 281 | update_tree(tree2); | ||
| 282 | } | ||
| 387 | 283 | ||
| 388 | dialog = gtk_dialog_new_with_buttons("Warning !", | 284 | static void set_view_mode(enum view_mode mode) |
| 389 | GTK_WINDOW(main_wnd), | 285 | { |
| 390 | (GtkDialogFlags) | 286 | view_mode = mode; |
| 391 | (GTK_DIALOG_MODAL | | ||
| 392 | GTK_DIALOG_DESTROY_WITH_PARENT), | ||
| 393 | GTK_STOCK_OK, | ||
| 394 | GTK_RESPONSE_YES, | ||
| 395 | GTK_STOCK_NO, | ||
| 396 | GTK_RESPONSE_NO, | ||
| 397 | GTK_STOCK_CANCEL, | ||
| 398 | GTK_RESPONSE_CANCEL, NULL); | ||
| 399 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), | ||
| 400 | GTK_RESPONSE_CANCEL); | ||
| 401 | 287 | ||
| 402 | label = gtk_label_new("\nSave configuration ?\n"); | 288 | if (mode == SPLIT_VIEW) { // two panes |
| 403 | gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); | 289 | gint w; |
| 404 | gtk_widget_show(label); | ||
| 405 | 290 | ||
| 406 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | 291 | gtk_widget_show(tree1_w); |
| 407 | switch (result) { | 292 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, NULL); |
| 408 | case GTK_RESPONSE_YES: | 293 | gtk_paned_set_position(GTK_PANED(hpaned), w / 2); |
| 409 | on_save_activate(NULL, NULL); | 294 | } else { |
| 410 | return FALSE; | 295 | gtk_widget_hide(tree1_w); |
| 411 | case GTK_RESPONSE_NO: | 296 | gtk_paned_set_position(GTK_PANED(hpaned), 0); |
| 412 | return FALSE; | ||
| 413 | case GTK_RESPONSE_CANCEL: | ||
| 414 | case GTK_RESPONSE_DELETE_EVENT: | ||
| 415 | default: | ||
| 416 | gtk_widget_destroy(dialog); | ||
| 417 | return TRUE; | ||
| 418 | } | 297 | } |
| 419 | 298 | ||
| 420 | return FALSE; | 299 | gtk_widget_set_sensitive(single_btn, TRUE); |
| 421 | } | 300 | gtk_widget_set_sensitive(split_btn, TRUE); |
| 301 | gtk_widget_set_sensitive(full_btn, TRUE); | ||
| 422 | 302 | ||
| 303 | switch (mode) { | ||
| 304 | case SINGLE_VIEW: | ||
| 305 | if (selected) | ||
| 306 | browsed = menu_get_parent_menu(selected) ?: &rootmenu; | ||
| 307 | else | ||
| 308 | browsed = &rootmenu; | ||
| 309 | recreate_tree(); | ||
| 310 | text_insert_msg("", ""); | ||
| 311 | select_menu(GTK_TREE_VIEW(tree2_w), selected); | ||
| 312 | gtk_widget_set_sensitive(single_btn, FALSE); | ||
| 313 | break; | ||
| 314 | case SPLIT_VIEW: | ||
| 315 | browsed = selected; | ||
| 316 | while (browsed && !(browsed->flags & MENU_ROOT)) | ||
| 317 | browsed = browsed->parent; | ||
| 318 | gtk_tree_store_clear(tree1); | ||
| 319 | display_tree(tree1, &rootmenu); | ||
| 320 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree1_w)); | ||
| 321 | gtk_tree_store_clear(tree2); | ||
| 322 | if (browsed) | ||
| 323 | display_tree(tree2, browsed); | ||
| 324 | text_insert_msg("", ""); | ||
| 325 | select_menu(GTK_TREE_VIEW(tree1_w), browsed); | ||
| 326 | select_menu(GTK_TREE_VIEW(tree2_w), selected); | ||
| 327 | gtk_widget_set_sensitive(split_btn, FALSE); | ||
| 328 | break; | ||
| 329 | case FULL_VIEW: | ||
| 330 | gtk_tree_store_clear(tree2); | ||
| 331 | display_tree(tree2, &rootmenu); | ||
| 332 | text_insert_msg("", ""); | ||
| 333 | select_menu(GTK_TREE_VIEW(tree2_w), selected); | ||
| 334 | gtk_widget_set_sensitive(full_btn, FALSE); | ||
| 335 | break; | ||
| 336 | } | ||
| 423 | 337 | ||
| 424 | void on_window1_destroy(GtkObject * object, gpointer user_data) | 338 | gtk_widget_set_sensitive(back_btn, |
| 425 | { | 339 | mode == SINGLE_VIEW && browsed != &rootmenu); |
| 426 | gtk_main_quit(); | ||
| 427 | } | 340 | } |
| 428 | 341 | ||
| 342 | /* Menu & Toolbar Callbacks */ | ||
| 429 | 343 | ||
| 430 | void | 344 | static void on_load1_activate(GtkMenuItem *menuitem, gpointer user_data) |
| 431 | on_window1_size_request(GtkWidget * widget, | ||
| 432 | GtkRequisition * requisition, gpointer user_data) | ||
| 433 | { | 345 | { |
| 434 | static gint old_h; | 346 | GtkWidget *dialog; |
| 435 | gint w, h; | 347 | GtkFileChooser *chooser; |
| 436 | 348 | gint res; | |
| 437 | if (widget->window == NULL) | ||
| 438 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); | ||
| 439 | else | ||
| 440 | gdk_window_get_size(widget->window, &w, &h); | ||
| 441 | |||
| 442 | if (h == old_h) | ||
| 443 | return; | ||
| 444 | old_h = h; | ||
| 445 | |||
| 446 | gtk_paned_set_position(GTK_PANED(vpaned), 2 * h / 3); | ||
| 447 | } | ||
| 448 | 349 | ||
| 350 | dialog = gtk_file_chooser_dialog_new("Load file...", | ||
| 351 | GTK_WINDOW(user_data), | ||
| 352 | GTK_FILE_CHOOSER_ACTION_OPEN, | ||
| 353 | "_Cancel", GTK_RESPONSE_CANCEL, | ||
| 354 | "_Open", GTK_RESPONSE_ACCEPT, | ||
| 355 | NULL); | ||
| 449 | 356 | ||
| 450 | /* Menu & Toolbar Callbacks */ | 357 | chooser = GTK_FILE_CHOOSER(dialog); |
| 358 | gtk_file_chooser_set_filename(chooser, conf_get_configname()); | ||
| 451 | 359 | ||
| 360 | res = gtk_dialog_run(GTK_DIALOG(dialog)); | ||
| 361 | if (res == GTK_RESPONSE_ACCEPT) { | ||
| 362 | char *filename; | ||
| 452 | 363 | ||
| 453 | static void | 364 | filename = gtk_file_chooser_get_filename(chooser); |
| 454 | load_filename(GtkFileSelection * file_selector, gpointer user_data) | ||
| 455 | { | ||
| 456 | const gchar *fn; | ||
| 457 | 365 | ||
| 458 | fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION | 366 | if (conf_read(filename)) |
| 459 | (user_data)); | 367 | text_insert_msg("Error", |
| 368 | "Unable to load configuration!"); | ||
| 369 | else | ||
| 370 | update_trees(); | ||
| 460 | 371 | ||
| 461 | if (conf_read(fn)) | 372 | g_free(filename); |
| 462 | text_insert_msg("Error", "Unable to load configuration !"); | 373 | } |
| 463 | else | ||
| 464 | display_tree_part(); | ||
| 465 | } | ||
| 466 | 374 | ||
| 467 | void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data) | 375 | gtk_widget_destroy(GTK_WIDGET(dialog)); |
| 468 | { | ||
| 469 | GtkWidget *fs; | ||
| 470 | |||
| 471 | fs = gtk_file_selection_new("Load file..."); | ||
| 472 | g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), | ||
| 473 | "clicked", | ||
| 474 | G_CALLBACK(load_filename), (gpointer) fs); | ||
| 475 | g_signal_connect_swapped(GTK_OBJECT | ||
| 476 | (GTK_FILE_SELECTION(fs)->ok_button), | ||
| 477 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 478 | (gpointer) fs); | ||
| 479 | g_signal_connect_swapped(GTK_OBJECT | ||
| 480 | (GTK_FILE_SELECTION(fs)->cancel_button), | ||
| 481 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 482 | (gpointer) fs); | ||
| 483 | gtk_widget_show(fs); | ||
| 484 | } | 376 | } |
| 485 | 377 | ||
| 486 | 378 | static void on_save_activate(GtkMenuItem *menuitem, gpointer user_data) | |
| 487 | void on_save_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 488 | { | 379 | { |
| 489 | if (conf_write(NULL)) | 380 | if (conf_write(NULL)) |
| 490 | text_insert_msg("Error", "Unable to save configuration !"); | 381 | text_insert_msg("Error", "Unable to save configuration !"); |
| 491 | conf_write_autoconf(0); | 382 | conf_write_autoconf(0); |
| 492 | } | 383 | } |
| 493 | 384 | ||
| 494 | 385 | static void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data) | |
| 495 | static void | ||
| 496 | store_filename(GtkFileSelection * file_selector, gpointer user_data) | ||
| 497 | { | 386 | { |
| 498 | const gchar *fn; | 387 | GtkWidget *dialog; |
| 388 | GtkFileChooser *chooser; | ||
| 389 | gint res; | ||
| 499 | 390 | ||
| 500 | fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION | 391 | dialog = gtk_file_chooser_dialog_new("Save file as...", |
| 501 | (user_data)); | 392 | GTK_WINDOW(user_data), |
| 393 | GTK_FILE_CHOOSER_ACTION_SAVE, | ||
| 394 | "_Cancel", GTK_RESPONSE_CANCEL, | ||
| 395 | "_Save", GTK_RESPONSE_ACCEPT, | ||
| 396 | NULL); | ||
| 502 | 397 | ||
| 503 | if (conf_write(fn)) | 398 | chooser = GTK_FILE_CHOOSER(dialog); |
| 504 | text_insert_msg("Error", "Unable to save configuration !"); | 399 | gtk_file_chooser_set_filename(chooser, conf_get_configname()); |
| 505 | 400 | ||
| 506 | gtk_widget_destroy(GTK_WIDGET(user_data)); | 401 | res = gtk_dialog_run(GTK_DIALOG(dialog)); |
| 507 | } | 402 | if (res == GTK_RESPONSE_ACCEPT) { |
| 403 | char *filename; | ||
| 508 | 404 | ||
| 509 | void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data) | 405 | filename = gtk_file_chooser_get_filename(chooser); |
| 510 | { | ||
| 511 | GtkWidget *fs; | ||
| 512 | |||
| 513 | fs = gtk_file_selection_new("Save file as..."); | ||
| 514 | g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), | ||
| 515 | "clicked", | ||
| 516 | G_CALLBACK(store_filename), (gpointer) fs); | ||
| 517 | g_signal_connect_swapped(GTK_OBJECT | ||
| 518 | (GTK_FILE_SELECTION(fs)->ok_button), | ||
| 519 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 520 | (gpointer) fs); | ||
| 521 | g_signal_connect_swapped(GTK_OBJECT | ||
| 522 | (GTK_FILE_SELECTION(fs)->cancel_button), | ||
| 523 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 524 | (gpointer) fs); | ||
| 525 | gtk_widget_show(fs); | ||
| 526 | } | ||
| 527 | 406 | ||
| 407 | if (conf_write(filename)) | ||
| 408 | text_insert_msg("Error", | ||
| 409 | "Unable to save configuration !"); | ||
| 528 | 410 | ||
| 529 | void on_quit1_activate(GtkMenuItem * menuitem, gpointer user_data) | 411 | g_free(filename); |
| 530 | { | 412 | } |
| 531 | if (!on_window1_delete_event(NULL, NULL, NULL)) | ||
| 532 | gtk_widget_destroy(GTK_WIDGET(main_wnd)); | ||
| 533 | } | ||
| 534 | 413 | ||
| 414 | gtk_widget_destroy(dialog); | ||
| 415 | } | ||
| 535 | 416 | ||
| 536 | void on_show_name1_activate(GtkMenuItem * menuitem, gpointer user_data) | 417 | static void on_show_name1_activate(GtkMenuItem *menuitem, gpointer user_data) |
| 537 | { | 418 | { |
| 538 | GtkTreeViewColumn *col; | 419 | GtkTreeViewColumn *col; |
| 539 | 420 | ||
| 540 | show_name = GTK_CHECK_MENU_ITEM(menuitem)->active; | 421 | show_name = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)); |
| 541 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NAME); | 422 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NAME); |
| 542 | if (col) | 423 | if (col) |
| 543 | gtk_tree_view_column_set_visible(col, show_name); | 424 | gtk_tree_view_column_set_visible(col, show_name); |
| 544 | } | 425 | } |
| 545 | 426 | ||
| 546 | 427 | static void on_show_range1_activate(GtkMenuItem *menuitem, gpointer user_data) | |
| 547 | void on_show_range1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 548 | { | 428 | { |
| 549 | GtkTreeViewColumn *col; | 429 | GtkTreeViewColumn *col; |
| 550 | 430 | ||
| 551 | show_range = GTK_CHECK_MENU_ITEM(menuitem)->active; | 431 | show_range = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)); |
| 552 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NO); | 432 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NO); |
| 553 | if (col) | 433 | if (col) |
| 554 | gtk_tree_view_column_set_visible(col, show_range); | 434 | gtk_tree_view_column_set_visible(col, show_range); |
| @@ -561,46 +441,38 @@ void on_show_range1_activate(GtkMenuItem * menuitem, gpointer user_data) · 6 unmodified lines | |||
| 561 | 441 | ||
| 562 | } | 442 | } |
| 563 | 443 | ||
| 564 | 444 | static void on_show_data1_activate(GtkMenuItem *menuitem, gpointer user_data) | |
| 565 | void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 566 | { | 445 | { |
| 567 | GtkTreeViewColumn *col; | 446 | GtkTreeViewColumn *col; |
| 568 | 447 | ||
| 569 | show_value = GTK_CHECK_MENU_ITEM(menuitem)->active; | 448 | show_value = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)); |
| 570 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_VALUE); | 449 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_VALUE); |
| 571 | if (col) | 450 | if (col) |
| 572 | gtk_tree_view_column_set_visible(col, show_value); | 451 | gtk_tree_view_column_set_visible(col, show_value); |
| 573 | } | 452 | } |
| 574 | 453 | ||
| 575 | 454 | static void on_set_option_mode1_activate(GtkMenuItem *menuitem, | |
| 576 | void | 455 | gpointer user_data) |
| 577 | on_set_option_mode1_activate(GtkMenuItem *menuitem, gpointer user_data) | ||
| 578 | { | 456 | { |
| 579 | opt_mode = OPT_NORMAL; | 457 | opt_mode = OPT_NORMAL; |
| 580 | gtk_tree_store_clear(tree2); | 458 | update_row_visibility(); |
| 581 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ | ||
| 582 | } | 459 | } |
| 583 | 460 | ||
| 584 | 461 | static void on_set_option_mode2_activate(GtkMenuItem *menuitem, | |
| 585 | void | 462 | gpointer user_data) |
| 586 | on_set_option_mode2_activate(GtkMenuItem *menuitem, gpointer user_data) | ||
| 587 | { | 463 | { |
| 588 | opt_mode = OPT_ALL; | 464 | opt_mode = OPT_ALL; |
| 589 | gtk_tree_store_clear(tree2); | 465 | update_row_visibility(); |
| 590 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ | ||
| 591 | } | 466 | } |
| 592 | 467 | ||
| 593 | 468 | static void on_set_option_mode3_activate(GtkMenuItem *menuitem, | |
| 594 | void | 469 | gpointer user_data) |
| 595 | on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data) | ||
| 596 | { | 470 | { |
| 597 | opt_mode = OPT_PROMPT; | 471 | opt_mode = OPT_PROMPT; |
| 598 | gtk_tree_store_clear(tree2); | 472 | update_row_visibility(); |
| 599 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ | ||
| 600 | } | 473 | } |
| 601 | 474 | ||
| 602 | 475 | static void on_introduction1_activate(GtkMenuItem *menuitem, gpointer user_data) | |
| 603 | void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 604 | { | 476 | { |
| 605 | GtkWidget *dialog; | 477 | GtkWidget *dialog; |
| 606 | const gchar *intro_text = | 478 | const gchar *intro_text = |
| @@ -621,14 +493,11 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) · 14 unmodified lines | |||
| 621 | GTK_DIALOG_DESTROY_WITH_PARENT, | 493 | GTK_DIALOG_DESTROY_WITH_PARENT, |
| 622 | GTK_MESSAGE_INFO, | 494 | GTK_MESSAGE_INFO, |
| 623 | GTK_BUTTONS_CLOSE, "%s", intro_text); | 495 | GTK_BUTTONS_CLOSE, "%s", intro_text); |
| 624 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | 496 | gtk_dialog_run(GTK_DIALOG(dialog)); |
| 625 | G_CALLBACK(gtk_widget_destroy), | 497 | gtk_widget_destroy(dialog); |
| 626 | GTK_OBJECT(dialog)); | ||
| 627 | gtk_widget_show_all(dialog); | ||
| 628 | } | 498 | } |
| 629 | 499 | ||
| 630 | 500 | static void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data) | |
| 631 | void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 632 | { | 501 | { |
| 633 | GtkWidget *dialog; | 502 | GtkWidget *dialog; |
| 634 | const gchar *about_text = | 503 | const gchar *about_text = |
| @@ -638,15 +507,16 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) · 3 unmodified lines | |||
| 638 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), | 507 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), |
| 639 | GTK_DIALOG_DESTROY_WITH_PARENT, | 508 | GTK_DIALOG_DESTROY_WITH_PARENT, |
| 640 | GTK_MESSAGE_INFO, | 509 | GTK_MESSAGE_INFO, |
| 641 | GTK_BUTTONS_CLOSE, "%s", about_text); | 510 | GTK_BUTTONS_CLOSE, "%s\nGTK version: %d.%d.%d", |
| 642 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | 511 | about_text, |
| 643 | G_CALLBACK(gtk_widget_destroy), | 512 | gtk_get_major_version(), |
| 644 | GTK_OBJECT(dialog)); | 513 | gtk_get_minor_version(), |
| 645 | gtk_widget_show_all(dialog); | 514 | gtk_get_micro_version()); |
| 515 | gtk_dialog_run(GTK_DIALOG(dialog)); | ||
| 516 | gtk_widget_destroy(dialog); | ||
| 646 | } | 517 | } |
| 647 | 518 | ||
| 648 | 519 | static void on_license1_activate(GtkMenuItem *menuitem, gpointer user_data) | |
| 649 | void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 650 | { | 520 | { |
| 651 | GtkWidget *dialog; | 521 | GtkWidget *dialog; |
| 652 | const gchar *license_text = | 522 | const gchar *license_text = |
| @@ -658,81 +528,127 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data) · 5 unmodified lines | |||
| 658 | GTK_DIALOG_DESTROY_WITH_PARENT, | 528 | GTK_DIALOG_DESTROY_WITH_PARENT, |
| 659 | GTK_MESSAGE_INFO, | 529 | GTK_MESSAGE_INFO, |
| 660 | GTK_BUTTONS_CLOSE, "%s", license_text); | 530 | GTK_BUTTONS_CLOSE, "%s", license_text); |
| 661 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | 531 | gtk_dialog_run(GTK_DIALOG(dialog)); |
| 662 | G_CALLBACK(gtk_widget_destroy), | 532 | gtk_widget_destroy(dialog); |
| 663 | GTK_OBJECT(dialog)); | ||
| 664 | gtk_widget_show_all(dialog); | ||
| 665 | } | 533 | } |
| 666 | 534 | ||
| 667 | 535 | /* toolbar handlers */ | |
| 668 | void on_back_clicked(GtkButton * button, gpointer user_data) | 536 | static void on_back_clicked(GtkButton *button, gpointer user_data) |
| 669 | { | 537 | { |
| 670 | enum prop_type ptype; | 538 | browsed = menu_get_parent_menu(browsed) ?: &rootmenu; |
| 671 | 539 | ||
| 672 | current = current->parent; | 540 | recreate_tree(); |
| 673 | ptype = current->prompt ? current->prompt->type : P_UNKNOWN; | ||
| 674 | if (ptype != P_MENU) | ||
| 675 | current = current->parent; | ||
| 676 | display_tree_part(); | ||
| 677 | 541 | ||
| 678 | if (current == &rootmenu) | 542 | if (browsed == &rootmenu) |
| 679 | gtk_widget_set_sensitive(back_btn, FALSE); | 543 | gtk_widget_set_sensitive(back_btn, FALSE); |
| 680 | } | 544 | } |
| 681 | 545 | ||
| 682 | 546 | static void on_load_clicked(GtkButton *button, gpointer user_data) | |
| 683 | void on_load_clicked(GtkButton * button, gpointer user_data) | ||
| 684 | { | 547 | { |
| 685 | on_load1_activate(NULL, user_data); | 548 | on_load1_activate(NULL, user_data); |
| 686 | } | 549 | } |
| 687 | 550 | ||
| 688 | 551 | static void on_save_clicked(GtkButton *button, gpointer user_data) | |
| 689 | void on_single_clicked(GtkButton * button, gpointer user_data) | ||
| 690 | { | 552 | { |
| 691 | view_mode = SINGLE_VIEW; | 553 | on_save_activate(NULL, user_data); |
| 692 | gtk_widget_hide(tree1_w); | ||
| 693 | current = &rootmenu; | ||
| 694 | display_tree_part(); | ||
| 695 | } | 554 | } |
| 696 | 555 | ||
| 556 | static void on_single_clicked(GtkButton *button, gpointer user_data) | ||
| 557 | { | ||
| 558 | set_view_mode(SINGLE_VIEW); | ||
| 559 | } | ||
| 697 | 560 | ||
| 698 | void on_split_clicked(GtkButton * button, gpointer user_data) | 561 | static void on_split_clicked(GtkButton *button, gpointer user_data) |
| 699 | { | 562 | { |
| 700 | gint w, h; | 563 | set_view_mode(SPLIT_VIEW); |
| 701 | view_mode = SPLIT_VIEW; | 564 | } |
| 702 | gtk_widget_show(tree1_w); | ||
| 703 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); | ||
| 704 | gtk_paned_set_position(GTK_PANED(hpaned), w / 2); | ||
| 705 | if (tree2) | ||
| 706 | gtk_tree_store_clear(tree2); | ||
| 707 | display_list(); | ||
| 708 | 565 | ||
| 709 | /* Disable back btn, like in full mode. */ | 566 | static void on_full_clicked(GtkButton *button, gpointer user_data) |
| 710 | gtk_widget_set_sensitive(back_btn, FALSE); | 567 | { |
| 568 | set_view_mode(FULL_VIEW); | ||
| 711 | } | 569 | } |
| 712 | 570 | ||
| 571 | static void on_collapse_clicked(GtkButton *button, gpointer user_data) | ||
| 572 | { | ||
| 573 | gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w)); | ||
| 574 | } | ||
| 713 | 575 | ||
| 714 | void on_full_clicked(GtkButton * button, gpointer user_data) | 576 | static void on_expand_clicked(GtkButton *button, gpointer user_data) |
| 715 | { | 577 | { |
| 716 | view_mode = FULL_VIEW; | 578 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); |
| 717 | gtk_widget_hide(tree1_w); | ||
| 718 | if (tree2) | ||
| 719 | gtk_tree_store_clear(tree2); | ||
| 720 | display_tree(&rootmenu); | ||
| 721 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
| 722 | } | 579 | } |
| 723 | 580 | ||
| 581 | /* Main Windows Callbacks */ | ||
| 724 | 582 | ||
| 725 | void on_collapse_clicked(GtkButton * button, gpointer user_data) | 583 | static void on_window1_destroy(GtkWidget *widget, gpointer user_data) |
| 726 | { | 584 | { |
| 727 | gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w)); | 585 | gtk_main_quit(); |
| 728 | } | 586 | } |
| 729 | 587 | ||
| 588 | static gboolean on_window1_configure(GtkWidget *self, | ||
| 589 | GdkEventConfigure *event, | ||
| 590 | gpointer user_data) | ||
| 591 | { | ||
| 592 | gtk_paned_set_position(GTK_PANED(vpaned), 2 * event->height / 3); | ||
| 593 | return FALSE; | ||
| 594 | } | ||
| 730 | 595 | ||
| 731 | void on_expand_clicked(GtkButton * button, gpointer user_data) | 596 | static gboolean on_window1_delete_event(GtkWidget *widget, GdkEvent *event, |
| 597 | gpointer user_data) | ||
| 732 | { | 598 | { |
| 733 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | 599 | GtkWidget *dialog, *label, *content_area; |
| 600 | gint result; | ||
| 601 | gint ret = FALSE; | ||
| 602 | |||
| 603 | if (!conf_get_changed()) | ||
| 604 | return FALSE; | ||
| 605 | |||
| 606 | dialog = gtk_dialog_new_with_buttons("Warning !", | ||
| 607 | GTK_WINDOW(main_wnd), | ||
| 608 | (GtkDialogFlags) | ||
| 609 | (GTK_DIALOG_MODAL | | ||
| 610 | GTK_DIALOG_DESTROY_WITH_PARENT), | ||
| 611 | "_OK", | ||
| 612 | GTK_RESPONSE_YES, | ||
| 613 | "_No", | ||
| 614 | GTK_RESPONSE_NO, | ||
| 615 | "_Cancel", | ||
| 616 | GTK_RESPONSE_CANCEL, NULL); | ||
| 617 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), | ||
| 618 | GTK_RESPONSE_CANCEL); | ||
| 619 | |||
| 620 | label = gtk_label_new("\nSave configuration ?\n"); | ||
| 621 | content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); | ||
| 622 | gtk_container_add(GTK_CONTAINER(content_area), label); | ||
| 623 | gtk_widget_show(label); | ||
| 624 | |||
| 625 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | ||
| 626 | switch (result) { | ||
| 627 | case GTK_RESPONSE_YES: | ||
| 628 | on_save_activate(NULL, NULL); | ||
| 629 | break; | ||
| 630 | case GTK_RESPONSE_NO: | ||
| 631 | break; | ||
| 632 | case GTK_RESPONSE_CANCEL: | ||
| 633 | case GTK_RESPONSE_DELETE_EVENT: | ||
| 634 | default: | ||
| 635 | ret = TRUE; | ||
| 636 | break; | ||
| 637 | } | ||
| 638 | |||
| 639 | gtk_widget_destroy(dialog); | ||
| 640 | |||
| 641 | if (!ret) | ||
| 642 | g_object_unref(pix_menu); | ||
| 643 | |||
| 644 | return ret; | ||
| 734 | } | 645 | } |
| 735 | 646 | ||
| 647 | static void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data) | ||
| 648 | { | ||
| 649 | if (!on_window1_delete_event(NULL, NULL, NULL)) | ||
| 650 | gtk_widget_destroy(GTK_WIDGET(main_wnd)); | ||
| 651 | } | ||
| 736 | 652 | ||
| 737 | /* CTree Callbacks */ | 653 | /* CTree Callbacks */ |
| 738 | 654 | ||
| @@ -741,25 +657,28 @@ static void renderer_edited(GtkCellRendererText * cell, · 2 unmodified lines | |||
| 741 | const gchar * path_string, | 657 | const gchar * path_string, |
| 742 | const gchar * new_text, gpointer user_data) | 658 | const gchar * new_text, gpointer user_data) |
| 743 | { | 659 | { |
| 660 | GtkTreeView *view = GTK_TREE_VIEW(user_data); | ||
| 661 | GtkTreeModel *model = gtk_tree_view_get_model(view); | ||
| 744 | GtkTreePath *path = gtk_tree_path_new_from_string(path_string); | 662 | GtkTreePath *path = gtk_tree_path_new_from_string(path_string); |
| 745 | GtkTreeIter iter; | 663 | GtkTreeIter iter; |
| 746 | const char *old_def, *new_def; | 664 | const char *old_def, *new_def; |
| 747 | struct menu *menu; | 665 | struct menu *menu; |
| 748 | struct symbol *sym; | 666 | struct symbol *sym; |
| 749 | 667 | ||
| 750 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | 668 | if (!gtk_tree_model_get_iter(model, &iter, path)) |
| 751 | return; | 669 | goto free; |
| 752 | 670 | ||
| 753 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | 671 | gtk_tree_model_get(model, &iter, COL_MENU, &menu, -1); |
| 754 | sym = menu->sym; | 672 | sym = menu->sym; |
| 755 | 673 | ||
| 756 | gtk_tree_model_get(model2, &iter, COL_VALUE, &old_def, -1); | 674 | gtk_tree_model_get(model, &iter, COL_VALUE, &old_def, -1); |
| 757 | new_def = new_text; | 675 | new_def = new_text; |
| 758 | 676 | ||
| 759 | sym_set_string_value(sym, new_def); | 677 | sym_set_string_value(sym, new_def); |
| 760 | 678 | ||
| 761 | update_tree(&rootmenu, NULL); | 679 | update_trees(); |
| 762 | 680 | ||
| 681 | free: | ||
| 763 | gtk_tree_path_free(path); | 682 | gtk_tree_path_free(path); |
| 764 | } | 683 | } |
| 765 | 684 | ||
| @@ -787,14 +706,7 @@ static void change_sym_value(struct menu *menu, gint col) · 21 unmodified lines | |||
| 787 | if (!sym_tristate_within_range(sym, newval)) | 706 | if (!sym_tristate_within_range(sym, newval)) |
| 788 | newval = yes; | 707 | newval = yes; |
| 789 | sym_set_tristate_value(sym, newval); | 708 | sym_set_tristate_value(sym, newval); |
| 790 | if (view_mode == FULL_VIEW) | 709 | update_trees(); |
| 791 | update_tree(&rootmenu, NULL); | ||
| 792 | else if (view_mode == SPLIT_VIEW) { | ||
| 793 | update_tree(browsed, NULL); | ||
| 794 | display_list(); | ||
| 795 | } | ||
| 796 | else if (view_mode == SINGLE_VIEW) | ||
| 797 | display_tree_part(); //fixme: keep exp/coll | ||
| 798 | break; | 710 | break; |
| 799 | case S_INT: | 711 | case S_INT: |
| 800 | case S_HEX: | 712 | case S_HEX: |
| @@ -810,14 +722,7 @@ static void toggle_sym_value(struct menu *menu) · 9 unmodified lines | |||
| 810 | return; | 722 | return; |
| 811 | 723 | ||
| 812 | sym_toggle_tristate_value(menu->sym); | 724 | sym_toggle_tristate_value(menu->sym); |
| 813 | if (view_mode == FULL_VIEW) | 725 | update_trees(); |
| 814 | update_tree(&rootmenu, NULL); | ||
| 815 | else if (view_mode == SPLIT_VIEW) { | ||
| 816 | update_tree(browsed, NULL); | ||
| 817 | display_list(); | ||
| 818 | } | ||
| 819 | else if (view_mode == SINGLE_VIEW) | ||
| 820 | display_tree_part(); //fixme: keep exp/coll | ||
| 821 | } | 726 | } |
| 822 | 727 | ||
| 823 | static gint column2index(GtkTreeViewColumn * column) | 728 | static gint column2index(GtkTreeViewColumn * column) |
| @@ -837,43 +742,39 @@ static gint column2index(GtkTreeViewColumn * column) · 13 unmodified lines | |||
| 837 | 742 | ||
| 838 | 743 | ||
| 839 | /* User click: update choice (full) or goes down (single) */ | 744 | /* User click: update choice (full) or goes down (single) */ |
| 840 | gboolean | 745 | static gboolean on_treeview2_button_press_event(GtkWidget *widget, |
| 841 | on_treeview2_button_press_event(GtkWidget * widget, | 746 | GdkEventButton *event, |
| 842 | GdkEventButton * event, gpointer user_data) | 747 | gpointer user_data) |
| 843 | { | 748 | { |
| 844 | GtkTreeView *view = GTK_TREE_VIEW(widget); | 749 | GtkTreeView *view = GTK_TREE_VIEW(widget); |
| 750 | GtkTreeModel *model = gtk_tree_view_get_model(view); | ||
| 845 | GtkTreePath *path; | 751 | GtkTreePath *path; |
| 846 | GtkTreeViewColumn *column; | 752 | GtkTreeViewColumn *column; |
| 847 | GtkTreeIter iter; | 753 | GtkTreeIter iter; |
| 848 | struct menu *menu; | 754 | struct menu *menu; |
| 849 | gint col; | 755 | gint col; |
| 850 | |||
| 851 | #if GTK_CHECK_VERSION(2,1,4) // bug in ctree with earlier version of GTK | ||
| 852 | gint tx = (gint) event->x; | 756 | gint tx = (gint) event->x; |
| 853 | gint ty = (gint) event->y; | 757 | gint ty = (gint) event->y; |
| 854 | gint cx, cy; | ||
| 855 | 758 | ||
| 856 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, &cx, | 759 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, NULL, NULL); |
| 857 | &cy); | ||
| 858 | #else | ||
| 859 | gtk_tree_view_get_cursor(view, &path, &column); | ||
| 860 | #endif | ||
| 861 | if (path == NULL) | 760 | if (path == NULL) |
| 862 | return FALSE; | 761 | return FALSE; |
| 863 | 762 | ||
| 864 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | 763 | if (!gtk_tree_model_get_iter(model, &iter, path)) |
| 865 | return FALSE; | 764 | return FALSE; |
| 866 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | 765 | gtk_tree_model_get(model, &iter, COL_MENU, &menu, -1); |
| 766 | |||
| 767 | selected = menu; | ||
| 867 | 768 | ||
| 868 | col = column2index(column); | 769 | col = column2index(column); |
| 869 | if (event->type == GDK_2BUTTON_PRESS) { | 770 | if (event->type == GDK_2BUTTON_PRESS) { |
| 870 | enum prop_type ptype; | 771 | enum prop_type ptype; |
| 871 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | 772 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; |
| 872 | 773 | ||
| 873 | if (ptype == P_MENU && view_mode != FULL_VIEW && col == COL_OPTION) { | 774 | if (ptype == P_MENU && view_mode == SINGLE_VIEW && col == COL_OPTION) { |
| 874 | // goes down into menu | 775 | // goes down into menu |
| 875 | current = menu; | 776 | browsed = menu; |
| 876 | display_tree_part(); | 777 | recreate_tree(); |
| 877 | gtk_widget_set_sensitive(back_btn, TRUE); | 778 | gtk_widget_set_sensitive(back_btn, TRUE); |
| 878 | } else if (col == COL_OPTION) { | 779 | } else if (col == COL_OPTION) { |
| 879 | toggle_sym_value(menu); | 780 | toggle_sym_value(menu); |
| @@ -894,35 +795,31 @@ on_treeview2_button_press_event(GtkWidget * widget, · 14 unmodified lines | |||
| 894 | } | 795 | } |
| 895 | 796 | ||
| 896 | /* Key pressed: update choice */ | 797 | /* Key pressed: update choice */ |
| 897 | gboolean | 798 | static gboolean on_treeview2_key_press_event(GtkWidget *widget, |
| 898 | on_treeview2_key_press_event(GtkWidget * widget, | 799 | GdkEventKey *event, |
| 899 | GdkEventKey * event, gpointer user_data) | 800 | gpointer user_data) |
| 900 | { | 801 | { |
| 901 | GtkTreeView *view = GTK_TREE_VIEW(widget); | 802 | GtkTreeView *view = GTK_TREE_VIEW(widget); |
| 803 | GtkTreeModel *model = gtk_tree_view_get_model(view); | ||
| 902 | GtkTreePath *path; | 804 | GtkTreePath *path; |
| 903 | GtkTreeViewColumn *column; | ||
| 904 | GtkTreeIter iter; | 805 | GtkTreeIter iter; |
| 905 | struct menu *menu; | 806 | struct menu *menu; |
| 906 | gint col; | 807 | gint col; |
| 907 | 808 | ||
| 908 | gtk_tree_view_get_cursor(view, &path, &column); | 809 | gtk_tree_view_get_cursor(view, &path, NULL); |
| 909 | if (path == NULL) | 810 | if (path == NULL) |
| 910 | return FALSE; | 811 | return FALSE; |
| 911 | 812 | ||
| 912 | if (event->keyval == GDK_space) { | 813 | if (event->keyval == GDK_KEY_space) { |
| 913 | if (gtk_tree_view_row_expanded(view, path)) | 814 | if (gtk_tree_view_row_expanded(view, path)) |
| 914 | gtk_tree_view_collapse_row(view, path); | 815 | gtk_tree_view_collapse_row(view, path); |
| 915 | else | 816 | else |
| 916 | gtk_tree_view_expand_row(view, path, FALSE); | 817 | gtk_tree_view_expand_row(view, path, FALSE); |
| 917 | return TRUE; | 818 | return TRUE; |
| 918 | } | 819 | } |
| 919 | if (event->keyval == GDK_KP_Enter) { | ||
| 920 | } | ||
| 921 | if (widget == tree1_w) | ||
| 922 | return FALSE; | ||
| 923 | 820 | ||
| 924 | gtk_tree_model_get_iter(model2, &iter, path); | 821 | gtk_tree_model_get_iter(model, &iter, path); |
| 925 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | 822 | gtk_tree_model_get(model, &iter, COL_MENU, &menu, -1); |
| 926 | 823 | ||
| 927 | if (!strcasecmp(event->string, "n")) | 824 | if (!strcasecmp(event->string, "n")) |
| 928 | col = COL_NO; | 825 | col = COL_NO; |
| @@ -931,377 +828,82 @@ on_treeview2_key_press_event(GtkWidget * widget, · 2 unmodified lines | |||
| 931 | else if (!strcasecmp(event->string, "y")) | 828 | else if (!strcasecmp(event->string, "y")) |
| 932 | col = COL_YES; | 829 | col = COL_YES; |
| 933 | else | 830 | else |
| 934 | col = -1; | 831 | col = -1; |
| 935 | change_sym_value(menu, col); | 832 | change_sym_value(menu, col); |
| 936 | |||
| 937 | return FALSE; | ||
| 938 | } | ||
| 939 | |||
| 940 | |||
| 941 | /* Row selection changed: update help */ | ||
| 942 | void | ||
| 943 | on_treeview2_cursor_changed(GtkTreeView * treeview, gpointer user_data) | ||
| 944 | { | ||
| 945 | GtkTreeSelection *selection; | ||
| 946 | GtkTreeIter iter; | ||
| 947 | struct menu *menu; | ||
| 948 | |||
| 949 | selection = gtk_tree_view_get_selection(treeview); | ||
| 950 | if (gtk_tree_selection_get_selected(selection, &model2, &iter)) { | ||
| 951 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
| 952 | text_insert_help(menu); | ||
| 953 | } | ||
| 954 | } | ||
| 955 | |||
| 956 | |||
| 957 | /* User click: display sub-tree in the right frame. */ | ||
| 958 | gboolean | ||
| 959 | on_treeview1_button_press_event(GtkWidget * widget, | ||
| 960 | GdkEventButton * event, gpointer user_data) | ||
| 961 | { | ||
| 962 | GtkTreeView *view = GTK_TREE_VIEW(widget); | ||
| 963 | GtkTreePath *path; | ||
| 964 | GtkTreeViewColumn *column; | ||
| 965 | GtkTreeIter iter; | ||
| 966 | struct menu *menu; | ||
| 967 | |||
| 968 | gint tx = (gint) event->x; | ||
| 969 | gint ty = (gint) event->y; | ||
| 970 | gint cx, cy; | ||
| 971 | |||
| 972 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, &cx, | ||
| 973 | &cy); | ||
| 974 | if (path == NULL) | ||
| 975 | return FALSE; | ||
| 976 | |||
| 977 | gtk_tree_model_get_iter(model1, &iter, path); | ||
| 978 | gtk_tree_model_get(model1, &iter, COL_MENU, &menu, -1); | ||
| 979 | |||
| 980 | if (event->type == GDK_2BUTTON_PRESS) { | ||
| 981 | toggle_sym_value(menu); | ||
| 982 | current = menu; | ||
| 983 | display_tree_part(); | ||
| 984 | } else { | ||
| 985 | browsed = menu; | ||
| 986 | display_tree_part(); | ||
| 987 | } | ||
| 988 | |||
| 989 | gtk_widget_realize(tree2_w); | ||
| 990 | gtk_tree_view_set_cursor(view, path, NULL, FALSE); | ||
| 991 | gtk_widget_grab_focus(tree2_w); | ||
| 992 | |||
| 993 | return FALSE; | ||
| 994 | } | ||
| 995 | |||
| 996 | |||
| 997 | /* Fill a row of strings */ | ||
| 998 | static gchar **fill_row(struct menu *menu) | ||
| 999 | { | ||
| 1000 | static gchar *row[COL_NUMBER]; | ||
| 1001 | struct symbol *sym = menu->sym; | ||
| 1002 | const char *def; | ||
| 1003 | int stype; | ||
| 1004 | tristate val; | ||
| 1005 | enum prop_type ptype; | ||
| 1006 | int i; | ||
| 1007 | |||
| 1008 | for (i = COL_OPTION; i <= COL_COLOR; i++) | ||
| 1009 | g_free(row[i]); | ||
| 1010 | bzero(row, sizeof(row)); | ||
| 1011 | |||
| 1012 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 1013 | |||
| 1014 | row[COL_OPTION] = | ||
| 1015 | g_strdup_printf("%s %s %s %s", | ||
| 1016 | ptype == P_COMMENT ? "***" : "", | ||
| 1017 | menu_get_prompt(menu), | ||
| 1018 | ptype == P_COMMENT ? "***" : "", | ||
| 1019 | sym && !sym_has_value(sym) ? "(NEW)" : ""); | ||
| 1020 | |||
| 1021 | if (opt_mode == OPT_ALL && !menu_is_visible(menu)) | ||
| 1022 | row[COL_COLOR] = g_strdup("DarkGray"); | ||
| 1023 | else if (opt_mode == OPT_PROMPT && | ||
| 1024 | menu_has_prompt(menu) && !menu_is_visible(menu)) | ||
| 1025 | row[COL_COLOR] = g_strdup("DarkGray"); | ||
| 1026 | else | ||
| 1027 | row[COL_COLOR] = g_strdup("Black"); | ||
| 1028 | |||
| 1029 | switch (ptype) { | ||
| 1030 | case P_MENU: | ||
| 1031 | row[COL_PIXBUF] = (gchar *) xpm_menu; | ||
| 1032 | if (view_mode == SINGLE_VIEW) | ||
| 1033 | row[COL_PIXVIS] = GINT_TO_POINTER(TRUE); | ||
| 1034 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1035 | break; | ||
| 1036 | case P_COMMENT: | ||
| 1037 | row[COL_PIXBUF] = (gchar *) xpm_void; | ||
| 1038 | row[COL_PIXVIS] = GINT_TO_POINTER(FALSE); | ||
| 1039 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1040 | break; | ||
| 1041 | default: | ||
| 1042 | row[COL_PIXBUF] = (gchar *) xpm_void; | ||
| 1043 | row[COL_PIXVIS] = GINT_TO_POINTER(FALSE); | ||
| 1044 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | ||
| 1045 | break; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | if (!sym) | ||
| 1049 | return row; | ||
| 1050 | row[COL_NAME] = g_strdup(sym->name); | ||
| 1051 | |||
| 1052 | sym_calc_value(sym); | ||
| 1053 | menu->flags &= ~MENU_CHANGED; | ||
| 1054 | |||
| 1055 | if (sym_is_choice(sym)) { // parse childs for getting final value | ||
| 1056 | struct menu *child; | ||
| 1057 | struct symbol *def_sym = sym_calc_choice(menu); | ||
| 1058 | struct menu *def_menu = NULL; | ||
| 1059 | |||
| 1060 | for (child = menu->list; child; child = child->next) { | ||
| 1061 | if (menu_is_visible(child) | ||
| 1062 | && child->sym == def_sym) | ||
| 1063 | def_menu = child; | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | if (def_menu) | ||
| 1067 | row[COL_VALUE] = | ||
| 1068 | g_strdup(menu_get_prompt(def_menu)); | ||
| 1069 | |||
| 1070 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1071 | return row; | ||
| 1072 | } | ||
| 1073 | if (sym_is_choice_value(sym)) | ||
| 1074 | row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); | ||
| 1075 | |||
| 1076 | stype = sym_get_type(sym); | ||
| 1077 | switch (stype) { | ||
| 1078 | case S_BOOLEAN: | ||
| 1079 | case S_TRISTATE: | ||
| 1080 | val = sym_get_tristate_value(sym); | ||
| 1081 | switch (val) { | ||
| 1082 | case no: | ||
| 1083 | row[COL_NO] = g_strdup("N"); | ||
| 1084 | row[COL_VALUE] = g_strdup("N"); | ||
| 1085 | row[COL_BTNACT] = GINT_TO_POINTER(FALSE); | ||
| 1086 | row[COL_BTNINC] = GINT_TO_POINTER(FALSE); | ||
| 1087 | break; | ||
| 1088 | case mod: | ||
| 1089 | row[COL_MOD] = g_strdup("M"); | ||
| 1090 | row[COL_VALUE] = g_strdup("M"); | ||
| 1091 | row[COL_BTNINC] = GINT_TO_POINTER(TRUE); | ||
| 1092 | break; | ||
| 1093 | case yes: | ||
| 1094 | row[COL_YES] = g_strdup("Y"); | ||
| 1095 | row[COL_VALUE] = g_strdup("Y"); | ||
| 1096 | row[COL_BTNACT] = GINT_TO_POINTER(TRUE); | ||
| 1097 | row[COL_BTNINC] = GINT_TO_POINTER(FALSE); | ||
| 1098 | break; | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | if (val != no && sym_tristate_within_range(sym, no)) | ||
| 1102 | row[COL_NO] = g_strdup("_"); | ||
| 1103 | if (val != mod && sym_tristate_within_range(sym, mod)) | ||
| 1104 | row[COL_MOD] = g_strdup("_"); | ||
| 1105 | if (val != yes && sym_tristate_within_range(sym, yes)) | ||
| 1106 | row[COL_YES] = g_strdup("_"); | ||
| 1107 | break; | ||
| 1108 | case S_INT: | ||
| 1109 | case S_HEX: | ||
| 1110 | case S_STRING: | ||
| 1111 | def = sym_get_string_value(sym); | ||
| 1112 | row[COL_VALUE] = g_strdup(def); | ||
| 1113 | row[COL_EDIT] = GINT_TO_POINTER(TRUE); | ||
| 1114 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1115 | break; | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | return row; | ||
| 1119 | } | ||
| 1120 | |||
| 1121 | |||
| 1122 | /* Set the node content with a row of strings */ | ||
| 1123 | static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row) | ||
| 1124 | { | ||
| 1125 | GdkColor color; | ||
| 1126 | gboolean success; | ||
| 1127 | GdkPixbuf *pix; | ||
| 1128 | |||
| 1129 | pix = gdk_pixbuf_new_from_xpm_data((const char **) | ||
| 1130 | row[COL_PIXBUF]); | ||
| 1131 | |||
| 1132 | gdk_color_parse(row[COL_COLOR], &color); | ||
| 1133 | gdk_colormap_alloc_colors(gdk_colormap_get_system(), &color, 1, | ||
| 1134 | FALSE, FALSE, &success); | ||
| 1135 | |||
| 1136 | gtk_tree_store_set(tree, node, | ||
| 1137 | COL_OPTION, row[COL_OPTION], | ||
| 1138 | COL_NAME, row[COL_NAME], | ||
| 1139 | COL_NO, row[COL_NO], | ||
| 1140 | COL_MOD, row[COL_MOD], | ||
| 1141 | COL_YES, row[COL_YES], | ||
| 1142 | COL_VALUE, row[COL_VALUE], | ||
| 1143 | COL_MENU, (gpointer) menu, | ||
| 1144 | COL_COLOR, &color, | ||
| 1145 | COL_EDIT, GPOINTER_TO_INT(row[COL_EDIT]), | ||
| 1146 | COL_PIXBUF, pix, | ||
| 1147 | COL_PIXVIS, GPOINTER_TO_INT(row[COL_PIXVIS]), | ||
| 1148 | COL_BTNVIS, GPOINTER_TO_INT(row[COL_BTNVIS]), | ||
| 1149 | COL_BTNACT, GPOINTER_TO_INT(row[COL_BTNACT]), | ||
| 1150 | COL_BTNINC, GPOINTER_TO_INT(row[COL_BTNINC]), | ||
| 1151 | COL_BTNRAD, GPOINTER_TO_INT(row[COL_BTNRAD]), | ||
| 1152 | -1); | ||
| 1153 | |||
| 1154 | g_object_unref(pix); | ||
| 1155 | } | ||
| 1156 | |||
| 1157 | |||
| 1158 | /* Add a node to the tree */ | ||
| 1159 | static void place_node(struct menu *menu, char **row) | ||
| 1160 | { | ||
| 1161 | GtkTreeIter *parent = parents[indent - 1]; | ||
| 1162 | GtkTreeIter *node = parents[indent]; | ||
| 1163 | 833 | ||
| 1164 | gtk_tree_store_append(tree, node, parent); | 834 | return FALSE; |
| 1165 | set_node(node, menu, row); | ||
| 1166 | } | 835 | } |
| 1167 | 836 | ||
| 1168 | 837 | ||
| 1169 | /* Find a node in the GTK+ tree */ | 838 | /* Row selection changed: update help */ |
| 1170 | static GtkTreeIter found; | 839 | static void on_treeview2_cursor_changed(GtkTreeView *treeview, |
| 1171 | 840 | gpointer user_data) | |
| 1172 | /* | ||
| 1173 | * Find a menu in the GtkTree starting at parent. | ||
| 1174 | */ | ||
| 1175 | static GtkTreeIter *gtktree_iter_find_node(GtkTreeIter *parent, | ||
| 1176 | struct menu *tofind) | ||
| 1177 | { | 841 | { |
| 842 | GtkTreeModel *model = gtk_tree_view_get_model(treeview); | ||
| 843 | GtkTreeSelection *selection; | ||
| 1178 | GtkTreeIter iter; | 844 | GtkTreeIter iter; |
| 1179 | GtkTreeIter *child = &iter; | 845 | struct menu *menu; |
| 1180 | gboolean valid; | ||
| 1181 | GtkTreeIter *ret; | ||
| 1182 | |||
| 1183 | valid = gtk_tree_model_iter_children(model2, child, parent); | ||
| 1184 | while (valid) { | ||
| 1185 | struct menu *menu; | ||
| 1186 | |||
| 1187 | gtk_tree_model_get(model2, child, 6, &menu, -1); | ||
| 1188 | |||
| 1189 | if (menu == tofind) { | ||
| 1190 | memcpy(&found, child, sizeof(GtkTreeIter)); | ||
| 1191 | return &found; | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | ret = gtktree_iter_find_node(child, tofind); | ||
| 1195 | if (ret) | ||
| 1196 | return ret; | ||
| 1197 | 846 | ||
| 1198 | valid = gtk_tree_model_iter_next(model2, child); | 847 | selection = gtk_tree_view_get_selection(treeview); |
| 848 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) { | ||
| 849 | gtk_tree_model_get(model, &iter, COL_MENU, &menu, -1); | ||
| 850 | text_insert_help(menu); | ||
| 1199 | } | 851 | } |
| 1200 | |||
| 1201 | return NULL; | ||
| 1202 | } | 852 | } |
| 1203 | 853 | ||
| 1204 | 854 | ||
| 1205 | /* | 855 | /* User click: display sub-tree in the right frame. */ |
| 1206 | * Update the tree by adding/removing entries | 856 | static gboolean on_treeview1_button_press_event(GtkWidget *widget, |
| 1207 | * Does not change other nodes | 857 | GdkEventButton *event, |
| 1208 | */ | 858 | gpointer user_data) |
| 1209 | static void update_tree(struct menu *src, GtkTreeIter * dst) | ||
| 1210 | { | 859 | { |
| 1211 | struct menu *child1; | 860 | GtkTreeView *view = GTK_TREE_VIEW(widget); |
| 1212 | GtkTreeIter iter, tmp; | 861 | GtkTreeModel *model = gtk_tree_view_get_model(view); |
| 1213 | GtkTreeIter *child2 = &iter; | 862 | GtkTreePath *path; |
| 1214 | gboolean valid; | 863 | GtkTreeIter iter; |
| 1215 | GtkTreeIter *sibling; | 864 | struct menu *menu; |
| 1216 | struct symbol *sym; | 865 | gint tx = (gint) event->x; |
| 1217 | struct menu *menu1, *menu2; | 866 | gint ty = (gint) event->y; |
| 1218 | 867 | ||
| 1219 | if (src == &rootmenu) | 868 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, NULL, NULL, NULL); |
| 1220 | indent = 1; | 869 | if (path == NULL) |
| 870 | return FALSE; | ||
| 1221 | 871 | ||
| 1222 | valid = gtk_tree_model_iter_children(model2, child2, dst); | 872 | gtk_tree_model_get_iter(model, &iter, path); |
| 1223 | for (child1 = src->list; child1; child1 = child1->next) { | 873 | gtk_tree_model_get(model, &iter, COL_MENU, &menu, -1); |
| 1224 | 874 | ||
| 1225 | sym = child1->sym; | 875 | if (event->type == GDK_2BUTTON_PRESS) |
| 876 | toggle_sym_value(menu); | ||
| 1226 | 877 | ||
| 1227 | reparse: | 878 | selected = menu; |
| 1228 | menu1 = child1; | ||
| 1229 | if (valid) | ||
| 1230 | gtk_tree_model_get(model2, child2, COL_MENU, | ||
| 1231 | &menu2, -1); | ||
| 1232 | else | ||
| 1233 | menu2 = NULL; // force adding of a first child | ||
| 1234 | |||
| 1235 | if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) || | ||
| 1236 | (opt_mode == OPT_PROMPT && !menu_has_prompt(child1)) || | ||
| 1237 | (opt_mode == OPT_ALL && !menu_get_prompt(child1))) { | ||
| 1238 | |||
| 1239 | /* remove node */ | ||
| 1240 | if (gtktree_iter_find_node(dst, menu1) != NULL) { | ||
| 1241 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | ||
| 1242 | valid = gtk_tree_model_iter_next(model2, | ||
| 1243 | child2); | ||
| 1244 | gtk_tree_store_remove(tree2, &tmp); | ||
| 1245 | if (!valid) | ||
| 1246 | return; /* next parent */ | ||
| 1247 | else | ||
| 1248 | goto reparse; /* next child */ | ||
| 1249 | } else | ||
| 1250 | continue; | ||
| 1251 | } | ||
| 1252 | 879 | ||
| 1253 | if (menu1 != menu2) { | 880 | if (menu->type == M_MENU) { |
| 1254 | if (gtktree_iter_find_node(dst, menu1) == NULL) { // add node | 881 | browsed = menu; |
| 1255 | if (!valid && !menu2) | 882 | recreate_tree(); |
| 1256 | sibling = NULL; | 883 | } |
| 1257 | else | ||
| 1258 | sibling = child2; | ||
| 1259 | gtk_tree_store_insert_before(tree2, | ||
| 1260 | child2, | ||
| 1261 | dst, sibling); | ||
| 1262 | set_node(child2, menu1, fill_row(menu1)); | ||
| 1263 | if (menu2 == NULL) | ||
| 1264 | valid = TRUE; | ||
| 1265 | } else { // remove node | ||
| 1266 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | ||
| 1267 | valid = gtk_tree_model_iter_next(model2, | ||
| 1268 | child2); | ||
| 1269 | gtk_tree_store_remove(tree2, &tmp); | ||
| 1270 | if (!valid) | ||
| 1271 | return; // next parent | ||
| 1272 | else | ||
| 1273 | goto reparse; // next child | ||
| 1274 | } | ||
| 1275 | } else if (sym && (child1->flags & MENU_CHANGED)) { | ||
| 1276 | set_node(child2, menu1, fill_row(menu1)); | ||
| 1277 | } | ||
| 1278 | 884 | ||
| 1279 | indent++; | 885 | gtk_tree_view_set_cursor(view, path, NULL, FALSE); |
| 1280 | update_tree(child1, child2); | 886 | gtk_widget_grab_focus(tree2_w); |
| 1281 | indent--; | ||
| 1282 | 887 | ||
| 1283 | valid = gtk_tree_model_iter_next(model2, child2); | 888 | return FALSE; |
| 1284 | } | ||
| 1285 | } | 889 | } |
| 1286 | 890 | ||
| 1287 | |||
| 1288 | /* Display the whole tree (single/split/full view) */ | 891 | /* Display the whole tree (single/split/full view) */ |
| 1289 | static void display_tree(struct menu *menu) | 892 | static void _display_tree(GtkTreeStore *tree, struct menu *menu, |
| 893 | GtkTreeIter *parent) | ||
| 1290 | { | 894 | { |
| 1291 | struct property *prop; | ||
| 1292 | struct menu *child; | 895 | struct menu *child; |
| 1293 | enum prop_type ptype; | 896 | GtkTreeIter iter; |
| 1294 | |||
| 1295 | if (menu == &rootmenu) { | ||
| 1296 | indent = 1; | ||
| 1297 | current = &rootmenu; | ||
| 1298 | } | ||
| 1299 | 897 | ||
| 1300 | for (child = menu->list; child; child = child->next) { | 898 | for (child = menu->list; child; child = child->next) { |
| 1301 | prop = child->prompt; | 899 | /* |
| 1302 | ptype = prop ? prop->type : P_UNKNOWN; | 900 | * REVISIT: |
| 1303 | 901 | * menu_finalize() creates empty "if" entries. | |
| 1304 | menu->flags &= ~MENU_CHANGED; | 902 | * Do not confuse gtk_tree_model_get(), which would otherwise |
| 903 | * return "if" menu entry. | ||
| 904 | */ | ||
| 905 | if (child->type == M_IF) | ||
| 906 | continue; | ||
| 1305 | 907 | ||
| 1306 | if ((view_mode == SPLIT_VIEW) | 908 | if ((view_mode == SPLIT_VIEW) |
| 1307 | && !(child->flags & MENU_ROOT) && (tree == tree1)) | 909 | && !(child->flags & MENU_ROOT) && (tree == tree1)) |
| @@ -1311,58 +913,25 @@ static void display_tree(struct menu *menu) · 3 unmodified lines | |||
| 1311 | && (tree == tree2)) | 913 | && (tree == tree2)) |
| 1312 | continue; | 914 | continue; |
| 1313 | 915 | ||
| 1314 | if ((opt_mode == OPT_NORMAL && menu_is_visible(child)) || | 916 | gtk_tree_store_append(tree, &iter, parent); |
| 1315 | (opt_mode == OPT_PROMPT && menu_has_prompt(child)) || | 917 | set_node(tree, &iter, child); |
| 1316 | (opt_mode == OPT_ALL && menu_get_prompt(child))) | ||
| 1317 | place_node(child, fill_row(child)); | ||
| 1318 | |||
| 1319 | if ((view_mode != FULL_VIEW) && (ptype == P_MENU) | ||
| 1320 | && (tree == tree2)) | ||
| 1321 | continue; | ||
| 1322 | /* | ||
| 1323 | if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) | ||
| 1324 | || (view_mode == FULL_VIEW) | ||
| 1325 | || (view_mode == SPLIT_VIEW))*/ | ||
| 1326 | |||
| 1327 | /* Change paned position if the view is not in 'split mode' */ | ||
| 1328 | if (view_mode == SINGLE_VIEW || view_mode == FULL_VIEW) { | ||
| 1329 | gtk_paned_set_position(GTK_PANED(hpaned), 0); | ||
| 1330 | } | ||
| 1331 | 918 | ||
| 1332 | if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) | 919 | if (view_mode != SINGLE_VIEW || child->type != M_MENU) |
| 1333 | || (view_mode == FULL_VIEW) | 920 | _display_tree(tree, child, &iter); |
| 1334 | || (view_mode == SPLIT_VIEW)) { | ||
| 1335 | indent++; | ||
| 1336 | display_tree(child); | ||
| 1337 | indent--; | ||
| 1338 | } | ||
| 1339 | } | 921 | } |
| 1340 | } | 922 | } |
| 1341 | 923 | ||
| 1342 | /* Display a part of the tree starting at current node (single/split view) */ | 924 | static void display_tree(GtkTreeStore *store, struct menu *menu) |
| 1343 | static void display_tree_part(void) | ||
| 1344 | { | 925 | { |
| 1345 | if (tree2) | 926 | _display_tree(store, menu, NULL); |
| 1346 | gtk_tree_store_clear(tree2); | ||
| 1347 | if (view_mode == SINGLE_VIEW) | ||
| 1348 | display_tree(current); | ||
| 1349 | else if (view_mode == SPLIT_VIEW) | ||
| 1350 | display_tree(browsed); | ||
| 1351 | else if (view_mode == FULL_VIEW) | ||
| 1352 | display_tree(&rootmenu); | ||
| 1353 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | ||
| 1354 | } | 927 | } |
| 1355 | 928 | ||
| 1356 | /* Display the list in the left frame (split view) */ | 929 | /* Recreate the tree store starting at 'browsed' node */ |
| 1357 | static void display_list(void) | 930 | static void recreate_tree(void) |
| 1358 | { | 931 | { |
| 1359 | if (tree1) | 932 | gtk_tree_store_clear(tree2); |
| 1360 | gtk_tree_store_clear(tree1); | 933 | display_tree(tree2, browsed); |
| 1361 | 934 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | |
| 1362 | tree = tree1; | ||
| 1363 | display_tree(&rootmenu); | ||
| 1364 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree1_w)); | ||
| 1365 | tree = tree2; | ||
| 1366 | } | 935 | } |
| 1367 | 936 | ||
| 1368 | static void fixup_rootmenu(struct menu *menu) | 937 | static void fixup_rootmenu(struct menu *menu) |
| @@ -1381,6 +950,335 @@ static void fixup_rootmenu(struct menu *menu) · 12 unmodified lines | |||
| 1381 | } | 950 | } |
| 1382 | } | 951 | } |
| 1383 | 952 | ||
| 953 | /* Main Window Initialization */ | ||
| 954 | static void replace_button_icon(GtkWidget *widget, const char * const xpm[]) | ||
| 955 | { | ||
| 956 | GdkPixbuf *pixbuf; | ||
| 957 | GtkWidget *image; | ||
| 958 | |||
| 959 | pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)xpm); | ||
| 960 | image = gtk_image_new_from_pixbuf(pixbuf); | ||
| 961 | g_object_unref(pixbuf); | ||
| 962 | |||
| 963 | gtk_widget_show(image); | ||
| 964 | gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(widget), image); | ||
| 965 | } | ||
| 966 | |||
| 967 | static void init_main_window(const gchar *glade_file) | ||
| 968 | { | ||
| 969 | GtkBuilder *builder; | ||
| 970 | GtkWidget *widget; | ||
| 971 | GtkTextBuffer *txtbuf; | ||
| 972 | |||
| 973 | builder = gtk_builder_new_from_file(glade_file); | ||
| 974 | if (!builder) | ||
| 975 | g_error("GUI loading failed !\n"); | ||
| 976 | |||
| 977 | main_wnd = GTK_WIDGET(gtk_builder_get_object(builder, "window1")); | ||
| 978 | g_signal_connect(main_wnd, "destroy", | ||
| 979 | G_CALLBACK(on_window1_destroy), NULL); | ||
| 980 | g_signal_connect(main_wnd, "configure-event", | ||
| 981 | G_CALLBACK(on_window1_configure), NULL); | ||
| 982 | g_signal_connect(main_wnd, "delete-event", | ||
| 983 | G_CALLBACK(on_window1_delete_event), NULL); | ||
| 984 | |||
| 985 | hpaned = GTK_WIDGET(gtk_builder_get_object(builder, "hpaned1")); | ||
| 986 | vpaned = GTK_WIDGET(gtk_builder_get_object(builder, "vpaned1")); | ||
| 987 | tree1_w = GTK_WIDGET(gtk_builder_get_object(builder, "treeview1")); | ||
| 988 | g_signal_connect(tree1_w, "cursor-changed", | ||
| 989 | G_CALLBACK(on_treeview2_cursor_changed), NULL); | ||
| 990 | g_signal_connect(tree1_w, "button-press-event", | ||
| 991 | G_CALLBACK(on_treeview1_button_press_event), NULL); | ||
| 992 | g_signal_connect(tree1_w, "key-press-event", | ||
| 993 | G_CALLBACK(on_treeview2_key_press_event), NULL); | ||
| 994 | |||
| 995 | tree2_w = GTK_WIDGET(gtk_builder_get_object(builder, "treeview2")); | ||
| 996 | g_signal_connect(tree2_w, "cursor-changed", | ||
| 997 | G_CALLBACK(on_treeview2_cursor_changed), NULL); | ||
| 998 | g_signal_connect(tree2_w, "button-press-event", | ||
| 999 | G_CALLBACK(on_treeview2_button_press_event), NULL); | ||
| 1000 | g_signal_connect(tree2_w, "key-press-event", | ||
| 1001 | G_CALLBACK(on_treeview2_key_press_event), NULL); | ||
| 1002 | |||
| 1003 | text_w = GTK_WIDGET(gtk_builder_get_object(builder, "textview3")); | ||
| 1004 | |||
| 1005 | /* menubar */ | ||
| 1006 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "load1")); | ||
| 1007 | g_signal_connect(widget, "activate", | ||
| 1008 | G_CALLBACK(on_load1_activate), NULL); | ||
| 1009 | |||
| 1010 | save_menu_item = GTK_WIDGET(gtk_builder_get_object(builder, "save1")); | ||
| 1011 | g_signal_connect(save_menu_item, "activate", | ||
| 1012 | G_CALLBACK(on_save_activate), NULL); | ||
| 1013 | |||
| 1014 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "save_as1")); | ||
| 1015 | g_signal_connect(widget, "activate", | ||
| 1016 | G_CALLBACK(on_save_as1_activate), NULL); | ||
| 1017 | |||
| 1018 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "quit1")); | ||
| 1019 | g_signal_connect(widget, "activate", | ||
| 1020 | G_CALLBACK(on_quit1_activate), NULL); | ||
| 1021 | |||
| 1022 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "show_name1")); | ||
| 1023 | g_signal_connect(widget, "activate", | ||
| 1024 | G_CALLBACK(on_show_name1_activate), NULL); | ||
| 1025 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
| 1026 | show_name); | ||
| 1027 | |||
| 1028 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "show_range1")); | ||
| 1029 | g_signal_connect(widget, "activate", | ||
| 1030 | G_CALLBACK(on_show_range1_activate), NULL); | ||
| 1031 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
| 1032 | show_range); | ||
| 1033 | |||
| 1034 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "show_data1")); | ||
| 1035 | g_signal_connect(widget, "activate", | ||
| 1036 | G_CALLBACK(on_show_data1_activate), NULL); | ||
| 1037 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
| 1038 | show_value); | ||
| 1039 | |||
| 1040 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "set_option_mode1")); | ||
| 1041 | g_signal_connect(widget, "activate", | ||
| 1042 | G_CALLBACK(on_set_option_mode1_activate), NULL); | ||
| 1043 | |||
| 1044 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "set_option_mode2")); | ||
| 1045 | g_signal_connect(widget, "activate", | ||
| 1046 | G_CALLBACK(on_set_option_mode2_activate), NULL); | ||
| 1047 | |||
| 1048 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "set_option_mode3")); | ||
| 1049 | g_signal_connect(widget, "activate", | ||
| 1050 | G_CALLBACK(on_set_option_mode3_activate), NULL); | ||
| 1051 | |||
| 1052 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "introduction1")); | ||
| 1053 | g_signal_connect(widget, "activate", | ||
| 1054 | G_CALLBACK(on_introduction1_activate), NULL); | ||
| 1055 | |||
| 1056 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "about1")); | ||
| 1057 | g_signal_connect(widget, "activate", | ||
| 1058 | G_CALLBACK(on_about1_activate), NULL); | ||
| 1059 | |||
| 1060 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "license1")); | ||
| 1061 | g_signal_connect(widget, "activate", | ||
| 1062 | G_CALLBACK(on_license1_activate), NULL); | ||
| 1063 | |||
| 1064 | /* toolbar */ | ||
| 1065 | back_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button1")); | ||
| 1066 | g_signal_connect(back_btn, "clicked", | ||
| 1067 | G_CALLBACK(on_back_clicked), NULL); | ||
| 1068 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
| 1069 | |||
| 1070 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "button2")); | ||
| 1071 | g_signal_connect(widget, "clicked", | ||
| 1072 | G_CALLBACK(on_load_clicked), NULL); | ||
| 1073 | |||
| 1074 | save_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button3")); | ||
| 1075 | g_signal_connect(save_btn, "clicked", | ||
| 1076 | G_CALLBACK(on_save_clicked), NULL); | ||
| 1077 | |||
| 1078 | single_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button4")); | ||
| 1079 | g_signal_connect(single_btn, "clicked", | ||
| 1080 | G_CALLBACK(on_single_clicked), NULL); | ||
| 1081 | replace_button_icon(single_btn, xpm_single_view); | ||
| 1082 | |||
| 1083 | split_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button5")); | ||
| 1084 | g_signal_connect(split_btn, "clicked", | ||
| 1085 | G_CALLBACK(on_split_clicked), NULL); | ||
| 1086 | replace_button_icon(split_btn, xpm_split_view); | ||
| 1087 | |||
| 1088 | full_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button6")); | ||
| 1089 | g_signal_connect(full_btn, "clicked", | ||
| 1090 | G_CALLBACK(on_full_clicked), NULL); | ||
| 1091 | replace_button_icon(full_btn, xpm_tree_view); | ||
| 1092 | |||
| 1093 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "button7")); | ||
| 1094 | g_signal_connect(widget, "clicked", | ||
| 1095 | G_CALLBACK(on_collapse_clicked), NULL); | ||
| 1096 | |||
| 1097 | widget = GTK_WIDGET(gtk_builder_get_object(builder, "button8")); | ||
| 1098 | g_signal_connect(widget, "clicked", | ||
| 1099 | G_CALLBACK(on_expand_clicked), NULL); | ||
| 1100 | |||
| 1101 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | ||
| 1102 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", | ||
| 1103 | "foreground", "red", | ||
| 1104 | "weight", PANGO_WEIGHT_BOLD, | ||
| 1105 | NULL); | ||
| 1106 | tag2 = gtk_text_buffer_create_tag(txtbuf, "mytag2", | ||
| 1107 | /*"style", PANGO_STYLE_OBLIQUE, */ | ||
| 1108 | NULL); | ||
| 1109 | |||
| 1110 | gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text); | ||
| 1111 | |||
| 1112 | gtk_widget_show_all(main_wnd); | ||
| 1113 | |||
| 1114 | g_object_unref(builder); | ||
| 1115 | |||
| 1116 | conf_set_changed_callback(conf_changed); | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | static gboolean visible_func(GtkTreeModel *model, GtkTreeIter *iter, | ||
| 1120 | gpointer data) | ||
| 1121 | { | ||
| 1122 | struct menu *menu; | ||
| 1123 | |||
| 1124 | gtk_tree_model_get(model, iter, COL_MENU, &menu, -1); | ||
| 1125 | |||
| 1126 | if (!menu) | ||
| 1127 | return FALSE; | ||
| 1128 | |||
| 1129 | return menu_is_visible(menu) || opt_mode == OPT_ALL || | ||
| 1130 | (opt_mode == OPT_PROMPT && menu_has_prompt(menu)); | ||
| 1131 | } | ||
| 1132 | |||
| 1133 | static void init_left_tree(void) | ||
| 1134 | { | ||
| 1135 | GtkTreeView *view = GTK_TREE_VIEW(tree1_w); | ||
| 1136 | GtkCellRenderer *renderer; | ||
| 1137 | GtkTreeSelection *sel; | ||
| 1138 | GtkTreeViewColumn *column; | ||
| 1139 | GtkTreeModel *filter; | ||
| 1140 | |||
| 1141 | tree1 = gtk_tree_store_new(COL_NUMBER, | ||
| 1142 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 1143 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 1144 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 1145 | G_TYPE_POINTER, GDK_TYPE_RGBA, | ||
| 1146 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
| 1147 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 1148 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 1149 | G_TYPE_BOOLEAN); | ||
| 1150 | |||
| 1151 | filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(tree1), NULL); | ||
| 1152 | |||
| 1153 | gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter), | ||
| 1154 | visible_func, NULL, NULL); | ||
| 1155 | gtk_tree_view_set_model(view, filter); | ||
| 1156 | |||
| 1157 | column = gtk_tree_view_column_new(); | ||
| 1158 | gtk_tree_view_append_column(view, column); | ||
| 1159 | gtk_tree_view_column_set_title(column, "Options"); | ||
| 1160 | |||
| 1161 | renderer = gtk_cell_renderer_toggle_new(); | ||
| 1162 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 1163 | renderer, FALSE); | ||
| 1164 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 1165 | renderer, | ||
| 1166 | "active", COL_BTNACT, | ||
| 1167 | "inconsistent", COL_BTNINC, | ||
| 1168 | "visible", COL_BTNVIS, | ||
| 1169 | "radio", COL_BTNRAD, NULL); | ||
| 1170 | renderer = gtk_cell_renderer_text_new(); | ||
| 1171 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 1172 | renderer, FALSE); | ||
| 1173 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 1174 | renderer, | ||
| 1175 | "text", COL_OPTION, | ||
| 1176 | "foreground-rgba", | ||
| 1177 | COL_COLOR, NULL); | ||
| 1178 | |||
| 1179 | sel = gtk_tree_view_get_selection(view); | ||
| 1180 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | ||
| 1181 | } | ||
| 1182 | |||
| 1183 | static void init_right_tree(void) | ||
| 1184 | { | ||
| 1185 | GtkTreeView *view = GTK_TREE_VIEW(tree2_w); | ||
| 1186 | GtkCellRenderer *renderer; | ||
| 1187 | GtkTreeSelection *sel; | ||
| 1188 | GtkTreeViewColumn *column; | ||
| 1189 | GtkTreeModel *filter; | ||
| 1190 | gint i; | ||
| 1191 | |||
| 1192 | tree2 = gtk_tree_store_new(COL_NUMBER, | ||
| 1193 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 1194 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 1195 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 1196 | G_TYPE_POINTER, GDK_TYPE_RGBA, | ||
| 1197 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
| 1198 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 1199 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 1200 | G_TYPE_BOOLEAN); | ||
| 1201 | |||
| 1202 | filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(tree2), NULL); | ||
| 1203 | |||
| 1204 | gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter), | ||
| 1205 | visible_func, NULL, NULL); | ||
| 1206 | gtk_tree_view_set_model(view, filter); | ||
| 1207 | |||
| 1208 | column = gtk_tree_view_column_new(); | ||
| 1209 | gtk_tree_view_append_column(view, column); | ||
| 1210 | gtk_tree_view_column_set_title(column, "Options"); | ||
| 1211 | |||
| 1212 | renderer = gtk_cell_renderer_pixbuf_new(); | ||
| 1213 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 1214 | renderer, FALSE); | ||
| 1215 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 1216 | renderer, | ||
| 1217 | "pixbuf", COL_PIXBUF, | ||
| 1218 | "visible", COL_PIXVIS, NULL); | ||
| 1219 | renderer = gtk_cell_renderer_toggle_new(); | ||
| 1220 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 1221 | renderer, FALSE); | ||
| 1222 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 1223 | renderer, | ||
| 1224 | "active", COL_BTNACT, | ||
| 1225 | "inconsistent", COL_BTNINC, | ||
| 1226 | "visible", COL_BTNVIS, | ||
| 1227 | "radio", COL_BTNRAD, NULL); | ||
| 1228 | renderer = gtk_cell_renderer_text_new(); | ||
| 1229 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 1230 | renderer, FALSE); | ||
| 1231 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 1232 | renderer, | ||
| 1233 | "text", COL_OPTION, | ||
| 1234 | "foreground-rgba", | ||
| 1235 | COL_COLOR, NULL); | ||
| 1236 | |||
| 1237 | renderer = gtk_cell_renderer_text_new(); | ||
| 1238 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 1239 | "Name", renderer, | ||
| 1240 | "text", COL_NAME, | ||
| 1241 | "foreground-rgba", | ||
| 1242 | COL_COLOR, NULL); | ||
| 1243 | renderer = gtk_cell_renderer_text_new(); | ||
| 1244 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 1245 | "N", renderer, | ||
| 1246 | "text", COL_NO, | ||
| 1247 | "foreground-rgba", | ||
| 1248 | COL_COLOR, NULL); | ||
| 1249 | renderer = gtk_cell_renderer_text_new(); | ||
| 1250 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 1251 | "M", renderer, | ||
| 1252 | "text", COL_MOD, | ||
| 1253 | "foreground-rgba", | ||
| 1254 | COL_COLOR, NULL); | ||
| 1255 | renderer = gtk_cell_renderer_text_new(); | ||
| 1256 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 1257 | "Y", renderer, | ||
| 1258 | "text", COL_YES, | ||
| 1259 | "foreground-rgba", | ||
| 1260 | COL_COLOR, NULL); | ||
| 1261 | renderer = gtk_cell_renderer_text_new(); | ||
| 1262 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 1263 | "Value", renderer, | ||
| 1264 | "text", COL_VALUE, | ||
| 1265 | "editable", | ||
| 1266 | COL_EDIT, | ||
| 1267 | "foreground-rgba", | ||
| 1268 | COL_COLOR, NULL); | ||
| 1269 | g_signal_connect(G_OBJECT(renderer), "edited", | ||
| 1270 | G_CALLBACK(renderer_edited), tree2_w); | ||
| 1271 | |||
| 1272 | pix_menu = gdk_pixbuf_new_from_xpm_data((const char **)xpm_menu); | ||
| 1273 | |||
| 1274 | for (i = 0; i < COL_VALUE; i++) { | ||
| 1275 | column = gtk_tree_view_get_column(view, i); | ||
| 1276 | gtk_tree_view_column_set_resizable(column, TRUE); | ||
| 1277 | } | ||
| 1278 | |||
| 1279 | sel = gtk_tree_view_get_selection(view); | ||
| 1280 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | ||
| 1281 | } | ||
| 1384 | 1282 | ||
| 1385 | /* Main */ | 1283 | /* Main */ |
| 1386 | int main(int ac, char *av[]) | 1284 | int main(int ac, char *av[]) |
| @@ -1390,18 +1288,16 @@ int main(int ac, char *av[]) · 3 unmodified lines | |||
| 1390 | gchar *glade_file; | 1288 | gchar *glade_file; |
| 1391 | 1289 | ||
| 1392 | /* GTK stuffs */ | 1290 | /* GTK stuffs */ |
| 1393 | gtk_set_locale(); | ||
| 1394 | gtk_init(&ac, &av); | 1291 | gtk_init(&ac, &av); |
| 1395 | glade_init(); | ||
| 1396 | 1292 | ||
| 1397 | /* Determine GUI path */ | 1293 | /* Determine GUI path */ |
| 1398 | env = getenv(SRCTREE); | 1294 | env = getenv(SRCTREE); |
| 1399 | if (env) | 1295 | if (env) |
| 1400 | glade_file = g_strconcat(env, "/scripts/kconfig/gconf.glade", NULL); | 1296 | glade_file = g_strconcat(env, "/scripts/kconfig/gconf.ui", NULL); |
| 1401 | else if (av[0][0] == '/') | 1297 | else if (av[0][0] == '/') |
| 1402 | glade_file = g_strconcat(av[0], ".glade", NULL); | 1298 | glade_file = g_strconcat(av[0], ".ui", NULL); |
| 1403 | else | 1299 | else |
| 1404 | glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL); | 1300 | glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".ui", NULL); |
| 1405 | 1301 | ||
| 1406 | /* Conf stuffs */ | 1302 | /* Conf stuffs */ |
| 1407 | if (ac > 1 && av[1][0] == '-') { | 1303 | if (ac > 1 && av[1][0] == '-') { |
| @@ -1426,23 +1322,12 @@ int main(int ac, char *av[]) · 18 unmodified lines | |||
| 1426 | 1322 | ||
| 1427 | /* Load the interface and connect signals */ | 1323 | /* Load the interface and connect signals */ |
| 1428 | init_main_window(glade_file); | 1324 | init_main_window(glade_file); |
| 1429 | init_tree_model(); | ||
| 1430 | init_left_tree(); | 1325 | init_left_tree(); |
| 1431 | init_right_tree(); | 1326 | init_right_tree(); |
| 1432 | 1327 | ||
| 1433 | conf_read(NULL); | 1328 | conf_read(NULL); |
| 1434 | 1329 | ||
| 1435 | switch (view_mode) { | 1330 | set_view_mode(view_mode); |
| 1436 | case SINGLE_VIEW: | ||
| 1437 | display_tree_part(); | ||
| 1438 | break; | ||
| 1439 | case SPLIT_VIEW: | ||
| 1440 | display_list(); | ||
| 1441 | break; | ||
| 1442 | case FULL_VIEW: | ||
| 1443 | display_tree(&rootmenu); | ||
| 1444 | break; | ||
| 1445 | } | ||
| 1446 | 1331 | ||
| 1447 | gtk_main(); | 1332 | gtk_main(); |
| 1448 | 1333 | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> | 1 | <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> |
| 2 | 2 | ||
| 3 | <glade-interface> | 3 | <interface> |
| 4 | 4 | ||
| 5 | <widget class="GtkWindow" id="window1"> | 5 | <object class="GtkWindow" id="window1"> |
| 6 | <property name="visible">True</property> | 6 | <property name="visible">True</property> |
| 7 | <property name="title" translatable="yes">Gtk Kernel Configurator</property> | 7 | <property name="title" translatable="yes">Gtk Kernel Configurator</property> |
| 8 | <property name="type">GTK_WINDOW_TOPLEVEL</property> | 8 | <property name="type">GTK_WINDOW_TOPLEVEL</property> |
| @@ -17,295 +17,196 @@ · 8 unmodified lines | |||
| 17 | <property name="skip_pager_hint">False</property> | 17 | <property name="skip_pager_hint">False</property> |
| 18 | <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> | 18 | <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> |
| 19 | <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> | 19 | <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> |
| 20 | <signal name="destroy" handler="on_window1_destroy" object="window1"/> | ||
| 21 | <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> | ||
| 22 | <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> | ||
| 23 | 20 | ||
| 24 | <child> | 21 | <child> |
| 25 | <widget class="GtkVBox" id="vbox1"> | 22 | <object class="GtkBox" id="vbox1"> |
| 23 | <property name="orientation">vertical</property> | ||
| 26 | <property name="visible">True</property> | 24 | <property name="visible">True</property> |
| 27 | <property name="homogeneous">False</property> | 25 | <property name="homogeneous">False</property> |
| 28 | <property name="spacing">0</property> | 26 | <property name="spacing">0</property> |
| 29 | 27 | ||
| 30 | <child> | 28 | <child> |
| 31 | <widget class="GtkMenuBar" id="menubar1"> | 29 | <object class="GtkMenuBar" id="menubar1"> |
| 32 | <property name="visible">True</property> | 30 | <property name="visible">True</property> |
| 33 | 31 | ||
| 34 | <child> | 32 | <child> |
| 35 | <widget class="GtkMenuItem" id="file1"> | 33 | <object class="GtkMenuItem" id="file1"> |
| 36 | <property name="visible">True</property> | 34 | <property name="visible">True</property> |
| 37 | <property name="label" translatable="yes">_File</property> | 35 | <property name="label" translatable="yes">_File</property> |
| 38 | <property name="use_underline">True</property> | 36 | <property name="use_underline">True</property> |
| 39 | 37 | ||
| 40 | <child> | 38 | <child type="submenu"> |
| 41 | <widget class="GtkMenu" id="file1_menu"> | 39 | <object class="GtkMenu" id="file1_menu"> |
| 42 | 40 | ||
| 43 | <child> | 41 | <child> |
| 44 | <widget class="GtkImageMenuItem" id="load1"> | 42 | <object class="GtkMenuItem" id="load1"> |
| 45 | <property name="visible">True</property> | 43 | <property name="visible">True</property> |
| 46 | <property name="tooltip" translatable="yes">Load a config file</property> | 44 | <property name="tooltip-text" translatable="yes">Load a config file</property> |
| 47 | <property name="label" translatable="yes">_Load</property> | 45 | <property name="label" translatable="yes">_Load</property> |
| 48 | <property name="use_underline">True</property> | 46 | <property name="use_underline">True</property> |
| 49 | <signal name="activate" handler="on_load1_activate"/> | ||
| 50 | <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 47 | <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
| 51 | 48 | </object> | |
| 52 | <child internal-child="image"> | ||
| 53 | <widget class="GtkImage" id="image39"> | ||
| 54 | <property name="visible">True</property> | ||
| 55 | <property name="stock">gtk-open</property> | ||
| 56 | <property name="icon_size">1</property> | ||
| 57 | <property name="xalign">0.5</property> | ||
| 58 | <property name="yalign">0.5</property> | ||
| 59 | <property name="xpad">0</property> | ||
| 60 | <property name="ypad">0</property> | ||
| 61 | </widget> | ||
| 62 | </child> | ||
| 63 | </widget> | ||
| 64 | </child> | 49 | </child> |
| 65 | 50 | ||
| 66 | <child> | 51 | <child> |
| 67 | <widget class="GtkImageMenuItem" id="save1"> | 52 | <object class="GtkMenuItem" id="save1"> |
| 68 | <property name="visible">True</property> | 53 | <property name="visible">True</property> |
| 69 | <property name="tooltip" translatable="yes">Save the config in .config</property> | 54 | <property name="tooltip-text" translatable="yes">Save the config in .config</property> |
| 70 | <property name="label" translatable="yes">_Save</property> | 55 | <property name="label" translatable="yes">_Save</property> |
| 71 | <property name="use_underline">True</property> | 56 | <property name="use_underline">True</property> |
| 72 | <signal name="activate" handler="on_save_activate"/> | ||
| 73 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 57 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
| 74 | 58 | </object> | |
| 75 | <child internal-child="image"> | ||
| 76 | <widget class="GtkImage" id="image40"> | ||
| 77 | <property name="visible">True</property> | ||
| 78 | <property name="stock">gtk-save</property> | ||
| 79 | <property name="icon_size">1</property> | ||
| 80 | <property name="xalign">0.5</property> | ||
| 81 | <property name="yalign">0.5</property> | ||
| 82 | <property name="xpad">0</property> | ||
| 83 | <property name="ypad">0</property> | ||
| 84 | </widget> | ||
| 85 | </child> | ||
| 86 | </widget> | ||
| 87 | </child> | 59 | </child> |
| 88 | 60 | ||
| 89 | <child> | 61 | <child> |
| 90 | <widget class="GtkImageMenuItem" id="save_as1"> | 62 | <object class="GtkMenuItem" id="save_as1"> |
| 91 | <property name="visible">True</property> | 63 | <property name="visible">True</property> |
| 92 | <property name="tooltip" translatable="yes">Save the config in a file</property> | 64 | <property name="tooltip-text" translatable="yes">Save the config in a file</property> |
| 93 | <property name="label" translatable="yes">Save _as</property> | 65 | <property name="label" translatable="yes">Save _as</property> |
| 94 | <property name="use_underline">True</property> | 66 | <property name="use_underline">True</property> |
| 95 | <signal name="activate" handler="on_save_as1_activate"/> | 67 | </object> |
| 96 | |||
| 97 | <child internal-child="image"> | ||
| 98 | <widget class="GtkImage" id="image41"> | ||
| 99 | <property name="visible">True</property> | ||
| 100 | <property name="stock">gtk-save-as</property> | ||
| 101 | <property name="icon_size">1</property> | ||
| 102 | <property name="xalign">0.5</property> | ||
| 103 | <property name="yalign">0.5</property> | ||
| 104 | <property name="xpad">0</property> | ||
| 105 | <property name="ypad">0</property> | ||
| 106 | </widget> | ||
| 107 | </child> | ||
| 108 | </widget> | ||
| 109 | </child> | 68 | </child> |
| 110 | 69 | ||
| 111 | <child> | 70 | <child> |
| 112 | <widget class="GtkSeparatorMenuItem" id="separator1"> | 71 | <object class="GtkSeparatorMenuItem" id="separator1"> |
| 113 | <property name="visible">True</property> | 72 | <property name="visible">True</property> |
| 114 | </widget> | 73 | </object> |
| 115 | </child> | 74 | </child> |
| 116 | 75 | ||
| 117 | <child> | 76 | <child> |
| 118 | <widget class="GtkImageMenuItem" id="quit1"> | 77 | <object class="GtkMenuItem" id="quit1"> |
| 119 | <property name="visible">True</property> | 78 | <property name="visible">True</property> |
| 120 | <property name="label" translatable="yes">_Quit</property> | 79 | <property name="label" translatable="yes">_Quit</property> |
| 121 | <property name="use_underline">True</property> | 80 | <property name="use_underline">True</property> |
| 122 | <signal name="activate" handler="on_quit1_activate"/> | ||
| 123 | <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 81 | <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
| 124 | 82 | </object> | |
| 125 | <child internal-child="image"> | ||
| 126 | <widget class="GtkImage" id="image42"> | ||
| 127 | <property name="visible">True</property> | ||
| 128 | <property name="stock">gtk-quit</property> | ||
| 129 | <property name="icon_size">1</property> | ||
| 130 | <property name="xalign">0.5</property> | ||
| 131 | <property name="yalign">0.5</property> | ||
| 132 | <property name="xpad">0</property> | ||
| 133 | <property name="ypad">0</property> | ||
| 134 | </widget> | ||
| 135 | </child> | ||
| 136 | </widget> | ||
| 137 | </child> | 83 | </child> |
| 138 | </widget> | 84 | </object> |
| 139 | </child> | 85 | </child> |
| 140 | </widget> | 86 | </object> |
| 141 | </child> | 87 | </child> |
| 142 | 88 | ||
| 143 | <child> | 89 | <child> |
| 144 | <widget class="GtkMenuItem" id="options1"> | 90 | <object class="GtkMenuItem" id="options1"> |
| 145 | <property name="visible">True</property> | 91 | <property name="visible">True</property> |
| 146 | <property name="label" translatable="yes">_Options</property> | 92 | <property name="label" translatable="yes">_Options</property> |
| 147 | <property name="use_underline">True</property> | 93 | <property name="use_underline">True</property> |
| 148 | 94 | ||
| 149 | <child> | 95 | <child type="submenu"> |
| 150 | <widget class="GtkMenu" id="options1_menu"> | 96 | <object class="GtkMenu" id="options1_menu"> |
| 151 | 97 | ||
| 152 | <child> | 98 | <child> |
| 153 | <widget class="GtkCheckMenuItem" id="show_name1"> | 99 | <object class="GtkCheckMenuItem" id="show_name1"> |
| 154 | <property name="visible">True</property> | 100 | <property name="visible">True</property> |
| 155 | <property name="tooltip" translatable="yes">Show name</property> | 101 | <property name="tooltip-text" translatable="yes">Show name</property> |
| 156 | <property name="label" translatable="yes">Show _name</property> | 102 | <property name="label" translatable="yes">Show _name</property> |
| 157 | <property name="use_underline">True</property> | 103 | <property name="use_underline">True</property> |
| 158 | <property name="active">False</property> | 104 | <property name="active">False</property> |
| 159 | <signal name="activate" handler="on_show_name1_activate"/> | 105 | </object> |
| 160 | </widget> | ||
| 161 | </child> | 106 | </child> |
| 162 | 107 | ||
| 163 | <child> | 108 | <child> |
| 164 | <widget class="GtkCheckMenuItem" id="show_range1"> | 109 | <object class="GtkCheckMenuItem" id="show_range1"> |
| 165 | <property name="visible">True</property> | 110 | <property name="visible">True</property> |
| 166 | <property name="tooltip" translatable="yes">Show range (Y/M/N)</property> | 111 | <property name="tooltip-text" translatable="yes">Show range (Y/M/N)</property> |
| 167 | <property name="label" translatable="yes">Show _range</property> | 112 | <property name="label" translatable="yes">Show _range</property> |
| 168 | <property name="use_underline">True</property> | 113 | <property name="use_underline">True</property> |
| 169 | <property name="active">False</property> | 114 | <property name="active">False</property> |
| 170 | <signal name="activate" handler="on_show_range1_activate"/> | 115 | </object> |
| 171 | </widget> | ||
| 172 | </child> | 116 | </child> |
| 173 | 117 | ||
| 174 | <child> | 118 | <child> |
| 175 | <widget class="GtkCheckMenuItem" id="show_data1"> | 119 | <object class="GtkCheckMenuItem" id="show_data1"> |
| 176 | <property name="visible">True</property> | 120 | <property name="visible">True</property> |
| 177 | <property name="tooltip" translatable="yes">Show value of the option</property> | 121 | <property name="tooltip-text" translatable="yes">Show value of the option</property> |
| 178 | <property name="label" translatable="yes">Show _data</property> | 122 | <property name="label" translatable="yes">Show _data</property> |
| 179 | <property name="use_underline">True</property> | 123 | <property name="use_underline">True</property> |
| 180 | <property name="active">False</property> | 124 | <property name="active">False</property> |
| 181 | <signal name="activate" handler="on_show_data1_activate"/> | 125 | </object> |
| 182 | </widget> | ||
| 183 | </child> | 126 | </child> |
| 184 | 127 | ||
| 185 | <child> | 128 | <child> |
| 186 | <widget class="GtkSeparatorMenuItem" id="separator2"> | 129 | <object class="GtkSeparatorMenuItem" id="separator2"> |
| 187 | <property name="visible">True</property> | 130 | <property name="visible">True</property> |
| 188 | </widget> | 131 | </object> |
| 189 | </child> | 132 | </child> |
| 190 | 133 | ||
| 191 | <child> | 134 | <child> |
| 192 | <widget class="GtkRadioMenuItem" id="set_option_mode1"> | 135 | <object class="GtkRadioMenuItem" id="set_option_mode1"> |
| 193 | <property name="visible">True</property> | 136 | <property name="visible">True</property> |
| 194 | <property name="tooltip" translatable="yes">Show normal options</property> | 137 | <property name="tooltip-text" translatable="yes">Show normal options</property> |
| 195 | <property name="label" translatable="yes">Show normal options</property> | 138 | <property name="label" translatable="yes">Show normal options</property> |
| 196 | <property name="use_underline">True</property> | 139 | <property name="use_underline">True</property> |
| 197 | <property name="active">True</property> | 140 | <property name="active">True</property> |
| 198 | <signal name="activate" handler="on_set_option_mode1_activate"/> | 141 | </object> |
| 199 | </widget> | ||
| 200 | </child> | 142 | </child> |
| 201 | 143 | ||
| 202 | <child> | 144 | <child> |
| 203 | <widget class="GtkRadioMenuItem" id="set_option_mode2"> | 145 | <object class="GtkRadioMenuItem" id="set_option_mode2"> |
| 204 | <property name="visible">True</property> | 146 | <property name="visible">True</property> |
| 205 | <property name="tooltip" translatable="yes">Show all options</property> | 147 | <property name="tooltip-text" translatable="yes">Show all options</property> |
| 206 | <property name="label" translatable="yes">Show all _options</property> | 148 | <property name="label" translatable="yes">Show all _options</property> |
| 207 | <property name="use_underline">True</property> | 149 | <property name="use_underline">True</property> |
| 208 | <property name="active">False</property> | 150 | <property name="active">False</property> |
| 209 | <property name="group">set_option_mode1</property> | 151 | <property name="group">set_option_mode1</property> |
| 210 | <signal name="activate" handler="on_set_option_mode2_activate"/> | 152 | </object> |
| 211 | </widget> | ||
| 212 | </child> | 153 | </child> |
| 213 | 154 | ||
| 214 | <child> | 155 | <child> |
| 215 | <widget class="GtkRadioMenuItem" id="set_option_mode3"> | 156 | <object class="GtkRadioMenuItem" id="set_option_mode3"> |
| 216 | <property name="visible">True</property> | 157 | <property name="visible">True</property> |
| 217 | <property name="tooltip" translatable="yes">Show all options with prompts</property> | 158 | <property name="tooltip-text" translatable="yes">Show all options with prompts</property> |
| 218 | <property name="label" translatable="yes">Show all prompt options</property> | 159 | <property name="label" translatable="yes">Show all prompt options</property> |
| 219 | <property name="use_underline">True</property> | 160 | <property name="use_underline">True</property> |
| 220 | <property name="active">False</property> | 161 | <property name="active">False</property> |
| 221 | <property name="group">set_option_mode1</property> | 162 | <property name="group">set_option_mode1</property> |
| 222 | <signal name="activate" handler="on_set_option_mode3_activate"/> | 163 | </object> |
| 223 | </widget> | ||
| 224 | </child> | 164 | </child> |
| 225 | 165 | ||
| 226 | </widget> | 166 | </object> |
| 227 | </child> | 167 | </child> |
| 228 | </widget> | 168 | </object> |
| 229 | </child> | 169 | </child> |
| 230 | 170 | ||
| 231 | <child> | 171 | <child> |
| 232 | <widget class="GtkMenuItem" id="help1"> | 172 | <object class="GtkMenuItem" id="help1"> |
| 233 | <property name="visible">True</property> | 173 | <property name="visible">True</property> |
| 234 | <property name="label" translatable="yes">_Help</property> | 174 | <property name="label" translatable="yes">_Help</property> |
| 235 | <property name="use_underline">True</property> | 175 | <property name="use_underline">True</property> |
| 236 | 176 | ||
| 237 | <child> | 177 | <child type="submenu"> |
| 238 | <widget class="GtkMenu" id="help1_menu"> | 178 | <object class="GtkMenu" id="help1_menu"> |
| 239 | 179 | ||
| 240 | <child> | 180 | <child> |
| 241 | <widget class="GtkImageMenuItem" id="introduction1"> | 181 | <object class="GtkMenuItem" id="introduction1"> |
| 242 | <property name="visible">True</property> | 182 | <property name="visible">True</property> |
| 243 | <property name="label" translatable="yes">_Introduction</property> | 183 | <property name="label" translatable="yes">_Introduction</property> |
| 244 | <property name="use_underline">True</property> | 184 | <property name="use_underline">True</property> |
| 245 | <signal name="activate" handler="on_introduction1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
| 246 | <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 185 | <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
| 247 | 186 | </object> | |
| 248 | <child internal-child="image"> | ||
| 249 | <widget class="GtkImage" id="image43"> | ||
| 250 | <property name="visible">True</property> | ||
| 251 | <property name="stock">gtk-dialog-question</property> | ||
| 252 | <property name="icon_size">1</property> | ||
| 253 | <property name="xalign">0.5</property> | ||
| 254 | <property name="yalign">0.5</property> | ||
| 255 | <property name="xpad">0</property> | ||
| 256 | <property name="ypad">0</property> | ||
| 257 | </widget> | ||
| 258 | </child> | ||
| 259 | </widget> | ||
| 260 | </child> | 187 | </child> |
| 261 | 188 | ||
| 262 | <child> | 189 | <child> |
| 263 | <widget class="GtkImageMenuItem" id="about1"> | 190 | <object class="GtkMenuItem" id="about1"> |
| 264 | <property name="visible">True</property> | 191 | <property name="visible">True</property> |
| 265 | <property name="label" translatable="yes">_About</property> | 192 | <property name="label" translatable="yes">_About</property> |
| 266 | <property name="use_underline">True</property> | 193 | <property name="use_underline">True</property> |
| 267 | <signal name="activate" handler="on_about1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
| 268 | <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 194 | <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
| 269 | 195 | </object> | |
| 270 | <child internal-child="image"> | ||
| 271 | <widget class="GtkImage" id="image44"> | ||
| 272 | <property name="visible">True</property> | ||
| 273 | <property name="stock">gtk-properties</property> | ||
| 274 | <property name="icon_size">1</property> | ||
| 275 | <property name="xalign">0.5</property> | ||
| 276 | <property name="yalign">0.5</property> | ||
| 277 | <property name="xpad">0</property> | ||
| 278 | <property name="ypad">0</property> | ||
| 279 | </widget> | ||
| 280 | </child> | ||
| 281 | </widget> | ||
| 282 | </child> | 196 | </child> |
| 283 | 197 | ||
| 284 | <child> | 198 | <child> |
| 285 | <widget class="GtkImageMenuItem" id="license1"> | 199 | <object class="GtkMenuItem" id="license1"> |
| 286 | <property name="visible">True</property> | 200 | <property name="visible">True</property> |
| 287 | <property name="label" translatable="yes">_License</property> | 201 | <property name="label" translatable="yes">_License</property> |
| 288 | <property name="use_underline">True</property> | 202 | <property name="use_underline">True</property> |
| 289 | <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | 203 | </object> |
| 290 | |||
| 291 | <child internal-child="image"> | ||
| 292 | <widget class="GtkImage" id="image45"> | ||
| 293 | <property name="visible">True</property> | ||
| 294 | <property name="stock">gtk-justify-fill</property> | ||
| 295 | <property name="icon_size">1</property> | ||
| 296 | <property name="xalign">0.5</property> | ||
| 297 | <property name="yalign">0.5</property> | ||
| 298 | <property name="xpad">0</property> | ||
| 299 | <property name="ypad">0</property> | ||
| 300 | </widget> | ||
| 301 | </child> | ||
| 302 | </widget> | ||
| 303 | </child> | 204 | </child> |
| 304 | </widget> | 205 | </object> |
| 305 | </child> | 206 | </child> |
| 306 | </widget> | 207 | </object> |
| 307 | </child> | 208 | </child> |
| 308 | </widget> | 209 | </object> |
| 309 | <packing> | 210 | <packing> |
| 310 | <property name="padding">0</property> | 211 | <property name="padding">0</property> |
| 311 | <property name="expand">False</property> | 212 | <property name="expand">False</property> |
| @@ -314,32 +215,23 @@ · 2 unmodified lines | |||
| 314 | </child> | 215 | </child> |
| 315 | 216 | ||
| 316 | <child> | 217 | <child> |
| 317 | <widget class="GtkHandleBox" id="handlebox1"> | 218 | <object class="GtkToolbar" id="toolbar1"> |
| 318 | <property name="visible">True</property> | ||
| 319 | <property name="shadow_type">GTK_SHADOW_OUT</property> | ||
| 320 | <property name="handle_position">GTK_POS_LEFT</property> | ||
| 321 | <property name="snap_edge">GTK_POS_TOP</property> | ||
| 322 | |||
| 323 | <child> | ||
| 324 | <widget class="GtkToolbar" id="toolbar1"> | ||
| 325 | <property name="visible">True</property> | 219 | <property name="visible">True</property> |
| 326 | <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> | 220 | <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> |
| 327 | <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> | 221 | <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> |
| 328 | <property name="tooltips">True</property> | ||
| 329 | <property name="show_arrow">True</property> | 222 | <property name="show_arrow">True</property> |
| 330 | 223 | ||
| 331 | <child> | 224 | <child> |
| 332 | <widget class="GtkToolButton" id="button1"> | 225 | <object class="GtkToolButton" id="button1"> |
| 333 | <property name="visible">True</property> | 226 | <property name="visible">True</property> |
| 334 | <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> | 227 | <property name="tooltip-text" translatable="yes">Goes up one level (single view)</property> |
| 335 | <property name="label" translatable="yes">Back</property> | 228 | <property name="label" translatable="yes">Back</property> |
| 336 | <property name="use_underline">True</property> | 229 | <property name="use_underline">True</property> |
| 337 | <property name="stock_id">gtk-undo</property> | 230 | <property name="stock_id">gtk-undo</property> |
| 338 | <property name="visible_horizontal">True</property> | 231 | <property name="visible_horizontal">True</property> |
| 339 | <property name="visible_vertical">True</property> | 232 | <property name="visible_vertical">True</property> |
| 340 | <property name="is_important">False</property> | 233 | <property name="is_important">False</property> |
| 341 | <signal name="clicked" handler="on_back_clicked"/> | 234 | </object> |
| 342 | </widget> | ||
| 343 | <packing> | 235 | <packing> |
| 344 | <property name="expand">False</property> | 236 | <property name="expand">False</property> |
| 345 | <property name="homogeneous">True</property> | 237 | <property name="homogeneous">True</property> |
| @@ -347,18 +239,18 @@ · 1 unmodified line | |||
| 347 | </child> | 239 | </child> |
| 348 | 240 | ||
| 349 | <child> | 241 | <child> |
| 350 | <widget class="GtkToolItem" id="toolitem1"> | 242 | <object class="GtkToolItem" id="toolitem1"> |
| 351 | <property name="visible">True</property> | 243 | <property name="visible">True</property> |
| 352 | <property name="visible_horizontal">True</property> | 244 | <property name="visible_horizontal">True</property> |
| 353 | <property name="visible_vertical">True</property> | 245 | <property name="visible_vertical">True</property> |
| 354 | <property name="is_important">False</property> | 246 | <property name="is_important">False</property> |
| 355 | 247 | ||
| 356 | <child> | 248 | <child> |
| 357 | <widget class="GtkVSeparator" id="vseparator1"> | 249 | <object class="GtkVSeparator" id="vseparator1"> |
| 358 | <property name="visible">True</property> | 250 | <property name="visible">True</property> |
| 359 | </widget> | 251 | </object> |
| 360 | </child> | 252 | </child> |
| 361 | </widget> | 253 | </object> |
| 362 | <packing> | 254 | <packing> |
| 363 | <property name="expand">False</property> | 255 | <property name="expand">False</property> |
| 364 | <property name="homogeneous">False</property> | 256 | <property name="homogeneous">False</property> |
| @@ -366,17 +258,16 @@ · 1 unmodified line | |||
| 366 | </child> | 258 | </child> |
| 367 | 259 | ||
| 368 | <child> | 260 | <child> |
| 369 | <widget class="GtkToolButton" id="button2"> | 261 | <object class="GtkToolButton" id="button2"> |
| 370 | <property name="visible">True</property> | 262 | <property name="visible">True</property> |
| 371 | <property name="tooltip" translatable="yes">Load a config file</property> | 263 | <property name="tooltip-text" translatable="yes">Load a config file</property> |
| 372 | <property name="label" translatable="yes">Load</property> | 264 | <property name="label" translatable="yes">Load</property> |
| 373 | <property name="use_underline">True</property> | 265 | <property name="use_underline">True</property> |
| 374 | <property name="stock_id">gtk-open</property> | 266 | <property name="stock_id">gtk-open</property> |
| 375 | <property name="visible_horizontal">True</property> | 267 | <property name="visible_horizontal">True</property> |
| 376 | <property name="visible_vertical">True</property> | 268 | <property name="visible_vertical">True</property> |
| 377 | <property name="is_important">False</property> | 269 | <property name="is_important">False</property> |
| 378 | <signal name="clicked" handler="on_load_clicked"/> | 270 | </object> |
| 379 | </widget> | ||
| 380 | <packing> | 271 | <packing> |
| 381 | <property name="expand">False</property> | 272 | <property name="expand">False</property> |
| 382 | <property name="homogeneous">True</property> | 273 | <property name="homogeneous">True</property> |
| @@ -384,17 +275,16 @@ · 1 unmodified line | |||
| 384 | </child> | 275 | </child> |
| 385 | 276 | ||
| 386 | <child> | 277 | <child> |
| 387 | <widget class="GtkToolButton" id="button3"> | 278 | <object class="GtkToolButton" id="button3"> |
| 388 | <property name="visible">True</property> | 279 | <property name="visible">True</property> |
| 389 | <property name="tooltip" translatable="yes">Save a config file</property> | 280 | <property name="tooltip-text" translatable="yes">Save a config file</property> |
| 390 | <property name="label" translatable="yes">Save</property> | 281 | <property name="label" translatable="yes">Save</property> |
| 391 | <property name="use_underline">True</property> | 282 | <property name="use_underline">True</property> |
| 392 | <property name="stock_id">gtk-save</property> | 283 | <property name="stock_id">gtk-save</property> |
| 393 | <property name="visible_horizontal">True</property> | 284 | <property name="visible_horizontal">True</property> |
| 394 | <property name="visible_vertical">True</property> | 285 | <property name="visible_vertical">True</property> |
| 395 | <property name="is_important">False</property> | 286 | <property name="is_important">False</property> |
| 396 | <signal name="clicked" handler="on_save_activate"/> | 287 | </object> |
| 397 | </widget> | ||
| 398 | <packing> | 288 | <packing> |
| 399 | <property name="expand">False</property> | 289 | <property name="expand">False</property> |
| 400 | <property name="homogeneous">True</property> | 290 | <property name="homogeneous">True</property> |
| @@ -402,18 +292,18 @@ · 1 unmodified line | |||
| 402 | </child> | 292 | </child> |
| 403 | 293 | ||
| 404 | <child> | 294 | <child> |
| 405 | <widget class="GtkToolItem" id="toolitem2"> | 295 | <object class="GtkToolItem" id="toolitem2"> |
| 406 | <property name="visible">True</property> | 296 | <property name="visible">True</property> |
| 407 | <property name="visible_horizontal">True</property> | 297 | <property name="visible_horizontal">True</property> |
| 408 | <property name="visible_vertical">True</property> | 298 | <property name="visible_vertical">True</property> |
| 409 | <property name="is_important">False</property> | 299 | <property name="is_important">False</property> |
| 410 | 300 | ||
| 411 | <child> | 301 | <child> |
| 412 | <widget class="GtkVSeparator" id="vseparator2"> | 302 | <object class="GtkVSeparator" id="vseparator2"> |
| 413 | <property name="visible">True</property> | 303 | <property name="visible">True</property> |
| 414 | </widget> | 304 | </object> |
| 415 | </child> | 305 | </child> |
| 416 | </widget> | 306 | </object> |
| 417 | <packing> | 307 | <packing> |
| 418 | <property name="expand">False</property> | 308 | <property name="expand">False</property> |
| 419 | <property name="homogeneous">False</property> | 309 | <property name="homogeneous">False</property> |
| @@ -421,17 +311,16 @@ · 1 unmodified line | |||
| 421 | </child> | 311 | </child> |
| 422 | 312 | ||
| 423 | <child> | 313 | <child> |
| 424 | <widget class="GtkToolButton" id="button4"> | 314 | <object class="GtkToolButton" id="button4"> |
| 425 | <property name="visible">True</property> | 315 | <property name="visible">True</property> |
| 426 | <property name="tooltip" translatable="yes">Single view</property> | 316 | <property name="tooltip-text" translatable="yes">Single view</property> |
| 427 | <property name="label" translatable="yes">Single</property> | 317 | <property name="label" translatable="yes">Single</property> |
| 428 | <property name="use_underline">True</property> | 318 | <property name="use_underline">True</property> |
| 429 | <property name="stock_id">gtk-missing-image</property> | 319 | <property name="stock_id">gtk-missing-image</property> |
| 430 | <property name="visible_horizontal">True</property> | 320 | <property name="visible_horizontal">True</property> |
| 431 | <property name="visible_vertical">True</property> | 321 | <property name="visible_vertical">True</property> |
| 432 | <property name="is_important">False</property> | 322 | <property name="is_important">False</property> |
| 433 | <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> | 323 | </object> |
| 434 | </widget> | ||
| 435 | <packing> | 324 | <packing> |
| 436 | <property name="expand">False</property> | 325 | <property name="expand">False</property> |
| 437 | <property name="homogeneous">True</property> | 326 | <property name="homogeneous">True</property> |
| @@ -439,17 +328,16 @@ · 1 unmodified line | |||
| 439 | </child> | 328 | </child> |
| 440 | 329 | ||
| 441 | <child> | 330 | <child> |
| 442 | <widget class="GtkToolButton" id="button5"> | 331 | <object class="GtkToolButton" id="button5"> |
| 443 | <property name="visible">True</property> | 332 | <property name="visible">True</property> |
| 444 | <property name="tooltip" translatable="yes">Split view</property> | 333 | <property name="tooltip-text" translatable="yes">Split view</property> |
| 445 | <property name="label" translatable="yes">Split</property> | 334 | <property name="label" translatable="yes">Split</property> |
| 446 | <property name="use_underline">True</property> | 335 | <property name="use_underline">True</property> |
| 447 | <property name="stock_id">gtk-missing-image</property> | 336 | <property name="stock_id">gtk-missing-image</property> |
| 448 | <property name="visible_horizontal">True</property> | 337 | <property name="visible_horizontal">True</property> |
| 449 | <property name="visible_vertical">True</property> | 338 | <property name="visible_vertical">True</property> |
| 450 | <property name="is_important">False</property> | 339 | <property name="is_important">False</property> |
| 451 | <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> | 340 | </object> |
| 452 | </widget> | ||
| 453 | <packing> | 341 | <packing> |
| 454 | <property name="expand">False</property> | 342 | <property name="expand">False</property> |
| 455 | <property name="homogeneous">True</property> | 343 | <property name="homogeneous">True</property> |
| @@ -457,17 +345,16 @@ · 1 unmodified line | |||
| 457 | </child> | 345 | </child> |
| 458 | 346 | ||
| 459 | <child> | 347 | <child> |
| 460 | <widget class="GtkToolButton" id="button6"> | 348 | <object class="GtkToolButton" id="button6"> |
| 461 | <property name="visible">True</property> | 349 | <property name="visible">True</property> |
| 462 | <property name="tooltip" translatable="yes">Full view</property> | 350 | <property name="tooltip-text" translatable="yes">Full view</property> |
| 463 | <property name="label" translatable="yes">Full</property> | 351 | <property name="label" translatable="yes">Full</property> |
| 464 | <property name="use_underline">True</property> | 352 | <property name="use_underline">True</property> |
| 465 | <property name="stock_id">gtk-missing-image</property> | 353 | <property name="stock_id">gtk-missing-image</property> |
| 466 | <property name="visible_horizontal">True</property> | 354 | <property name="visible_horizontal">True</property> |
| 467 | <property name="visible_vertical">True</property> | 355 | <property name="visible_vertical">True</property> |
| 468 | <property name="is_important">False</property> | 356 | <property name="is_important">False</property> |
| 469 | <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> | 357 | </object> |
| 470 | </widget> | ||
| 471 | <packing> | 358 | <packing> |
| 472 | <property name="expand">False</property> | 359 | <property name="expand">False</property> |
| 473 | <property name="homogeneous">True</property> | 360 | <property name="homogeneous">True</property> |
| @@ -475,18 +362,18 @@ · 1 unmodified line | |||
| 475 | </child> | 362 | </child> |
| 476 | 363 | ||
| 477 | <child> | 364 | <child> |
| 478 | <widget class="GtkToolItem" id="toolitem3"> | 365 | <object class="GtkToolItem" id="toolitem3"> |
| 479 | <property name="visible">True</property> | 366 | <property name="visible">True</property> |
| 480 | <property name="visible_horizontal">True</property> | 367 | <property name="visible_horizontal">True</property> |
| 481 | <property name="visible_vertical">True</property> | 368 | <property name="visible_vertical">True</property> |
| 482 | <property name="is_important">False</property> | 369 | <property name="is_important">False</property> |
| 483 | 370 | ||
| 484 | <child> | 371 | <child> |
| 485 | <widget class="GtkVSeparator" id="vseparator3"> | 372 | <object class="GtkVSeparator" id="vseparator3"> |
| 486 | <property name="visible">True</property> | 373 | <property name="visible">True</property> |
| 487 | </widget> | 374 | </object> |
| 488 | </child> | 375 | </child> |
| 489 | </widget> | 376 | </object> |
| 490 | <packing> | 377 | <packing> |
| 491 | <property name="expand">False</property> | 378 | <property name="expand">False</property> |
| 492 | <property name="homogeneous">False</property> | 379 | <property name="homogeneous">False</property> |
| @@ -494,17 +381,16 @@ · 1 unmodified line | |||
| 494 | </child> | 381 | </child> |
| 495 | 382 | ||
| 496 | <child> | 383 | <child> |
| 497 | <widget class="GtkToolButton" id="button7"> | 384 | <object class="GtkToolButton" id="button7"> |
| 498 | <property name="visible">True</property> | 385 | <property name="visible">True</property> |
| 499 | <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property> | 386 | <property name="tooltip-text" translatable="yes">Collapse the whole tree in the right frame</property> |
| 500 | <property name="label" translatable="yes">Collapse</property> | 387 | <property name="label" translatable="yes">Collapse</property> |
| 501 | <property name="use_underline">True</property> | 388 | <property name="use_underline">True</property> |
| 502 | <property name="stock_id">gtk-remove</property> | 389 | <property name="stock_id">gtk-remove</property> |
| 503 | <property name="visible_horizontal">True</property> | 390 | <property name="visible_horizontal">True</property> |
| 504 | <property name="visible_vertical">True</property> | 391 | <property name="visible_vertical">True</property> |
| 505 | <property name="is_important">False</property> | 392 | <property name="is_important">False</property> |
| 506 | <signal name="clicked" handler="on_collapse_clicked"/> | 393 | </object> |
| 507 | </widget> | ||
| 508 | <packing> | 394 | <packing> |
| 509 | <property name="expand">False</property> | 395 | <property name="expand">False</property> |
| 510 | <property name="homogeneous">True</property> | 396 | <property name="homogeneous">True</property> |
| @@ -512,25 +398,22 @@ · 1 unmodified line | |||
| 512 | </child> | 398 | </child> |
| 513 | 399 | ||
| 514 | <child> | 400 | <child> |
| 515 | <widget class="GtkToolButton" id="button8"> | 401 | <object class="GtkToolButton" id="button8"> |
| 516 | <property name="visible">True</property> | 402 | <property name="visible">True</property> |
| 517 | <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property> | 403 | <property name="tooltip-text" translatable="yes">Expand the whole tree in the right frame</property> |
| 518 | <property name="label" translatable="yes">Expand</property> | 404 | <property name="label" translatable="yes">Expand</property> |
| 519 | <property name="use_underline">True</property> | 405 | <property name="use_underline">True</property> |
| 520 | <property name="stock_id">gtk-add</property> | 406 | <property name="stock_id">gtk-add</property> |
| 521 | <property name="visible_horizontal">True</property> | 407 | <property name="visible_horizontal">True</property> |
| 522 | <property name="visible_vertical">True</property> | 408 | <property name="visible_vertical">True</property> |
| 523 | <property name="is_important">False</property> | 409 | <property name="is_important">False</property> |
| 524 | <signal name="clicked" handler="on_expand_clicked"/> | 410 | </object> |
| 525 | </widget> | ||
| 526 | <packing> | 411 | <packing> |
| 527 | <property name="expand">False</property> | 412 | <property name="expand">False</property> |
| 528 | <property name="homogeneous">True</property> | 413 | <property name="homogeneous">True</property> |
| 529 | </packing> | 414 | </packing> |
| 530 | </child> | 415 | </child> |
| 531 | </widget> | 416 | </object> |
| 532 | </child> | ||
| 533 | </widget> | ||
| 534 | <packing> | 417 | <packing> |
| 535 | <property name="padding">0</property> | 418 | <property name="padding">0</property> |
| 536 | <property name="expand">False</property> | 419 | <property name="expand">False</property> |
| @@ -539,14 +422,13 @@ · 2 unmodified lines | |||
| 539 | </child> | 422 | </child> |
| 540 | 423 | ||
| 541 | <child> | 424 | <child> |
| 542 | <widget class="GtkHPaned" id="hpaned1"> | 425 | <object class="GtkPaned" id="hpaned1"> |
| 543 | <property name="width_request">1</property> | 426 | <property name="width_request">1</property> |
| 544 | <property name="visible">True</property> | 427 | <property name="visible">True</property> |
| 545 | <property name="can_focus">True</property> | 428 | <property name="can_focus">True</property> |
| 546 | <property name="position">0</property> | ||
| 547 | 429 | ||
| 548 | <child> | 430 | <child> |
| 549 | <widget class="GtkScrolledWindow" id="scrolledwindow1"> | 431 | <object class="GtkScrolledWindow" id="scrolledwindow1"> |
| 550 | <property name="visible">True</property> | 432 | <property name="visible">True</property> |
| 551 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | 433 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> |
| 552 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | 434 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> |
| @@ -554,19 +436,16 @@ · 1 unmodified line | |||
| 554 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | 436 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> |
| 555 | 437 | ||
| 556 | <child> | 438 | <child> |
| 557 | <widget class="GtkTreeView" id="treeview1"> | 439 | <object class="GtkTreeView" id="treeview1"> |
| 558 | <property name="visible">True</property> | 440 | <property name="visible">True</property> |
| 559 | <property name="can_focus">True</property> | 441 | <property name="can_focus">True</property> |
| 560 | <property name="headers_visible">True</property> | 442 | <property name="headers_visible">True</property> |
| 561 | <property name="rules_hint">False</property> | 443 | <property name="rules_hint">False</property> |
| 562 | <property name="reorderable">False</property> | 444 | <property name="reorderable">False</property> |
| 563 | <property name="enable_search">False</property> | 445 | <property name="enable_search">False</property> |
| 564 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> | 446 | </object> |
| 565 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> | ||
| 566 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> | ||
| 567 | </widget> | ||
| 568 | </child> | 447 | </child> |
| 569 | </widget> | 448 | </object> |
| 570 | <packing> | 449 | <packing> |
| 571 | <property name="shrink">True</property> | 450 | <property name="shrink">True</property> |
| 572 | <property name="resize">False</property> | 451 | <property name="resize">False</property> |
| @@ -574,13 +453,13 @@ · 1 unmodified line | |||
| 574 | </child> | 453 | </child> |
| 575 | 454 | ||
| 576 | <child> | 455 | <child> |
| 577 | <widget class="GtkVPaned" id="vpaned1"> | 456 | <object class="GtkPaned" id="vpaned1"> |
| 457 | <property name="orientation">vertical</property> | ||
| 578 | <property name="visible">True</property> | 458 | <property name="visible">True</property> |
| 579 | <property name="can_focus">True</property> | 459 | <property name="can_focus">True</property> |
| 580 | <property name="position">0</property> | ||
| 581 | 460 | ||
| 582 | <child> | 461 | <child> |
| 583 | <widget class="GtkScrolledWindow" id="scrolledwindow2"> | 462 | <object class="GtkScrolledWindow" id="scrolledwindow2"> |
| 584 | <property name="visible">True</property> | 463 | <property name="visible">True</property> |
| 585 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | 464 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> |
| 586 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | 465 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> |
| @@ -588,7 +467,7 @@ · 1 unmodified line | |||
| 588 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | 467 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> |
| 589 | 468 | ||
| 590 | <child> | 469 | <child> |
| 591 | <widget class="GtkTreeView" id="treeview2"> | 470 | <object class="GtkTreeView" id="treeview2"> |
| 592 | <property name="visible">True</property> | 471 | <property name="visible">True</property> |
| 593 | <property name="can_focus">True</property> | 472 | <property name="can_focus">True</property> |
| 594 | <property name="has_focus">True</property> | 473 | <property name="has_focus">True</property> |
| @@ -596,12 +475,9 @@ · 1 unmodified line | |||
| 596 | <property name="rules_hint">False</property> | 475 | <property name="rules_hint">False</property> |
| 597 | <property name="reorderable">False</property> | 476 | <property name="reorderable">False</property> |
| 598 | <property name="enable_search">False</property> | 477 | <property name="enable_search">False</property> |
| 599 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> | 478 | </object> |
| 600 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> | ||
| 601 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> | ||
| 602 | </widget> | ||
| 603 | </child> | 479 | </child> |
| 604 | </widget> | 480 | </object> |
| 605 | <packing> | 481 | <packing> |
| 606 | <property name="shrink">True</property> | 482 | <property name="shrink">True</property> |
| 607 | <property name="resize">False</property> | 483 | <property name="resize">False</property> |
| @@ -609,7 +485,7 @@ · 1 unmodified line | |||
| 609 | </child> | 485 | </child> |
| 610 | 486 | ||
| 611 | <child> | 487 | <child> |
| 612 | <widget class="GtkScrolledWindow" id="scrolledwindow3"> | 488 | <object class="GtkScrolledWindow" id="scrolledwindow3"> |
| 613 | <property name="visible">True</property> | 489 | <property name="visible">True</property> |
| 614 | <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> | 490 | <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> |
| 615 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | 491 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> |
| @@ -617,7 +493,7 @@ · 1 unmodified line | |||
| 617 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | 493 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> |
| 618 | 494 | ||
| 619 | <child> | 495 | <child> |
| 620 | <widget class="GtkTextView" id="textview3"> | 496 | <object class="GtkTextView" id="textview3"> |
| 621 | <property name="visible">True</property> | 497 | <property name="visible">True</property> |
| 622 | <property name="can_focus">True</property> | 498 | <property name="can_focus">True</property> |
| 623 | <property name="editable">False</property> | 499 | <property name="editable">False</property> |
| @@ -632,30 +508,29 @@ · 8 unmodified lines | |||
| 632 | <property name="left_margin">0</property> | 508 | <property name="left_margin">0</property> |
| 633 | <property name="right_margin">0</property> | 509 | <property name="right_margin">0</property> |
| 634 | <property name="indent">0</property> | 510 | <property name="indent">0</property> |
| 635 | <property name="text" translatable="yes">Sorry, no help available for this option yet.</property> | 511 | </object> |
| 636 | </widget> | ||
| 637 | </child> | 512 | </child> |
| 638 | </widget> | 513 | </object> |
| 639 | <packing> | 514 | <packing> |
| 640 | <property name="shrink">True</property> | 515 | <property name="shrink">True</property> |
| 641 | <property name="resize">True</property> | 516 | <property name="resize">True</property> |
| 642 | </packing> | 517 | </packing> |
| 643 | </child> | 518 | </child> |
| 644 | </widget> | 519 | </object> |
| 645 | <packing> | 520 | <packing> |
| 646 | <property name="shrink">True</property> | 521 | <property name="shrink">True</property> |
| 647 | <property name="resize">True</property> | 522 | <property name="resize">True</property> |
| 648 | </packing> | 523 | </packing> |
| 649 | </child> | 524 | </child> |
| 650 | </widget> | 525 | </object> |
| 651 | <packing> | 526 | <packing> |
| 652 | <property name="padding">0</property> | 527 | <property name="padding">0</property> |
| 653 | <property name="expand">True</property> | 528 | <property name="expand">True</property> |
| 654 | <property name="fill">True</property> | 529 | <property name="fill">True</property> |
| 655 | </packing> | 530 | </packing> |
| 656 | </child> | 531 | </child> |
| 657 | </widget> | 532 | </object> |
| 658 | </child> | 533 | </child> |
| 659 | </widget> | 534 | </object> |
| 660 | 535 | ||
| 661 | </glade-interface> | 536 | </interface> |
| @@ -98,9 +98,11 @@ bool menu_is_visible(struct menu *menu); · 97 unmodified lines | |||
| 98 | bool menu_has_prompt(const struct menu *menu); | 98 | bool menu_has_prompt(const struct menu *menu); |
| 99 | const char *menu_get_prompt(const struct menu *menu); | 99 | const char *menu_get_prompt(const struct menu *menu); |
| 100 | struct menu *menu_get_parent_menu(struct menu *menu); | 100 | struct menu *menu_get_parent_menu(struct menu *menu); |
| 101 | struct menu *menu_get_menu_or_parent_menu(struct menu *menu); | ||
| 101 | int get_jump_key_char(void); | 102 | int get_jump_key_char(void); |
| 102 | struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); | 103 | struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); |
| 103 | void menu_get_ext_help(struct menu *menu, struct gstr *help); | 104 | void menu_get_ext_help(struct menu *menu, struct gstr *help); |
| 105 | void menu_dump(void); | ||
| 104 | 106 | ||
| 105 | /* symbol.c */ | 107 | /* symbol.c */ |
| 106 | void sym_clear_all_valid(void); | 108 | void sym_clear_all_valid(void); |
| @@ -39,8 +39,10 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width · 38 unmodified lines | |||
| 39 | 39 | ||
| 40 | if (!init) | 40 | if (!init) |
| 41 | instr[0] = '\0'; | 41 | instr[0] = '\0'; |
| 42 | else | 42 | else { |
| 43 | strcpy(instr, init); | 43 | strncpy(instr, init, sizeof(dialog_input_result) - 1); |
| 44 | instr[sizeof(dialog_input_result) - 1] = '\0'; | ||
| 45 | } | ||
| 44 | 46 | ||
| 45 | do_resize: | 47 | do_resize: |
| 46 | if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGHT_MIN)) | 48 | if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGHT_MIN)) |
| @@ -264,7 +264,7 @@ do_resize: · 263 unmodified lines | |||
| 264 | if (key < 256 && isalpha(key)) | 264 | if (key < 256 && isalpha(key)) |
| 265 | key = tolower(key); | 265 | key = tolower(key); |
| 266 | 266 | ||
| 267 | if (strchr("ynmh", key)) | 267 | if (strchr("ynmh ", key)) |
| 268 | i = max_choice; | 268 | i = max_choice; |
| 269 | else { | 269 | else { |
| 270 | for (i = choice + 1; i < max_choice; i++) { | 270 | for (i = choice + 1; i < max_choice; i++) { |
| @@ -345,8 +345,7 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) · 344 unmodified lines | |||
| 345 | int prompt_len, room, wlen; | 345 | int prompt_len, room, wlen; |
| 346 | char tempstr[MAX_LEN + 1], *word, *sp, *sp2, *newline_separator = 0; | 346 | char tempstr[MAX_LEN + 1], *word, *sp, *sp2, *newline_separator = 0; |
| 347 | 347 | ||
| 348 | strcpy(tempstr, prompt); | 348 | snprintf(tempstr, sizeof(tempstr), "%s", prompt); |
| 349 | |||
| 350 | prompt_len = strlen(tempstr); | 349 | prompt_len = strlen(tempstr); |
| 351 | 350 | ||
| 352 | if (prompt_len <= width - x * 2) { /* If prompt is short */ | 351 | if (prompt_len <= width - x * 2) { /* If prompt is short */ |
| @@ -575,7 +575,27 @@ const char *menu_get_prompt(const struct menu *menu) · 574 unmodified lines | |||
| 575 | return NULL; | 575 | return NULL; |
| 576 | } | 576 | } |
| 577 | 577 | ||
| 578 | /** | ||
| 579 | * menu_get_parent_menu - return the parent menu or NULL | ||
| 580 | * @menu: pointer to the menu | ||
| 581 | * return: the parent menu, or NULL if there is no parent. | ||
| 582 | */ | ||
| 578 | struct menu *menu_get_parent_menu(struct menu *menu) | 583 | struct menu *menu_get_parent_menu(struct menu *menu) |
| 584 | { | ||
| 585 | for (menu = menu->parent; menu; menu = menu->parent) | ||
| 586 | if (menu->type == M_MENU) | ||
| 587 | return menu; | ||
| 588 | |||
| 589 | return NULL; | ||
| 590 | } | ||
| 591 | |||
| 592 | /** | ||
| 593 | * menu_get_menu_or_parent_menu - return the parent menu or the menu itself | ||
| 594 | * @menu: pointer to the menu | ||
| 595 | * return: the parent menu. If the given argument is already a menu, return | ||
| 596 | * itself. | ||
| 597 | */ | ||
| 598 | struct menu *menu_get_menu_or_parent_menu(struct menu *menu) | ||
| 579 | { | 599 | { |
| 580 | enum prop_type type; | 600 | enum prop_type type; |
| 581 | 601 | ||
| @@ -768,3 +788,77 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) · 186 unmodified lines | |||
| 768 | if (sym) | 788 | if (sym) |
| 769 | get_symbol_str(help, sym, NULL); | 789 | get_symbol_str(help, sym, NULL); |
| 770 | } | 790 | } |
| 791 | |||
| 792 | /** | ||
| 793 | * menu_dump - dump all menu entries in a tree-like format | ||
| 794 | */ | ||
| 795 | void menu_dump(void) | ||
| 796 | { | ||
| 797 | struct menu *menu = &rootmenu; | ||
| 798 | unsigned long long bits = 0; | ||
| 799 | int indent = 0; | ||
| 800 | |||
| 801 | while (menu) { | ||
| 802 | |||
| 803 | for (int i = indent - 1; i >= 0; i--) { | ||
| 804 | if (bits & (1ULL << i)) { | ||
| 805 | if (i > 0) | ||
| 806 | printf("| "); | ||
| 807 | else | ||
| 808 | printf("|-- "); | ||
| 809 | } else { | ||
| 810 | if (i > 0) | ||
| 811 | printf(" "); | ||
| 812 | else | ||
| 813 | printf("`-- "); | ||
| 814 | } | ||
| 815 | } | ||
| 816 | |||
| 817 | switch (menu->type) { | ||
| 818 | case M_CHOICE: | ||
| 819 | printf("choice \"%s\"\n", menu->prompt->text); | ||
| 820 | break; | ||
| 821 | case M_COMMENT: | ||
| 822 | printf("comment \"%s\"\n", menu->prompt->text); | ||
| 823 | break; | ||
| 824 | case M_IF: | ||
| 825 | printf("if\n"); | ||
| 826 | break; | ||
| 827 | case M_MENU: | ||
| 828 | printf("menu \"%s\"", menu->prompt->text); | ||
| 829 | if (!menu->sym) { | ||
| 830 | printf("\n"); | ||
| 831 | break; | ||
| 832 | } | ||
| 833 | printf(" + "); | ||
| 834 | /* fallthrough */ | ||
| 835 | case M_NORMAL: | ||
| 836 | printf("symbol %s\n", menu->sym->name); | ||
| 837 | break; | ||
| 838 | } | ||
| 839 | if (menu->list) { | ||
| 840 | bits <<= 1; | ||
| 841 | menu = menu->list; | ||
| 842 | if (menu->next) | ||
| 843 | bits |= 1; | ||
| 844 | else | ||
| 845 | bits &= ~1; | ||
| 846 | indent++; | ||
| 847 | continue; | ||
| 848 | } | ||
| 849 | |||
| 850 | while (menu && !menu->next) { | ||
| 851 | menu = menu->parent; | ||
| 852 | bits >>= 1; | ||
| 853 | indent--; | ||
| 854 | } | ||
| 855 | |||
| 856 | if (menu) { | ||
| 857 | menu = menu->next; | ||
| 858 | if (menu->next) | ||
| 859 | bits |= 1; | ||
| 860 | else | ||
| 861 | bits &= ~1; | ||
| 862 | } | ||
| 863 | } | ||
| 864 | } | ||
| @@ -593,6 +593,8 @@ static void item_add_str(const char *fmt, ...) · 592 unmodified lines | |||
| 593 | tmp_str, | 593 | tmp_str, |
| 594 | sizeof(k_menu_items[index].str)); | 594 | sizeof(k_menu_items[index].str)); |
| 595 | 595 | ||
| 596 | k_menu_items[index].str[sizeof(k_menu_items[index].str) - 1] = '\0'; | ||
| 597 | |||
| 596 | free_item(curses_menu_items[index]); | 598 | free_item(curses_menu_items[index]); |
| 597 | curses_menu_items[index] = new_item( | 599 | curses_menu_items[index] = new_item( |
| 598 | k_menu_items[index].str, | 600 | k_menu_items[index].str, |
| @@ -359,6 +359,7 @@ int dialog_inputbox(WINDOW *main_window, · 358 unmodified lines | |||
| 359 | x = (columns-win_cols)/2; | 359 | x = (columns-win_cols)/2; |
| 360 | 360 | ||
| 361 | strncpy(result, init, *result_len); | 361 | strncpy(result, init, *result_len); |
| 362 | result[*result_len - 1] = '\0'; | ||
| 362 | 363 | ||
| 363 | /* create the windows */ | 364 | /* create the windows */ |
| 364 | win = newwin(win_lines, win_cols, y, x); | 365 | win = newwin(win_lines, win_cols, y, x); |
| @@ -37,6 +37,12 @@ QAction *ConfigMainWindow::saveAction; · 36 unmodified lines | |||
| 37 | ConfigSettings::ConfigSettings() | 37 | ConfigSettings::ConfigSettings() |
| 38 | : QSettings("kernel.org", "qconf") | 38 | : QSettings("kernel.org", "qconf") |
| 39 | { | 39 | { |
| 40 | beginGroup("/kconfig/qconf"); | ||
| 41 | } | ||
| 42 | |||
| 43 | ConfigSettings::~ConfigSettings() | ||
| 44 | { | ||
| 45 | endGroup(); | ||
| 40 | } | 46 | } |
| 41 | 47 | ||
| 42 | /** | 48 | /** |
| @@ -92,7 +98,6 @@ void ConfigItem::updateMenu(void) · 49 unmodified lines | |||
| 92 | { | 98 | { |
| 93 | ConfigList* list; | 99 | ConfigList* list; |
| 94 | struct symbol* sym; | 100 | struct symbol* sym; |
| 95 | struct property *prop; | ||
| 96 | QString prompt; | 101 | QString prompt; |
| 97 | int type; | 102 | int type; |
| 98 | tristate expr; | 103 | tristate expr; |
| @@ -105,11 +110,10 @@ void ConfigItem::updateMenu(void) · 6 unmodified lines | |||
| 105 | } | 110 | } |
| 106 | 111 | ||
| 107 | sym = menu->sym; | 112 | sym = menu->sym; |
| 108 | prop = menu->prompt; | ||
| 109 | prompt = menu_get_prompt(menu); | 113 | prompt = menu_get_prompt(menu); |
| 110 | 114 | ||
| 111 | if (prop) switch (prop->type) { | 115 | switch (menu->type) { |
| 112 | case P_MENU: | 116 | case M_MENU: |
| 113 | if (list->mode == singleMode) { | 117 | if (list->mode == singleMode) { |
| 114 | /* a menuconfig entry is displayed differently | 118 | /* a menuconfig entry is displayed differently |
| 115 | * depending whether it's at the view root or a child. | 119 | * depending whether it's at the view root or a child. |
| @@ -123,10 +127,16 @@ void ConfigItem::updateMenu(void) · 7 unmodified lines | |||
| 123 | setIcon(promptColIdx, QIcon()); | 127 | setIcon(promptColIdx, QIcon()); |
| 124 | } | 128 | } |
| 125 | goto set_prompt; | 129 | goto set_prompt; |
| 126 | case P_COMMENT: | 130 | case M_COMMENT: |
| 127 | setIcon(promptColIdx, QIcon()); | 131 | setIcon(promptColIdx, QIcon()); |
| 128 | prompt = "*** " + prompt + " ***"; | 132 | prompt = "*** " + prompt + " ***"; |
| 129 | goto set_prompt; | 133 | goto set_prompt; |
| 134 | case M_CHOICE: | ||
| 135 | setIcon(promptColIdx, QIcon()); | ||
| 136 | sym = sym_calc_choice(menu); | ||
| 137 | if (sym) | ||
| 138 | setText(dataColIdx, sym->name); | ||
| 139 | goto set_prompt; | ||
| 130 | default: | 140 | default: |
| 131 | ; | 141 | ; |
| 132 | } | 142 | } |
| @@ -188,7 +198,11 @@ void ConfigItem::testUpdateMenu(void) · 55 unmodified lines | |||
| 188 | if (!menu) | 198 | if (!menu) |
| 189 | return; | 199 | return; |
| 190 | 200 | ||
| 191 | sym_calc_value(menu->sym); | 201 | if (menu->type == M_CHOICE) |
| 202 | sym_calc_choice(menu); | ||
| 203 | else | ||
| 204 | sym_calc_value(menu->sym); | ||
| 205 | |||
| 192 | if (menu->flags & MENU_CHANGED) { | 206 | if (menu->flags & MENU_CHANGED) { |
| 193 | /* the menu entry changed, so update all list items */ | 207 | /* the menu entry changed, so update all list items */ |
| 194 | menu->flags &= ~MENU_CHANGED; | 208 | menu->flags &= ~MENU_CHANGED; |
| @@ -478,7 +492,7 @@ void ConfigList::updateListAllForAll() · 283 unmodified lines | |||
| 478 | while (it.hasNext()) { | 492 | while (it.hasNext()) { |
| 479 | ConfigList *list = it.next(); | 493 | ConfigList *list = it.next(); |
| 480 | 494 | ||
| 481 | list->updateList(); | 495 | list->updateListAll(); |
| 482 | } | 496 | } |
| 483 | } | 497 | } |
| 484 | 498 | ||
| @@ -569,7 +583,7 @@ void ConfigList::setParentMenu(void) · 84 unmodified lines | |||
| 569 | oldroot = rootEntry; | 583 | oldroot = rootEntry; |
| 570 | if (rootEntry == &rootmenu) | 584 | if (rootEntry == &rootmenu) |
| 571 | return; | 585 | return; |
| 572 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); | 586 | setRootMenu(menu_get_menu_or_parent_menu(rootEntry->parent)); |
| 573 | 587 | ||
| 574 | QTreeWidgetItemIterator it(this); | 588 | QTreeWidgetItemIterator it(this); |
| 575 | while (*it) { | 589 | while (*it) { |
| @@ -1532,7 +1546,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) · 956 unmodified lines | |||
| 1532 | switch (configList->mode) { | 1546 | switch (configList->mode) { |
| 1533 | case singleMode: | 1547 | case singleMode: |
| 1534 | list = configList; | 1548 | list = configList; |
| 1535 | parent = menu_get_parent_menu(menu); | 1549 | parent = menu_get_menu_or_parent_menu(menu); |
| 1536 | if (!parent) | 1550 | if (!parent) |
| 1537 | return; | 1551 | return; |
| 1538 | list->setRootMenu(parent); | 1552 | list->setRootMenu(parent); |
| @@ -1543,7 +1557,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) · 4 unmodified lines | |||
| 1543 | configList->clearSelection(); | 1557 | configList->clearSelection(); |
| 1544 | list = configList; | 1558 | list = configList; |
| 1545 | } else { | 1559 | } else { |
| 1546 | parent = menu_get_parent_menu(menu->parent); | 1560 | parent = menu_get_menu_or_parent_menu(menu->parent); |
| 1547 | if (!parent) | 1561 | if (!parent) |
| 1548 | return; | 1562 | return; |
| 1549 | 1563 | ||
| @@ -1821,7 +1835,6 @@ int main(int ac, char** av) · 271 unmodified lines | |||
| 1821 | configApp = new QApplication(ac, av); | 1835 | configApp = new QApplication(ac, av); |
| 1822 | 1836 | ||
| 1823 | configSettings = new ConfigSettings(); | 1837 | configSettings = new ConfigSettings(); |
| 1824 | configSettings->beginGroup("/kconfig/qconf"); | ||
| 1825 | v = new ConfigMainWindow(); | 1838 | v = new ConfigMainWindow(); |
| 1826 | 1839 | ||
| 1827 | //zconfdump(stdout); | 1840 | //zconfdump(stdout); |
| @@ -1829,7 +1842,6 @@ int main(int ac, char** av) · 1 unmodified line | |||
| 1829 | v->show(); | 1842 | v->show(); |
| 1830 | configApp->exec(); | 1843 | configApp->exec(); |
| 1831 | 1844 | ||
| 1832 | configSettings->endGroup(); | ||
| 1833 | delete configSettings; | 1845 | delete configSettings; |
| 1834 | delete v; | 1846 | delete v; |
| 1835 | delete configApp; | 1847 | delete configApp; |
| @@ -24,6 +24,7 @@ class ConfigMainWindow; · 23 unmodified lines | |||
| 24 | class ConfigSettings : public QSettings { | 24 | class ConfigSettings : public QSettings { |
| 25 | public: | 25 | public: |
| 26 | ConfigSettings(); | 26 | ConfigSettings(); |
| 27 | ~ConfigSettings(void); | ||
| 27 | QList<int> readSizes(const QString& key, bool *ok); | 28 | QList<int> readSizes(const QString& key, bool *ok); |
| 28 | bool writeSizes(const QString& key, const QList<int>& value); | 29 | bool writeSizes(const QString& key, const QList<int>& value); |
| 29 | }; | 30 | }; |
| @@ -195,6 +195,10 @@ static void sym_set_changed(struct symbol *sym) · 194 unmodified lines | |||
| 195 | 195 | ||
| 196 | list_for_each_entry(menu, &sym->menus, link) | 196 | list_for_each_entry(menu, &sym->menus, link) |
| 197 | menu->flags |= MENU_CHANGED; | 197 | menu->flags |= MENU_CHANGED; |
| 198 | |||
| 199 | menu = sym_get_choice_menu(sym); | ||
| 200 | if (menu) | ||
| 201 | menu->flags |= MENU_CHANGED; | ||
| 198 | } | 202 | } |
| 199 | 203 | ||
| 200 | static void sym_set_all_changed(void) | 204 | static void sym_set_all_changed(void) |