summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-11 19:26:23 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-11 19:26:23 -0600
commit9c1da645b0584601096320a43657cd560c471eb2 (patch)
treed01342e850aedc8002d6c463a7cff48d0b066fb6
parent4a7ce6c116b699fb935310af59743972bb628aab (diff)
downloadgtk3-tqt-engine-9c1da645.tar.gz
gtk3-tqt-engine-9c1da645.zip
Work around GTK crash on startup
-rw-r--r--rc/gtk.css2
-rw-r--r--tdegtk/tdegtk-theme.cpp259
2 files changed, 128 insertions, 133 deletions
diff --git a/rc/gtk.css b/rc/gtk.css
index 5aa547e..29df7a3 100644
--- a/rc/gtk.css
+++ b/rc/gtk.css
@@ -3,5 +3,3 @@
* {
engine:tdegtk;
}
-
-@import "tdegtk.css";
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp
index 9208ec2..e214844 100644
--- a/tdegtk/tdegtk-theme.cpp
+++ b/tdegtk/tdegtk-theme.cpp
@@ -142,12 +142,15 @@ G_MODULE_EXPORT GtkThemingEngine* create_engine(void) {
icon_sizes.push_back(std::make_pair("gtk-dialog", IconSize(KIcon::Small)));
icon_sizes.push_back(std::make_pair("", IconSize(KIcon::Small)));
- if (gtk3TQtDebug) {
+ // FIXME
+ // GTK3 crashes if false is passed to writeGtkThemeControlFile
+ // Figure out why!
+// if (gtk3TQtDebug) {
writeGtkThemeControlFile(true);
- }
- else {
- writeGtkThemeControlFile(false);
- }
+// }
+// else {
+// writeGtkThemeControlFile(false);
+// }
// Initialize hooks
m_widgetLookup.initializeHooks();
@@ -507,6 +510,122 @@ void writeGtkThemeControlFile(int forceRecreate) {
}
}
+ // Set up icons
+ // Build the list of icon theme directories.
+ // This function is recursive - it gets the directories of all the inherited themes as well
+ addIconThemeDir(iconTheme);
+
+ if (!iconThemeDirs.isEmpty()) {
+ GtkIconFactory* factory;
+ factory = gtk_icon_factory_new();
+
+ doIconMapping("gtk-about", "actions/about_kde.png", factory, iconThemeDirs);
+ doIconMapping("gtk-add", "actions/add.png", factory, iconThemeDirs);
+ doIconMapping("gtk-apply", "actions/apply.png", factory, iconThemeDirs);
+ doIconMapping("gtk-bold", "actions/text_bold.png", factory, iconThemeDirs);
+ doIconMapping("gtk-cancel", "actions/button_cancel.png", factory, iconThemeDirs);
+ doIconMapping("gtk-cdrom", "devices/cdrom_unmount.png", factory, iconThemeDirs);
+ doIconMapping("gtk-clear", "actions/editclear.png", factory, iconThemeDirs);
+ doIconMapping("gtk-close", "actions/fileclose.png", factory, iconThemeDirs);
+ doIconMapping("gtk-color-picker", "actions/colorpicker.png", factory, iconThemeDirs);
+ doIconMapping("gtk-copy", "actions/editcopy.png", factory, iconThemeDirs);
+ doIconMapping("gtk-convert", "actions/gtk-convert.png", factory, iconThemeDirs);
+ doIconMapping("gtk-connect", "actions/connect_creating.png", factory, iconThemeDirs);
+ doIconMapping("gtk-cut", "actions/editcut.png", factory, iconThemeDirs);
+ doIconMapping("gtk-delete", "actions/editdelete.png", factory, iconThemeDirs);
+ doIconMapping("gtk-dialog-authentication", "status/gtk-dialog-authentication", factory, iconThemeDirs);
+ doIconMapping("gtk-dialog-error", "actions/messagebox_critical.png", factory, iconThemeDirs);
+ doIconMapping("gtk-dialog-info", "actions/messagebox_info.png", factory, iconThemeDirs);
+ doIconMapping("gtk-dialog-question", "actions/help.png", factory, iconThemeDirs);
+ doIconMapping("gtk-dialog-warning", "actions/messagebox_warning.png", factory, iconThemeDirs);
+ doIconMapping("gtk-directory", "filesystems/folder.png", factory, iconThemeDirs);
+ doIconMapping("gtk-disconnect", "actions/connect_no.png", factory, iconThemeDirs);
+ doIconMapping("gtk-dnd", "mimetypes/empty.png", factory, iconThemeDirs);
+ doIconMapping("gtk-dnd-multiple", "mimetypes/kmultiple.png", factory, iconThemeDirs);
+ doIconMapping("gtk-edit", "actions/edit.png", factory, iconThemeDirs); //2.6
+ doIconMapping("gtk-execute", "actions/exec.png", factory, iconThemeDirs);
+ doIconMapping("gtk-file", "mimetypes/empty.png", factory, iconThemeDirs);
+ doIconMapping("gtk-find", "actions/find.png", factory, iconThemeDirs);
+ doIconMapping("gtk-find-and-replace", "actions/find.png", factory, iconThemeDirs); // Is there a TDE "find and replace" icon? FIXME
+ doIconMapping("gtk-floppy", "devices/3floppy_unmount.png", factory, iconThemeDirs);
+ doIconMapping("gtk-fullscreen", "actions/window-fullscreen.png", factory, iconThemeDirs);
+ doIconMapping("gtk-goto-bottom", "actions/bottom.png", factory, iconThemeDirs);
+ doIconMapping("gtk-goto-first", "actions/start.png", factory, iconThemeDirs);
+ doIconMapping("gtk-goto-last", "actions/finish.png", factory, iconThemeDirs);
+ doIconMapping("gtk-goto-top", "actions/top.png", factory, iconThemeDirs);
+ doIconMapping("gtk-go-back", "actions/back.png", factory, iconThemeDirs);
+ doIconMapping("gtk-go-down", "actions/down.png", factory, iconThemeDirs);
+ doIconMapping("gtk-go-forward", "actions/forward.png", factory, iconThemeDirs);
+ doIconMapping("gtk-go-up", "actions/up.png", factory, iconThemeDirs);
+ doIconMapping("gtk-harddisk", "devices/hdd_unmount.png", factory, iconThemeDirs);
+ doIconMapping("gtk-help", "apps/khelpcenter.png", factory, iconThemeDirs);
+ doIconMapping("gtk-home", "filesystems/folder_home.png", factory, iconThemeDirs);
+ doIconMapping("gtk-indent", "actions/indent.png", factory, iconThemeDirs);
+ doIconMapping("gtk-index", "actions/contents.png", factory, iconThemeDirs);
+ doIconMapping("gtk-info", "actions/messagebox_info.png", factory, iconThemeDirs);
+ doIconMapping("gtk-italic", "actions/text_italic.png", factory, iconThemeDirs);
+ doIconMapping("gtk-jump-to", "actions/goto.png", factory, iconThemeDirs);
+ doIconMapping("gtk-justify-center", "actions/text_center.png", factory, iconThemeDirs);
+ doIconMapping("gtk-justify-fill", "actions/text_block.png", factory, iconThemeDirs);
+ doIconMapping("gtk-justify-left", "actions/text_left.png", factory, iconThemeDirs);
+ doIconMapping("gtk-justify-right", "actions/text_right.png", factory, iconThemeDirs);
+ doIconMapping("gtk-leave-fullscreen", "actions/window-nofullscreen.png", factory, iconThemeDirs);
+ doIconMapping("gtk-media-forward", "player-fwd.png", factory, iconThemeDirs);
+ doIconMapping("gtk-media-next", "actions/player-end.png", factory, iconThemeDirs);
+ doIconMapping("gtk-media-pause", "actions/player-pause.png", factory, iconThemeDirs);
+ doIconMapping("gtk-media-previous", "actions/player-start.png", factory, iconThemeDirs);
+ doIconMapping("gtk-media-record", "actions/gtk-media-record.png", factory, iconThemeDirs); // FIXME
+ doIconMapping("gtk-media-rewind", "actions/player-rew.png", factory, iconThemeDirs);
+ doIconMapping("gtk-media-stop", "actions/player-stop.png", factory, iconThemeDirs);
+ doIconMapping("gtk-missing-image", "mimetypes/unknown.png", factory, iconThemeDirs);
+ doIconMapping("gtk-network", "filesystems/network.png", factory, iconThemeDirs);
+ doIconMapping("gtk-new", "actions/filenew.png", factory, iconThemeDirs);
+ doIconMapping("gtk-no", "actions/gtk-no.png", factory, iconThemeDirs);
+ doIconMapping("gtk-ok", "actions/button_ok.png", factory, iconThemeDirs);
+ doIconMapping("gtk-open", "actions/fileopen.png", factory, iconThemeDirs);
+ //doIconMapping("gtk-orientation-landscape", factory, iconThemeDirs); // FIXME
+ //doIconMapping("gtk-orientation-portrait", factory, iconThemeDirs); // FIXME
+ //doIconMapping("gtk-orientation-reverse-landscape", factory, iconThemeDirs); // FIXME
+ //doIconMapping("gtk-orientation-reverse-portrait"", factory, iconThemeDirs); // FIXME
+ doIconMapping("gtk-paste", "actions/editpaste.png", factory, iconThemeDirs);
+ doIconMapping("gtk-preferences", "actions/configure.png", factory, iconThemeDirs);
+ doIconMapping("gtk-print", "actions/fileprint.png", factory, iconThemeDirs);
+ doIconMapping("gtk-print-preview", "actions/filequickprint.png", factory, iconThemeDirs);
+ doIconMapping("gtk-properties", "actions/configure.png", factory, iconThemeDirs);
+ doIconMapping("gtk-quit", "actions/exit.png", factory, iconThemeDirs);
+ doIconMapping("gtk-redo", "actions/redo.png", factory, iconThemeDirs);
+ doIconMapping("gtk-refresh", "actions/reload.png", factory, iconThemeDirs);
+ doIconMapping("gtk-remove", "actions/remove.png", factory, iconThemeDirs);
+ doIconMapping("gtk-revert-to-saved", "actions/revert.png", factory, iconThemeDirs);
+ doIconMapping("gtk-save", "actions/filesave.png", factory, iconThemeDirs);
+ doIconMapping("gtk-save-as", "actions/filesaveas.png", factory, iconThemeDirs);
+ doIconMapping("gtk-select-all", "actions/gtk-select-all.png", factory, iconThemeDirs); // FIXME
+ doIconMapping("gtk-select-color", "actions/colorize.png", factory, iconThemeDirs);
+ doIconMapping("gtk-select-font", "mimetypes/font.png", factory, iconThemeDirs);
+ //doIconMapping("gtk-sort-ascending", "??", factory, iconThemeDirs); // FIXME
+ //doIconMapping("gtk-sort-descending", "??", factory, iconThemeDirs); // FIXME
+ doIconMapping("gtk-spell-check", "actions/spellcheck.png", factory, iconThemeDirs);
+ doIconMapping("gtk-stop", "actions/stop.png", factory, iconThemeDirs);
+ doIconMapping("gtk-strikethrough", "actions/text_strike.png", factory, iconThemeDirs);
+ doIconMapping("gtk-undelete", "actions/gtk-undelete.png", factory, iconThemeDirs); // FIXME
+ doIconMapping("gtk-underline", "actions/text_under.png", factory, iconThemeDirs);
+ doIconMapping("gtk-undo", "actions/undo.png", factory, iconThemeDirs);
+ doIconMapping("gtk-unindent", "actions/unindent.png", factory, iconThemeDirs);
+ doIconMapping("gtk-yes", "actions/button_ok.png", factory, iconThemeDirs); // Verify mapping here
+ doIconMapping("gtk-zoom-100", "actions/viewmag1.png", factory, iconThemeDirs);
+ doIconMapping("gtk-zoom-fit", "actions/viewmagfit.png", factory, iconThemeDirs);
+ doIconMapping("gtk-zoom-in", "actions/viewmag+.png", factory, iconThemeDirs);
+ doIconMapping("gtk-zoom-out", "actions/viewmag-.png", factory, iconThemeDirs);
+
+ // Other icons that really should have Trinity equivalents in tdelibs
+ doIconMapping("list-add", "actions/add.png", factory, iconThemeDirs);
+ doIconMapping("list-remove", "actions/remove.png", factory, iconThemeDirs);
+ doIconMapping("list-add-symbolic", "actions/add.png", factory, iconThemeDirs);
+ doIconMapping("list-remove-symbolic", "actions/remove.png", factory, iconThemeDirs);
+
+ gtk_icon_factory_add_default(factory);
+ }
+
// This function takes quite a long time to execute, and is run at the start of every app.
// In order to speed it up, we can store the results in a file, along with the name of icon
// theme and style. This file can then be regenerated when the icon theme or style change.
@@ -537,14 +656,14 @@ void writeGtkThemeControlFile(int forceRecreate) {
TQFile themeFile(themeFilePath);
TQTextStream stream;
- if (!forceRecreate && themeFile.exists())
- {
+ if (!forceRecreate && themeFile.exists()) {
themeFile.open(IO_ReadOnly);
stream.setDevice(TQT_TQIODEVICE(&themeFile));
- if (stream.readLine() == "/* " + iconTheme + ", " + tqApp->style().name() + ", " + RC_CACHE_VERSION + " */")
- {
+ if (stream.readLine() == "/* " + iconTheme + ", " + tqApp->style().name() + ", " + RC_CACHE_VERSION + " */") {
// This cache matches the current icon theme and style
+ themeFile.close();
+
gtk3_tqt_reload_theme_definition_file(themeFilePath.latin1());
return;
}
@@ -829,128 +948,6 @@ void writeGtkThemeControlFile(int forceRecreate) {
stream << parse_rc_string(tdeFontToGTKFontString(generalFont), "*");
stream << parse_rc_string(tdeFontToGTKFontString(toolBarFont), "*GtkToolbar*GtkButton*");
stream << parse_rc_string(tdeFontToGTKFontString(menuFont), "*.GtkMenu");
-
- // Set up icons
- // Build the list of icon theme directories.
- // This function is recursive - it gets the directories of all the inherited themes as well
- addIconThemeDir(iconTheme);
-
- if (iconThemeDirs.isEmpty()) {
- themeFile.close();
- if (!forceRecreate) {
- gtk3_tqt_reload_theme_definition_file(themeFilePath.latin1());
- }
- return;
- }
-
- GtkIconFactory* factory;
- factory = gtk_icon_factory_new();
-
- doIconMapping("gtk-about", "actions/about_kde.png", factory, iconThemeDirs);
- doIconMapping("gtk-add", "actions/add.png", factory, iconThemeDirs);
- doIconMapping("gtk-apply", "actions/apply.png", factory, iconThemeDirs);
- doIconMapping("gtk-bold", "actions/text_bold.png", factory, iconThemeDirs);
- doIconMapping("gtk-cancel", "actions/button_cancel.png", factory, iconThemeDirs);
- doIconMapping("gtk-cdrom", "devices/cdrom_unmount.png", factory, iconThemeDirs);
- doIconMapping("gtk-clear", "actions/editclear.png", factory, iconThemeDirs);
- doIconMapping("gtk-close", "actions/fileclose.png", factory, iconThemeDirs);
- doIconMapping("gtk-color-picker", "actions/colorpicker.png", factory, iconThemeDirs);
- doIconMapping("gtk-copy", "actions/editcopy.png", factory, iconThemeDirs);
- doIconMapping("gtk-convert", "actions/gtk-convert.png", factory, iconThemeDirs);
- doIconMapping("gtk-connect", "actions/connect_creating.png", factory, iconThemeDirs);
- doIconMapping("gtk-cut", "actions/editcut.png", factory, iconThemeDirs);
- doIconMapping("gtk-delete", "actions/editdelete.png", factory, iconThemeDirs);
- doIconMapping("gtk-dialog-authentication", "status/gtk-dialog-authentication", factory, iconThemeDirs);
- doIconMapping("gtk-dialog-error", "actions/messagebox_critical.png", factory, iconThemeDirs);
- doIconMapping("gtk-dialog-info", "actions/messagebox_info.png", factory, iconThemeDirs);
- doIconMapping("gtk-dialog-question", "actions/help.png", factory, iconThemeDirs);
- doIconMapping("gtk-dialog-warning", "actions/messagebox_warning.png", factory, iconThemeDirs);
- doIconMapping("gtk-directory", "filesystems/folder.png", factory, iconThemeDirs);
- doIconMapping("gtk-disconnect", "actions/connect_no.png", factory, iconThemeDirs);
- doIconMapping("gtk-dnd", "mimetypes/empty.png", factory, iconThemeDirs);
- doIconMapping("gtk-dnd-multiple", "mimetypes/kmultiple.png", factory, iconThemeDirs);
- doIconMapping("gtk-edit", "actions/edit.png", factory, iconThemeDirs); //2.6
- doIconMapping("gtk-execute", "actions/exec.png", factory, iconThemeDirs);
- doIconMapping("gtk-file", "mimetypes/empty.png", factory, iconThemeDirs);
- doIconMapping("gtk-find", "actions/find.png", factory, iconThemeDirs);
- doIconMapping("gtk-find-and-replace", "actions/find.png", factory, iconThemeDirs); // Is there a TDE "find and replace" icon? FIXME
- doIconMapping("gtk-floppy", "devices/3floppy_unmount.png", factory, iconThemeDirs);
- doIconMapping("gtk-fullscreen", "actions/window-fullscreen.png", factory, iconThemeDirs);
- doIconMapping("gtk-goto-bottom", "actions/bottom.png", factory, iconThemeDirs);
- doIconMapping("gtk-goto-first", "actions/start.png", factory, iconThemeDirs);
- doIconMapping("gtk-goto-last", "actions/finish.png", factory, iconThemeDirs);
- doIconMapping("gtk-goto-top", "actions/top.png", factory, iconThemeDirs);
- doIconMapping("gtk-go-back", "actions/back.png", factory, iconThemeDirs);
- doIconMapping("gtk-go-down", "actions/down.png", factory, iconThemeDirs);
- doIconMapping("gtk-go-forward", "actions/forward.png", factory, iconThemeDirs);
- doIconMapping("gtk-go-up", "actions/up.png", factory, iconThemeDirs);
- doIconMapping("gtk-harddisk", "devices/hdd_unmount.png", factory, iconThemeDirs);
- doIconMapping("gtk-help", "apps/khelpcenter.png", factory, iconThemeDirs);
- doIconMapping("gtk-home", "filesystems/folder_home.png", factory, iconThemeDirs);
- doIconMapping("gtk-indent", "actions/indent.png", factory, iconThemeDirs);
- doIconMapping("gtk-index", "actions/contents.png", factory, iconThemeDirs);
- doIconMapping("gtk-info", "actions/messagebox_info.png", factory, iconThemeDirs);
- doIconMapping("gtk-italic", "actions/text_italic.png", factory, iconThemeDirs);
- doIconMapping("gtk-jump-to", "actions/goto.png", factory, iconThemeDirs);
- doIconMapping("gtk-justify-center", "actions/text_center.png", factory, iconThemeDirs);
- doIconMapping("gtk-justify-fill", "actions/text_block.png", factory, iconThemeDirs);
- doIconMapping("gtk-justify-left", "actions/text_left.png", factory, iconThemeDirs);
- doIconMapping("gtk-justify-right", "actions/text_right.png", factory, iconThemeDirs);
- doIconMapping("gtk-leave-fullscreen", "actions/window-nofullscreen.png", factory, iconThemeDirs);
- doIconMapping("gtk-media-forward", "player-fwd.png", factory, iconThemeDirs);
- doIconMapping("gtk-media-next", "actions/player-end.png", factory, iconThemeDirs);
- doIconMapping("gtk-media-pause", "actions/player-pause.png", factory, iconThemeDirs);
- doIconMapping("gtk-media-previous", "actions/player-start.png", factory, iconThemeDirs);
- doIconMapping("gtk-media-record", "actions/gtk-media-record.png", factory, iconThemeDirs); // FIXME
- doIconMapping("gtk-media-rewind", "actions/player-rew.png", factory, iconThemeDirs);
- doIconMapping("gtk-media-stop", "actions/player-stop.png", factory, iconThemeDirs);
- doIconMapping("gtk-missing-image", "mimetypes/unknown.png", factory, iconThemeDirs);
- doIconMapping("gtk-network", "filesystems/network.png", factory, iconThemeDirs);
- doIconMapping("gtk-new", "actions/filenew.png", factory, iconThemeDirs);
- doIconMapping("gtk-no", "actions/gtk-no.png", factory, iconThemeDirs);
- doIconMapping("gtk-ok", "actions/button_ok.png", factory, iconThemeDirs);
- doIconMapping("gtk-open", "actions/fileopen.png", factory, iconThemeDirs);
- //doIconMapping("gtk-orientation-landscape", factory, iconThemeDirs); // FIXME
- //doIconMapping("gtk-orientation-portrait", factory, iconThemeDirs); // FIXME
- //doIconMapping("gtk-orientation-reverse-landscape", factory, iconThemeDirs); // FIXME
- //doIconMapping("gtk-orientation-reverse-portrait"", factory, iconThemeDirs); // FIXME
- doIconMapping("gtk-paste", "actions/editpaste.png", factory, iconThemeDirs);
- doIconMapping("gtk-preferences", "actions/configure.png", factory, iconThemeDirs);
- doIconMapping("gtk-print", "actions/fileprint.png", factory, iconThemeDirs);
- doIconMapping("gtk-print-preview", "actions/filequickprint.png", factory, iconThemeDirs);
- doIconMapping("gtk-properties", "actions/configure.png", factory, iconThemeDirs);
- doIconMapping("gtk-quit", "actions/exit.png", factory, iconThemeDirs);
- doIconMapping("gtk-redo", "actions/redo.png", factory, iconThemeDirs);
- doIconMapping("gtk-refresh", "actions/reload.png", factory, iconThemeDirs);
- doIconMapping("gtk-remove", "actions/remove.png", factory, iconThemeDirs);
- doIconMapping("gtk-revert-to-saved", "actions/revert.png", factory, iconThemeDirs);
- doIconMapping("gtk-save", "actions/filesave.png", factory, iconThemeDirs);
- doIconMapping("gtk-save-as", "actions/filesaveas.png", factory, iconThemeDirs);
- doIconMapping("gtk-select-all", "actions/gtk-select-all.png", factory, iconThemeDirs); // FIXME
- doIconMapping("gtk-select-color", "actions/colorize.png", factory, iconThemeDirs);
- doIconMapping("gtk-select-font", "mimetypes/font.png", factory, iconThemeDirs);
- //doIconMapping("gtk-sort-ascending", "??", factory, iconThemeDirs); // FIXME
- //doIconMapping("gtk-sort-descending", "??", factory, iconThemeDirs); // FIXME
- doIconMapping("gtk-spell-check", "actions/spellcheck.png", factory, iconThemeDirs);
- doIconMapping("gtk-stop", "actions/stop.png", factory, iconThemeDirs);
- doIconMapping("gtk-strikethrough", "actions/text_strike.png", factory, iconThemeDirs);
- doIconMapping("gtk-undelete", "actions/gtk-undelete.png", factory, iconThemeDirs); // FIXME
- doIconMapping("gtk-underline", "actions/text_under.png", factory, iconThemeDirs);
- doIconMapping("gtk-undo", "actions/undo.png", factory, iconThemeDirs);
- doIconMapping("gtk-unindent", "actions/unindent.png", factory, iconThemeDirs);
- doIconMapping("gtk-yes", "actions/button_ok.png", factory, iconThemeDirs); // Verify mapping here
- doIconMapping("gtk-zoom-100", "actions/viewmag1.png", factory, iconThemeDirs);
- doIconMapping("gtk-zoom-fit", "actions/viewmagfit.png", factory, iconThemeDirs);
- doIconMapping("gtk-zoom-in", "actions/viewmag+.png", factory, iconThemeDirs);
- doIconMapping("gtk-zoom-out", "actions/viewmag-.png", factory, iconThemeDirs);
-
- // Other icons that really should have Trinity equivalents in tdelibs
- doIconMapping("list-add", "actions/add.png", factory, iconThemeDirs);
- doIconMapping("list-remove", "actions/remove.png", factory, iconThemeDirs);
- doIconMapping("list-add-symbolic", "actions/add.png", factory, iconThemeDirs);
- doIconMapping("list-remove-symbolic", "actions/remove.png", factory, iconThemeDirs);
-
- gtk_icon_factory_add_default(factory);
themeFile.close();