From: <ev...@us...> - 2006-08-19 00:56:03
|
Revision: 16855 Author: evands Date: 2006-08-18 17:52:24 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16855&view=rev Log Message: ----------- ** Part 1 of a 4 part commit ** Restructured the tree and the build files for the core/UI split. libgaim is now built as a library against which gtkgaim and gntgaim link and can be built separately from them by configuring with them disable d (--disable-gtkgaim and --disable-gntgaim). Each of the three source trees (gtk, console, and core) has its own plugins folder. This works nicely on my system; hopefully it won't cause too much chaos for others. If you have local changes, an easy way to merge them to the new layout should be along the lines of svn diff -r version_before_move > myChanges.diff patch -p1 < myChanges.diff where svn diff is done from the gaim checkout root but patch is done from gtk or core (or both). This changeset combines work by Sadrul Chowdhury, Gary Kramlich (grim), and me. Known issues: * On my system, at least, something's not quite right with the gtkgaim build process; it imports gtkgaim.h (as can be seen by adding a #warning) but <gtk/gtk.h> doesn't seem to be used. The GTK_STOCK_XXX defi nes claim to be undeclared. I was going to make this work before committing, but I strongly suspect someone with more autotools experience will be able to fix it easily whereas I've already glared at it for a n hour. * The gnt console UI depends on libgnt, which is not yet automatically built. Either autogen.sh && make && make install libgnt (in console/libgnt) or configure with --disable-gnt for now. * The Windows build process has not been touched yet so still needs updating. * There's an stray "rm: core: is a directory" warning after autogen.sh is compl te. I'm not sure where that's coming from. Added Paths: ----------- trunk/gtk/ trunk/gtk/Makefile.am trunk/gtk/gaimcombobox.c trunk/gtk/gaimcombobox.h trunk/gtk/gaimstock.c trunk/gtk/gaimstock.h trunk/gtk/getopt.c trunk/gtk/getopt.h trunk/gtk/getopt1.c trunk/gtk/gtkaccount.c trunk/gtk/gtkaccount.h trunk/gtk/gtkblist.c trunk/gtk/gtkblist.h trunk/gtk/gtkcelllayout.c trunk/gtk/gtkcelllayout.h trunk/gtk/gtkcellrendererprogress.c trunk/gtk/gtkcellrendererprogress.h trunk/gtk/gtkcellview.c trunk/gtk/gtkcellview.h trunk/gtk/gtkcellviewmenuitem.c trunk/gtk/gtkcellviewmenuitem.h trunk/gtk/gtkconn.c trunk/gtk/gtkconn.h trunk/gtk/gtkconv.c trunk/gtk/gtkconv.h trunk/gtk/gtkconvwin.h trunk/gtk/gtkdebug.c trunk/gtk/gtkdebug.h trunk/gtk/gtkdialogs.c trunk/gtk/gtkdialogs.h trunk/gtk/gtkdnd-hints.c trunk/gtk/gtkdnd-hints.h trunk/gtk/gtkeventloop.c trunk/gtk/gtkeventloop.h trunk/gtk/gtkexpander.c trunk/gtk/gtkexpander.h trunk/gtk/gtkft.c trunk/gtk/gtkft.h trunk/gtk/gtkgaim.h trunk/gtk/gtkidle.c trunk/gtk/gtkidle.h trunk/gtk/gtkimhtml.c trunk/gtk/gtkimhtml.h trunk/gtk/gtkimhtmltoolbar.c trunk/gtk/gtkimhtmltoolbar.h trunk/gtk/gtklog.c trunk/gtk/gtklog.h trunk/gtk/gtkmain.c trunk/gtk/gtkmenutray.c trunk/gtk/gtkmenutray.h trunk/gtk/gtknickcolors.h trunk/gtk/gtknotify.c trunk/gtk/gtknotify.h trunk/gtk/gtkplugin.c trunk/gtk/gtkplugin.h trunk/gtk/gtkpluginpref.c trunk/gtk/gtkpluginpref.h trunk/gtk/gtkpounce.c trunk/gtk/gtkpounce.h trunk/gtk/gtkprefs.c trunk/gtk/gtkprefs.h trunk/gtk/gtkprivacy.c trunk/gtk/gtkprivacy.h trunk/gtk/gtkrequest.c trunk/gtk/gtkrequest.h trunk/gtk/gtkroomlist.c trunk/gtk/gtkroomlist.h trunk/gtk/gtksavedstatuses.c trunk/gtk/gtksavedstatuses.h trunk/gtk/gtksession.c trunk/gtk/gtksession.h trunk/gtk/gtksound.c trunk/gtk/gtksound.h trunk/gtk/gtksourceiter.c trunk/gtk/gtksourceiter.h trunk/gtk/gtkstatusbox.c trunk/gtk/gtkstatusbox.h trunk/gtk/gtkstock.h trunk/gtk/gtkthemes.c trunk/gtk/gtkthemes.h trunk/gtk/gtkutils.c trunk/gtk/gtkutils.h trunk/gtk/gtkwhiteboard.c trunk/gtk/gtkwhiteboard.h trunk/gtk/pixmaps/ trunk/gtk/pixmaps/Makefile.am trunk/gtk/pixmaps/Makefile.mingw trunk/gtk/pixmaps/about_menu.png trunk/gtk/pixmaps/accounts.png trunk/gtk/pixmaps/away.png trunk/gtk/pixmaps/change-bgcolor-small.png trunk/gtk/pixmaps/change-fgcolor-small.png trunk/gtk/pixmaps/connect.png trunk/gtk/pixmaps/edit.png trunk/gtk/pixmaps/gaim-install.ico trunk/gtk/pixmaps/gaim.ico trunk/gtk/pixmaps/gaim.png trunk/gtk/pixmaps/gaim.svg trunk/gtk/pixmaps/gaim_16.ico trunk/gtk/pixmaps/gaim_4bit_16.ico trunk/gtk/pixmaps/gaim_auth.png trunk/gtk/pixmaps/gaim_away.ico trunk/gtk/pixmaps/gaim_away_16.ico trunk/gtk/pixmaps/gaim_away_4bit_16.ico trunk/gtk/pixmaps/gaim_blank_4bit_16.ico trunk/gtk/pixmaps/gaim_cool.png trunk/gtk/pixmaps/gaim_error.png trunk/gtk/pixmaps/gaim_info.png trunk/gtk/pixmaps/gaim_msgpend_16.ico trunk/gtk/pixmaps/gaim_msgpend_4bit_16.ico trunk/gtk/pixmaps/gaim_msgunread_16.ico trunk/gtk/pixmaps/gaim_msgunread_4bit_16.ico trunk/gtk/pixmaps/gaim_offline.ico trunk/gtk/pixmaps/gaim_offline_16.ico trunk/gtk/pixmaps/gaim_offline_4bit_16.ico trunk/gtk/pixmaps/gaim_question.png trunk/gtk/pixmaps/gaim_warning.png trunk/gtk/pixmaps/info.png trunk/gtk/pixmaps/insert-image-small.png trunk/gtk/pixmaps/insert-link-small.png trunk/gtk/pixmaps/insert-smiley-small.png trunk/gtk/pixmaps/logo.png trunk/gtk/pixmaps/msgpend.png trunk/gtk/pixmaps/msgunread.png trunk/gtk/pixmaps/offline.png trunk/gtk/pixmaps/online.png trunk/gtk/pixmaps/pause.png trunk/gtk/pixmaps/phone.png trunk/gtk/pixmaps/send-im.png trunk/gtk/pixmaps/smileys/ trunk/gtk/pixmaps/status/ trunk/gtk/pixmaps/status-away.png trunk/gtk/pixmaps/status-connect0.png trunk/gtk/pixmaps/status-connect1.png trunk/gtk/pixmaps/status-connect2.png trunk/gtk/pixmaps/status-connect3.png trunk/gtk/pixmaps/status-invisible.png trunk/gtk/pixmaps/status-offline.png trunk/gtk/pixmaps/status-online.png trunk/gtk/pixmaps/status-typing0.png trunk/gtk/pixmaps/status-typing1.png trunk/gtk/pixmaps/status-typing2.png trunk/gtk/pixmaps/status-typing3.png trunk/gtk/pixmaps/stock_connect_16.png trunk/gtk/pixmaps/stock_disconnect_16.png trunk/gtk/pixmaps/tb_drag_arrow_down.xpm trunk/gtk/pixmaps/tb_drag_arrow_left.xpm trunk/gtk/pixmaps/tb_drag_arrow_right.xpm trunk/gtk/pixmaps/tb_drag_arrow_up.xpm trunk/gtk/pixmaps/text_bigger.png trunk/gtk/pixmaps/text_normal.png trunk/gtk/pixmaps/text_smaller.png trunk/gtk/pixmaps/typed.png trunk/gtk/pixmaps/typing.png trunk/gtk/plugins/ trunk/gtk/plugins/Makefile.am trunk/gtk/plugins/contact_priority.c trunk/gtk/plugins/crazychat/ trunk/gtk/plugins/crazychat/Makefile.am trunk/gtk/plugins/crazychat/QTUtilities.c trunk/gtk/plugins/crazychat/QTUtilities.h trunk/gtk/plugins/crazychat/Utilities.c trunk/gtk/plugins/crazychat/Utilities.h trunk/gtk/plugins/crazychat/camdata.c trunk/gtk/plugins/crazychat/camdata.h trunk/gtk/plugins/crazychat/camproc.c trunk/gtk/plugins/crazychat/camproc.h trunk/gtk/plugins/crazychat/cc_features.c trunk/gtk/plugins/crazychat/cc_gaim_plugin.c trunk/gtk/plugins/crazychat/cc_gtk_gl.c trunk/gtk/plugins/crazychat/cc_gtk_gl.h trunk/gtk/plugins/crazychat/cc_interface.h trunk/gtk/plugins/crazychat/cc_network.c trunk/gtk/plugins/crazychat/cc_network.h trunk/gtk/plugins/crazychat/cc_output.c trunk/gtk/plugins/crazychat/configure.ac trunk/gtk/plugins/crazychat/crazychat.c trunk/gtk/plugins/crazychat/crazychat.h trunk/gtk/plugins/crazychat/dog_lids.c trunk/gtk/plugins/crazychat/dog_lids.h trunk/gtk/plugins/crazychat/doggy.c trunk/gtk/plugins/crazychat/doggy.h trunk/gtk/plugins/crazychat/draw.c trunk/gtk/plugins/crazychat/eye.c trunk/gtk/plugins/crazychat/eye.h trunk/gtk/plugins/crazychat/eyes.c trunk/gtk/plugins/crazychat/eyes.h trunk/gtk/plugins/crazychat/face.c trunk/gtk/plugins/crazychat/face.h trunk/gtk/plugins/crazychat/filter.c trunk/gtk/plugins/crazychat/filter.h trunk/gtk/plugins/crazychat/glm.c trunk/gtk/plugins/crazychat/glm.h trunk/gtk/plugins/crazychat/lids.c trunk/gtk/plugins/crazychat/lids.h trunk/gtk/plugins/crazychat/main.c trunk/gtk/plugins/crazychat/mat_struct.h trunk/gtk/plugins/crazychat/models.c trunk/gtk/plugins/crazychat/models.h trunk/gtk/plugins/crazychat/sharky.c trunk/gtk/plugins/crazychat/sharky.h trunk/gtk/plugins/crazychat/test.h trunk/gtk/plugins/crazychat/util.h trunk/gtk/plugins/docklet/ trunk/gtk/plugins/docklet/Makefile.am trunk/gtk/plugins/docklet/Makefile.mingw trunk/gtk/plugins/docklet/MinimizeToTray.c trunk/gtk/plugins/docklet/MinimizeToTray.h trunk/gtk/plugins/docklet/docklet-win32.c trunk/gtk/plugins/docklet/docklet-x11.c trunk/gtk/plugins/docklet/docklet.c trunk/gtk/plugins/docklet/docklet.h trunk/gtk/plugins/docklet/eggtrayicon.c trunk/gtk/plugins/docklet/eggtrayicon.h trunk/gtk/plugins/extplacement.c trunk/gtk/plugins/gaiminc.c trunk/gtk/plugins/gaimrc.c trunk/gtk/plugins/gestures/ trunk/gtk/plugins/gestures/Makefile.am trunk/gtk/plugins/gestures/gestures.c trunk/gtk/plugins/gestures/gstroke-internal.h trunk/gtk/plugins/gestures/gstroke.h trunk/gtk/plugins/gestures/stroke-draw.c trunk/gtk/plugins/gestures/stroke.c trunk/gtk/plugins/gevolution/ trunk/gtk/plugins/gevolution/Makefile.am trunk/gtk/plugins/gevolution/add_buddy_dialog.c trunk/gtk/plugins/gevolution/assoc-buddy.c trunk/gtk/plugins/gevolution/eds-utils.c trunk/gtk/plugins/gevolution/gevo-util.c trunk/gtk/plugins/gevolution/gevolution.c trunk/gtk/plugins/gevolution/gevolution.h trunk/gtk/plugins/gevolution/new_person_dialog.c trunk/gtk/plugins/gtk-signals-test.c trunk/gtk/plugins/history.c trunk/gtk/plugins/iconaway.c trunk/gtk/plugins/log_reader.c trunk/gtk/plugins/mailchk.c trunk/gtk/plugins/musicmessaging/ trunk/gtk/plugins/musicmessaging/Makefile.am trunk/gtk/plugins/musicmessaging/music.png trunk/gtk/plugins/musicmessaging/musicmessaging.c trunk/gtk/plugins/notify.c trunk/gtk/plugins/raw.c trunk/gtk/plugins/relnot.c trunk/gtk/plugins/spellchk.c trunk/gtk/plugins/ticker/ trunk/gtk/plugins/ticker/Makefile.am trunk/gtk/plugins/ticker/Makefile.mingw trunk/gtk/plugins/ticker/gtkticker.c trunk/gtk/plugins/ticker/gtkticker.h trunk/gtk/plugins/ticker/ticker.c trunk/gtk/plugins/timestamp.c trunk/gtk/plugins/timestamp_format.c trunk/gtk/sounds/ trunk/gtk/sounds/Makefile.am trunk/gtk/sounds/alert.wav trunk/gtk/sounds/login.wav trunk/gtk/sounds/logout.wav trunk/gtk/sounds/receive.wav trunk/gtk/sounds/send.wav Removed Paths: ------------- trunk/gtk/pixmaps/Makefile.am trunk/gtk/pixmaps/Makefile.mingw trunk/gtk/pixmaps/about_menu.png trunk/gtk/pixmaps/accounts.png trunk/gtk/pixmaps/away.png trunk/gtk/pixmaps/change-bgcolor-small.png trunk/gtk/pixmaps/change-fgcolor-small.png trunk/gtk/pixmaps/connect.png trunk/gtk/pixmaps/edit.png trunk/gtk/pixmaps/gaim-install.ico trunk/gtk/pixmaps/gaim.ico trunk/gtk/pixmaps/gaim.png trunk/gtk/pixmaps/gaim.svg trunk/gtk/pixmaps/gaim_16.ico trunk/gtk/pixmaps/gaim_4bit_16.ico trunk/gtk/pixmaps/gaim_auth.png trunk/gtk/pixmaps/gaim_away.ico trunk/gtk/pixmaps/gaim_away_16.ico trunk/gtk/pixmaps/gaim_away_4bit_16.ico trunk/gtk/pixmaps/gaim_blank_4bit_16.ico trunk/gtk/pixmaps/gaim_cool.png trunk/gtk/pixmaps/gaim_error.png trunk/gtk/pixmaps/gaim_info.png trunk/gtk/pixmaps/gaim_msgpend_16.ico trunk/gtk/pixmaps/gaim_msgpend_4bit_16.ico trunk/gtk/pixmaps/gaim_msgunread_16.ico trunk/gtk/pixmaps/gaim_msgunread_4bit_16.ico trunk/gtk/pixmaps/gaim_offline.ico trunk/gtk/pixmaps/gaim_offline_16.ico trunk/gtk/pixmaps/gaim_offline_4bit_16.ico trunk/gtk/pixmaps/gaim_question.png trunk/gtk/pixmaps/gaim_warning.png trunk/gtk/pixmaps/info.png trunk/gtk/pixmaps/insert-image-small.png trunk/gtk/pixmaps/insert-link-small.png trunk/gtk/pixmaps/insert-smiley-small.png trunk/gtk/pixmaps/logo.png trunk/gtk/pixmaps/msgpend.png trunk/gtk/pixmaps/msgunread.png trunk/gtk/pixmaps/offline.png trunk/gtk/pixmaps/online.png trunk/gtk/pixmaps/pause.png trunk/gtk/pixmaps/phone.png trunk/gtk/pixmaps/send-im.png trunk/gtk/pixmaps/smileys/ trunk/gtk/pixmaps/status/ trunk/gtk/pixmaps/status-away.png trunk/gtk/pixmaps/status-connect0.png trunk/gtk/pixmaps/status-connect1.png trunk/gtk/pixmaps/status-connect2.png trunk/gtk/pixmaps/status-connect3.png trunk/gtk/pixmaps/status-invisible.png trunk/gtk/pixmaps/status-offline.png trunk/gtk/pixmaps/status-online.png trunk/gtk/pixmaps/status-typing0.png trunk/gtk/pixmaps/status-typing1.png trunk/gtk/pixmaps/status-typing2.png trunk/gtk/pixmaps/status-typing3.png trunk/gtk/pixmaps/stock_connect_16.png trunk/gtk/pixmaps/stock_disconnect_16.png trunk/gtk/pixmaps/tb_drag_arrow_down.xpm trunk/gtk/pixmaps/tb_drag_arrow_left.xpm trunk/gtk/pixmaps/tb_drag_arrow_right.xpm trunk/gtk/pixmaps/tb_drag_arrow_up.xpm trunk/gtk/pixmaps/text_bigger.png trunk/gtk/pixmaps/text_normal.png trunk/gtk/pixmaps/text_smaller.png trunk/gtk/pixmaps/typed.png trunk/gtk/pixmaps/typing.png trunk/gtk/plugins/crazychat/Makefile.am trunk/gtk/plugins/crazychat/QTUtilities.c trunk/gtk/plugins/crazychat/QTUtilities.h trunk/gtk/plugins/crazychat/Utilities.c trunk/gtk/plugins/crazychat/Utilities.h trunk/gtk/plugins/crazychat/camdata.c trunk/gtk/plugins/crazychat/camdata.h trunk/gtk/plugins/crazychat/camproc.c trunk/gtk/plugins/crazychat/camproc.h trunk/gtk/plugins/crazychat/cc_features.c trunk/gtk/plugins/crazychat/cc_gaim_plugin.c trunk/gtk/plugins/crazychat/cc_gtk_gl.c trunk/gtk/plugins/crazychat/cc_gtk_gl.h trunk/gtk/plugins/crazychat/cc_interface.h trunk/gtk/plugins/crazychat/cc_network.c trunk/gtk/plugins/crazychat/cc_network.h trunk/gtk/plugins/crazychat/cc_output.c trunk/gtk/plugins/crazychat/configure.ac trunk/gtk/plugins/crazychat/crazychat.c trunk/gtk/plugins/crazychat/crazychat.h trunk/gtk/plugins/crazychat/dog_lids.c trunk/gtk/plugins/crazychat/dog_lids.h trunk/gtk/plugins/crazychat/doggy.c trunk/gtk/plugins/crazychat/doggy.h trunk/gtk/plugins/crazychat/draw.c trunk/gtk/plugins/crazychat/eye.c trunk/gtk/plugins/crazychat/eye.h trunk/gtk/plugins/crazychat/eyes.c trunk/gtk/plugins/crazychat/eyes.h trunk/gtk/plugins/crazychat/face.c trunk/gtk/plugins/crazychat/face.h trunk/gtk/plugins/crazychat/filter.c trunk/gtk/plugins/crazychat/filter.h trunk/gtk/plugins/crazychat/glm.c trunk/gtk/plugins/crazychat/glm.h trunk/gtk/plugins/crazychat/lids.c trunk/gtk/plugins/crazychat/lids.h trunk/gtk/plugins/crazychat/main.c trunk/gtk/plugins/crazychat/mat_struct.h trunk/gtk/plugins/crazychat/models.c trunk/gtk/plugins/crazychat/models.h trunk/gtk/plugins/crazychat/sharky.c trunk/gtk/plugins/crazychat/sharky.h trunk/gtk/plugins/crazychat/test.h trunk/gtk/plugins/crazychat/util.h trunk/gtk/plugins/docklet/Makefile.am trunk/gtk/plugins/docklet/Makefile.mingw trunk/gtk/plugins/docklet/MinimizeToTray.c trunk/gtk/plugins/docklet/MinimizeToTray.h trunk/gtk/plugins/docklet/docklet-win32.c trunk/gtk/plugins/docklet/docklet-x11.c trunk/gtk/plugins/docklet/docklet.c trunk/gtk/plugins/docklet/docklet.h trunk/gtk/plugins/docklet/eggtrayicon.c trunk/gtk/plugins/docklet/eggtrayicon.h trunk/gtk/plugins/gestures/Makefile.am trunk/gtk/plugins/gestures/gestures.c trunk/gtk/plugins/gestures/gstroke-internal.h trunk/gtk/plugins/gestures/gstroke.h trunk/gtk/plugins/gestures/stroke-draw.c trunk/gtk/plugins/gestures/stroke.c trunk/gtk/plugins/gevolution/Makefile.am trunk/gtk/plugins/gevolution/add_buddy_dialog.c trunk/gtk/plugins/gevolution/assoc-buddy.c trunk/gtk/plugins/gevolution/eds-utils.c trunk/gtk/plugins/gevolution/gevo-util.c trunk/gtk/plugins/gevolution/gevolution.c trunk/gtk/plugins/gevolution/gevolution.h trunk/gtk/plugins/gevolution/new_person_dialog.c trunk/gtk/plugins/musicmessaging/Makefile.am trunk/gtk/plugins/musicmessaging/music.png trunk/gtk/plugins/musicmessaging/musicmessaging.c trunk/gtk/plugins/ticker/Makefile.am trunk/gtk/plugins/ticker/Makefile.mingw trunk/gtk/plugins/ticker/gtkticker.c trunk/gtk/plugins/ticker/gtkticker.h trunk/gtk/plugins/ticker/ticker.c trunk/gtk/sounds/Makefile.am trunk/gtk/sounds/alert.wav trunk/gtk/sounds/login.wav trunk/gtk/sounds/logout.wav trunk/gtk/sounds/receive.wav trunk/gtk/sounds/send.wav Property Changed: ---------------- trunk/gtk/pixmaps/smileys/Makefile.am trunk/gtk/pixmaps/smileys/Makefile.mingw trunk/gtk/pixmaps/status/Makefile.am trunk/gtk/pixmaps/status/Makefile.mingw Added: trunk/gtk/Makefile.am =================================================================== --- trunk/gtk/Makefile.am (rev 0) +++ trunk/gtk/Makefile.am 2006-08-19 00:52:24 UTC (rev 16855) @@ -0,0 +1,181 @@ +EXTRA_DIST = \ + getopt.c \ + getopt.h \ + getopt1.c \ + Makefile.mingw \ + win_gaim.c \ + win32/IdleTracker/Makefile.mingw \ + win32/IdleTracker/idletrack.c \ + win32/IdleTracker/idletrack.h \ + win32/gaimrc.rc \ + win32/global.mak \ + win32/libc_interface.c \ + win32/libc_interface.h \ + win32/libc_internal.h \ + win32/resource.h \ + win32/untar.c \ + win32/untar.h \ + win32/wgaimerror.h \ + win32/win32dep.c \ + win32/win32dep.h \ + win32/wspell.c \ + win32/wspell.h \ + win32/nsis/gaim-header.bmp \ + win32/nsis/gaim-intro.bmp \ + win32/nsis/gaim-plugin.nsh \ + win32/nsis/langmacros.nsh \ + win32/nsis/translations/albanian.nsh \ + win32/nsis/translations/bulgarian.nsh \ + win32/nsis/translations/catalan.nsh \ + win32/nsis/translations/czech.nsh \ + win32/nsis/translations/danish.nsh \ + win32/nsis/translations/dutch.nsh \ + win32/nsis/translations/english.nsh \ + win32/nsis/translations/finnish.nsh \ + win32/nsis/translations/french.nsh \ + win32/nsis/translations/german.nsh \ + win32/nsis/translations/hebrew.nsh \ + win32/nsis/translations/hungarian.nsh \ + win32/nsis/translations/italian.nsh \ + win32/nsis/translations/japanese.nsh \ + win32/nsis/translations/korean.nsh \ + win32/nsis/translations/kurdish.nsh \ + win32/nsis/translations/lithuanian.nsh \ + win32/nsis/translations/norwegian.nsh \ + win32/nsis/translations/polish.nsh \ + win32/nsis/translations/portuguese.nsh \ + win32/nsis/translations/portuguese-br.nsh \ + win32/nsis/translations/romanian.nsh \ + win32/nsis/translations/russian.nsh \ + win32/nsis/translations/serbian-latin.nsh \ + win32/nsis/translations/simp-chinese.nsh \ + win32/nsis/translations/slovak.nsh \ + win32/nsis/translations/slovenian.nsh \ + win32/nsis/translations/spanish.nsh \ + win32/nsis/translations/swedish.nsh \ + win32/nsis/translations/trad-chinese.nsh \ + win32/nsis/translations/vietnamese.nsh + +SUBDIRS = pixmaps plugins sounds + +bin_PROGRAMS = gaim + +gaim_SOURCES = \ + gtkaccount.c \ + gtkblist.c \ + gtkcelllayout.c \ + gtkcellrendererprogress.c \ + gtkcellview.c \ + gtkcellviewmenuitem.c \ + gaimcombobox.c \ + gtkconn.c \ + gtkconv.c \ + gtkdebug.c \ + gtkdialogs.c \ + gtkdnd-hints.c \ + gtkeventloop.c \ + gtkexpander.c \ + gtkft.c \ + gtkidle.c \ + gtkimhtml.c \ + gtkimhtmltoolbar.c \ + gtklog.c \ + gtkmain.c \ + gtkmenutray.c \ + gtknotify.c \ + gtkplugin.c \ + gtkpluginpref.c \ + gtkprefs.c \ + gtkprivacy.c \ + gtkpounce.c \ + gtkrequest.c \ + gtkroomlist.c \ + gtksavedstatuses.c \ + gtksession.c \ + gtksound.c \ + gtksourceiter.c \ + gtkstatusbox.c \ + gaimstock.c \ + gtkthemes.c \ + gtkutils.c \ + gtkwhiteboard.c + +gaim_headers = \ + gtkaccount.h \ + gtkblist.h \ + gtkcelllayout.h \ + gtkcellrendererprogress.h \ + gtkcellview.h \ + gtkcellviewmenuitem.h \ + gtkcellview.h \ + gtkcellviewmenuitem.h \ + gaimcombobox.h \ + gtkconn.h \ + gtkconv.h \ + gtkconvwin.h \ + gtkdebug.h \ + gtkdialogs.h \ + gtkdnd-hints.h \ + gtkeventloop.h \ + gtkexpander.h \ + gtkft.h \ + gtkgaim.h \ + gtkidle.h \ + gtkimhtml.h \ + gtkimhtmltoolbar.h \ + gtklog.h \ + gtkmenutray.h \ + gtknickcolors.h \ + gtknotify.h \ + gtkplugin.h \ + gtkpluginpref.h \ + gtkprefs.h \ + gtkprivacy.h \ + gtkpounce.h \ + gtkrequest.h \ + gtkroomlist.h \ + gtksavedstatuses.h \ + gtksession.h \ + gtksound.h \ + gtksourceiter.h \ + gtkstatusbox.h \ + gaimstock.h \ + gtkthemes.h \ + gtkutils.h \ + gtkwhiteboard.h + +gaimincludedir=$(includedir)/gaim +gaiminclude_HEADERS = \ + $(gaim_headers) + + +gaim_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) $(MS_LIBS) +gaim_LDFLAGS = -export-dynamic +gaim_LDADD = \ + @LIBOBJS@ \ + $(DBUS_LIBS) \ + $(GSTREAMER_LIBS) \ + $(STATIC_LINK_LIBS) \ + $(XSS_LIBS) \ + $(SM_LIBS) \ + $(INTLLIBS) \ + $(GTKSPELL_LIBS) \ + $(STARTUP_NOTIFICATION_LIBS) \ + $(LIBXML_LIBS) \ + $(GTK_LIBS) \ + -L$(top_srcdir)/core -lgaim + +AM_CPPFLAGS = \ + -DBR_PTHREADS=0 \ + -DDATADIR=\"$(datadir)\" \ + -DLIBDIR=\"$(libdir)/gaim/\" \ + -DLOCALEDIR=\"$(datadir)/locale\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -I$(top_srcdir)/core/ \ + $(GSTREAMER_CFLAGS) \ + $(DEBUG_CFLAGS) \ + $(GTK_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(GTKSPELL_CFLAGS) \ + $(STARTUP_NOTIFICATION_CFLAGS) \ + $(LIBXML_CFLAGS) Property changes on: trunk/gtk/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Copied: trunk/gtk/gaimcombobox.c (from rev 16843, trunk/src/gtkcombobox.c) =================================================================== --- trunk/gtk/gaimcombobox.c (rev 0) +++ trunk/gtk/gaimcombobox.c 2006-08-19 00:52:24 UTC (rev 16855) @@ -0,0 +1,3733 @@ +/* gaimcombobox.c + * Copyright (C) 2002, 2003 Kristian Rietveld <kr...@gt...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* +#include <config.h> +*/ +#include <gtk/gtkversion.h> +#if !GTK_CHECK_VERSION(2,4,0) +#include "gaimcombobox.h" + +#include <gtk/gtkarrow.h> +#include <gtk/gtkbindings.h> +#include "gtkcelllayout.h" +#include <gtk/gtkcellrenderertext.h> +#include "gtkcellview.h" +#include "gtkcellviewmenuitem.h" +#include <gtk/gtkeventbox.h> +#include <gtk/gtkframe.h> +#include <gtk/gtkhbox.h> +#include <gtk/gtkliststore.h> +#include <gtk/gtkmain.h> +#include <gtk/gtkmenu.h> +#include <gtk/gtktogglebutton.h> +#include <gtk/gtktreeselection.h> +/* +#include <gtk/gtktreeprivate.h> +*/ +#include <gtk/gtkvseparator.h> +#include <gtk/gtkwindow.h> +#include <gtk/gtkversion.h> + +#include <gdk/gdkkeysyms.h> + +#include <gobject/gvaluecollector.h> + +#include <string.h> +#include <stdarg.h> + +#define P_(x) (x) + +/* WELCOME, to THE house of evil code */ + +typedef struct _ComboCellInfo ComboCellInfo; +struct _ComboCellInfo +{ + GtkCellRenderer *cell; + GSList *attributes; + + GtkCellLayoutDataFunc func; + gpointer func_data; + GDestroyNotify destroy; + + guint expand : 1; + guint pack : 1; +}; + +struct _GtkComboBoxPrivate +{ + GtkTreeModel *model; + + gint col_column; + gint row_column; + + gint wrap_width; + + gint active_item; + + GtkWidget *tree_view; + GtkTreeViewColumn *column; + + GtkWidget *cell_view; + GtkWidget *cell_view_frame; + + GtkWidget *button; + GtkWidget *box; + GtkWidget *arrow; + GtkWidget *separator; + + GtkWidget *popup_widget; + GtkWidget *popup_window; + GtkWidget *popup_frame; + + guint inserted_id; + guint deleted_id; + guint reordered_id; + guint changed_id; + + gint width; + GSList *cells; + + guint popup_in_progress : 1; + guint destroying : 1; +}; + +/* While debugging this evil code, I have learned that + * there are actually 4 modes to this widget, which can + * be characterized as follows + * + * 1) menu mode, no child added + * + * tree_view -> NULL + * cell_view -> GtkCellView, regular child + * cell_view_frame -> NULL + * button -> GtkToggleButton set_parent to combo + * box -> child of button + * arrow -> child of box + * separator -> child of box + * popup_widget -> GtkMenu + * popup_window -> NULL + * popup_frame -> NULL + * + * 2) menu mode, child added + * + * tree_view -> NULL + * cell_view -> NULL + * cell_view_frame -> NULL + * button -> GtkToggleButton set_parent to combo + * box -> NULL + * arrow -> GtkArrow, child of button + * separator -> NULL + * popup_widget -> GtkMenu + * popup_window -> NULL + * popup_frame -> NULL + * + * 3) list mode, no child added + * + * tree_view -> GtkTreeView, child of popup_frame + * cell_view -> GtkCellView, regular child + * cell_view_frame -> GtkFrame, set parent to combo + * button -> GtkToggleButton, set_parent to combo + * box -> NULL + * arrow -> GtkArrow, child of button + * separator -> NULL + * popup_widget -> tree_view + * popup_window -> GtkWindow + * popup_frame -> GtkFrame, child of popup_window + * + * 4) list mode, child added + * + * tree_view -> GtkTreeView, child of popup_frame + * cell_view -> NULL + * cell_view_frame -> NULL + * button -> GtkToggleButton, set_parent to combo + * box -> NULL + * arrow -> GtkArrow, child of button + * separator -> NULL + * popup_widget -> tree_view + * popup_window -> GtkWindow + * popup_frame -> GtkFrame, child of popup_window + * + */ + +enum { + CHANGED, + LAST_SIGNAL +}; + +enum { + PROP_0, + PROP_MODEL, + PROP_WRAP_WIDTH, + PROP_ROW_SPAN_COLUMN, + PROP_COLUMN_SPAN_COLUMN, + PROP_ACTIVE +}; + +static GtkBinClass *parent_class = NULL; +static guint combo_box_signals[LAST_SIGNAL] = {0,}; + +#define BONUS_PADDING 4 + + +/* common */ +static void gtk_combo_box_class_init (GtkComboBoxClass *klass); +static void gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface); +static void gtk_combo_box_init (GtkComboBox *combo_box); +static void gtk_combo_box_finalize (GObject *object); +static void gtk_combo_box_destroy (GtkObject *object); + +static void gtk_combo_box_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *spec); +static void gtk_combo_box_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *spec); + +static void gtk_combo_box_state_changed (GtkWidget *widget, + GtkStateType previous); +static void gtk_combo_box_style_set (GtkWidget *widget, + GtkStyle *previous); +static void gtk_combo_box_button_toggled (GtkWidget *widget, + gpointer data); +static void gtk_combo_box_add (GtkContainer *container, + GtkWidget *widget); +static void gtk_combo_box_remove (GtkContainer *container, + GtkWidget *widget); + +static ComboCellInfo *gtk_combo_box_get_cell_info (GtkComboBox *combo_box, + GtkCellRenderer *cell); + +static void gtk_combo_box_menu_show (GtkWidget *menu, + gpointer user_data); +static void gtk_combo_box_menu_hide (GtkWidget *menu, + gpointer user_data); + +static void gtk_combo_box_set_popup_widget (GtkComboBox *combo_box, + GtkWidget *popup); +#if GTK_CHECK_VERSION(2,2,0) +static void gtk_combo_box_menu_position_below (GtkMenu *menu, + gint *x, + gint *y, + gint *push_in, + gpointer user_data); +static void gtk_combo_box_menu_position_over (GtkMenu *menu, + gint *x, + gint *y, + gint *push_in, + gpointer user_data); +static void gtk_combo_box_menu_position (GtkMenu *menu, + gint *x, + gint *y, + gint *push_in, + gpointer user_data); +#endif + +static gint gtk_combo_box_calc_requested_width (GtkComboBox *combo_box, + GtkTreePath *path); +static void gtk_combo_box_remeasure (GtkComboBox *combo_box); + +static void gtk_combo_box_unset_model (GtkComboBox *combo_box); + +static void gtk_combo_box_size_request (GtkWidget *widget, + GtkRequisition *requisition); +static void gtk_combo_box_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static void gtk_combo_box_forall (GtkContainer *container, + gboolean include_internals, + GtkCallback callback, + gpointer callback_data); +static gboolean gtk_combo_box_expose_event (GtkWidget *widget, + GdkEventExpose *event); +static gboolean gtk_combo_box_scroll_event (GtkWidget *widget, + GdkEventScroll *event); +static void gtk_combo_box_set_active_internal (GtkComboBox *combo_box, + gint index); +static gboolean gtk_combo_box_key_press (GtkWidget *widget, + GdkEventKey *event, + gpointer data); + +/* listening to the model */ +static void gtk_combo_box_model_row_inserted (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data); +static void gtk_combo_box_model_row_deleted (GtkTreeModel *model, + GtkTreePath *path, + gpointer user_data); +static void gtk_combo_box_model_rows_reordered (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order, + gpointer user_data); +static void gtk_combo_box_model_row_changed (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data); + +/* list */ +static void gtk_combo_box_list_position (GtkComboBox *combo_box, + gint *x, + gint *y, + gint *width, + gint *height); + +static void gtk_combo_box_list_setup (GtkComboBox *combo_box); +static void gtk_combo_box_list_destroy (GtkComboBox *combo_box); + +static void gtk_combo_box_list_remove_grabs (GtkComboBox *combo_box); + +static gboolean gtk_combo_box_list_button_released (GtkWidget *widget, + GdkEventButton *event, + gpointer data); +static gboolean gtk_combo_box_list_key_press (GtkWidget *widget, + GdkEventKey *event, + gpointer data); +static gboolean gtk_combo_box_list_button_pressed (GtkWidget *widget, + GdkEventButton *event, + gpointer data); + +static void gtk_combo_box_list_row_changed (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data); + +/* menu */ +static void gtk_combo_box_menu_setup (GtkComboBox *combo_box, + gboolean add_children); +static void gtk_combo_box_menu_fill (GtkComboBox *combo_box); +static void gtk_combo_box_menu_destroy (GtkComboBox *combo_box); + +static void gtk_combo_box_item_get_size (GtkComboBox *combo_box, + gint index, + gint *cols, + gint *rows); +static void gtk_combo_box_relayout_item (GtkComboBox *combo_box, + gint index); +static void gtk_combo_box_relayout (GtkComboBox *combo_box); + +static gboolean gtk_combo_box_menu_button_press (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); +static void gtk_combo_box_menu_item_activate (GtkWidget *item, + gpointer user_data); +static void gtk_combo_box_menu_row_inserted (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data); +static void gtk_combo_box_menu_row_deleted (GtkTreeModel *model, + GtkTreePath *path, + gpointer user_data); +static void gtk_combo_box_menu_rows_reordered (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order, + gpointer user_data); +static void gtk_combo_box_menu_row_changed (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data); +static gboolean gtk_combo_box_menu_key_press (GtkWidget *widget, + GdkEventKey *event, + gpointer data); + +/* cell layout */ +static void gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout, + GtkCellRenderer *cell, + gboolean expand); +static void gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout, + GtkCellRenderer *cell, + gboolean expand); +static void gtk_combo_box_cell_layout_clear (GtkCellLayout *layout); +static void gtk_combo_box_cell_layout_add_attribute (GtkCellLayout *layout, + GtkCellRenderer *cell, + const gchar *attribute, + gint column); +static void gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout *layout, + GtkCellRenderer *cell, + GtkCellLayoutDataFunc func, + gpointer func_data, + GDestroyNotify destroy); +static void gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout, + GtkCellRenderer *cell); +static void gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout, + GtkCellRenderer *cell, + gint position); +static gboolean gtk_combo_box_mnemonic_activate (GtkWidget *widget, + gboolean group_cycling); + +static void cell_view_sync_cells (GtkComboBox *combo_box, + GtkCellView *cell_view); + +#if !GTK_CHECK_VERSION(2,4,0) +static void gtk_menu_attach (GtkMenu *menu, + GtkWidget *child, + guint left_attach, + guint right_attach, + guint top_attach, + guint bottom_attach); +#endif + +GType +gtk_combo_box_get_type (void) +{ + static GType combo_box_type = 0; + + if (!combo_box_type) + { + static const GTypeInfo combo_box_info = + { + sizeof (GtkComboBoxClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_combo_box_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkComboBox), + 0, + (GInstanceInitFunc) gtk_combo_box_init + }; + + static const GInterfaceInfo cell_layout_info = + { + (GInterfaceInitFunc) gtk_combo_box_cell_layout_init, + NULL, + NULL + }; + + combo_box_type = g_type_register_static (GTK_TYPE_BIN, + "GaimGtkComboBox", + &combo_box_info, + 0); + + g_type_add_interface_static (combo_box_type, + GTK_TYPE_CELL_LAYOUT, + &cell_layout_info); + } + + return combo_box_type; +} + +/* common */ +static void +gtk_combo_box_class_init (GtkComboBoxClass *klass) +{ + GObjectClass *object_class; + GtkBindingSet *binding_set; + GtkObjectClass *gtk_object_class; + GtkContainerClass *container_class; + GtkWidgetClass *widget_class; + + binding_set = gtk_binding_set_by_class (klass); + + container_class = (GtkContainerClass *)klass; + container_class->forall = gtk_combo_box_forall; + container_class->add = gtk_combo_box_add; + container_class->remove = gtk_combo_box_remove; + + widget_class = (GtkWidgetClass *)klass; + widget_class->size_allocate = gtk_combo_box_size_allocate; + widget_class->size_request = gtk_combo_box_size_request; + widget_class->expose_event = gtk_combo_box_expose_event; + widget_class->scroll_event = gtk_combo_box_scroll_event; + widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate; + widget_class->style_set = gtk_combo_box_style_set; + widget_class->state_changed = gtk_combo_box_state_changed; + + gtk_object_class = (GtkObjectClass *)klass; + gtk_object_class->destroy = gtk_combo_box_destroy; + + object_class = (GObjectClass *)klass; + object_class->finalize = gtk_combo_box_finalize; + object_class->set_property = gtk_combo_box_set_property; + object_class->get_property = gtk_combo_box_get_property; + + parent_class = g_type_class_peek_parent (klass); + + /* signals */ + combo_box_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkComboBoxClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /* properties */ + g_object_class_install_property (object_class, + PROP_MODEL, + g_param_spec_object ("model", + P_("ComboBox model"), + P_("The model for the combo box"), + GTK_TYPE_TREE_MODEL, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_WRAP_WIDTH, + g_param_spec_int ("wrap_width", + P_("Wrap width"), + P_("Wrap width for layouting the items in a grid"), + 0, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_ROW_SPAN_COLUMN, + g_param_spec_int ("row_span_column", + P_("Row span column"), + P_("TreeModel column containing the row span values"), + 0, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_COLUMN_SPAN_COLUMN, + g_param_spec_int ("column_span_column", + P_("Column span column"), + + P_("TreeModel column containing the column span values"), + 0, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_ACTIVE, + g_param_spec_int ("active", + P_("Active item"), + P_("The item which is currently active"), + -1, + G_MAXINT, + -1, + G_PARAM_READWRITE)); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_boolean ("appears-as-list", + P_("Appears as list"), + P_("Whether combobox dropdowns should look like lists rather than menus"), + FALSE, + G_PARAM_READABLE)); +} + +static void +gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface) +{ + iface->pack_start = gtk_combo_box_cell_layout_pack_start; + iface->pack_end = gtk_combo_box_cell_layout_pack_end; + iface->clear = gtk_combo_box_cell_layout_clear; + iface->add_attribute = gtk_combo_box_cell_layout_add_attribute; + iface->set_cell_data_func = gtk_combo_box_cell_layout_set_cell_data_func; + iface->clear_attributes = gtk_combo_box_cell_layout_clear_attributes; + iface->reorder = gtk_combo_box_cell_layout_reorder; +} + +static void +gtk_combo_box_init (GtkComboBox *combo_box) +{ + combo_box->priv = g_new0(GtkComboBoxPrivate,1); + + combo_box->priv->cell_view = gtk_cell_view_new (); + gtk_widget_set_parent (combo_box->priv->cell_view, GTK_WIDGET (combo_box)); + GTK_BIN (combo_box)->child = combo_box->priv->cell_view; + gtk_widget_show (combo_box->priv->cell_view); + + combo_box->priv->width = 0; + combo_box->priv->wrap_width = 0; + + combo_box->priv->active_item = -1; + combo_box->priv->col_column = -1; + combo_box->priv->row_column = -1; +} + +static void +gtk_combo_box_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (object); + + switch (prop_id) + { + case PROP_MODEL: + gtk_combo_box_set_model (combo_box, g_value_get_object (value)); + break; + + case PROP_WRAP_WIDTH: + gtk_combo_box_set_wrap_width (combo_box, g_value_get_int (value)); + break; + + case PROP_ROW_SPAN_COLUMN: + gtk_combo_box_set_row_span_column (combo_box, g_value_get_int (value)); + break; + + case PROP_COLUMN_SPAN_COLUMN: + gtk_combo_box_set_column_span_column (combo_box, g_value_get_int (value)); + break; + + case PROP_ACTIVE: + gtk_combo_box_set_active (combo_box, g_value_get_int (value)); + break; + + default: + break; + } +} + +static void +gtk_combo_box_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (object); + + switch (prop_id) + { + case PROP_MODEL: + g_value_set_object (value, combo_box->priv->model); + break; + + case PROP_WRAP_WIDTH: + g_value_set_int (value, combo_box->priv->wrap_width); + break; + + case PROP_ROW_SPAN_COLUMN: + g_value_set_int (value, combo_box->priv->row_column); + break; + + case PROP_COLUMN_SPAN_COLUMN: + g_value_set_int (value, combo_box->priv->col_column); + break; + + case PROP_ACTIVE: + g_value_set_int (value, gtk_combo_box_get_active (combo_box)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gtk_combo_box_state_changed (GtkWidget *widget, + GtkStateType previous) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (widget); + + if (GTK_WIDGET_REALIZED (widget)) + { + if (combo_box->priv->tree_view && combo_box->priv->cell_view) + gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), + &widget->style->base[GTK_WIDGET_STATE (widget)]); + } + + gtk_widget_queue_draw (widget); +} + +static void +gtk_combo_box_check_appearance (GtkComboBox *combo_box) +{ + gboolean appears_as_list; + + /* if wrap_width > 0, then we are in grid-mode and forced to use + * unix style + */ + if (combo_box->priv->wrap_width) + appears_as_list = FALSE; + else + gtk_widget_style_get (GTK_WIDGET (combo_box), + "appears-as-list", &appears_as_list, + NULL); + + if (appears_as_list) + { + /* Destroy all the menu mode widgets, if they exist. */ + if (GTK_IS_MENU (combo_box->priv->popup_widget)) + gtk_combo_box_menu_destroy (combo_box); + + /* Create the list mode widgets, if they don't already exist. */ + if (!GTK_IS_TREE_VIEW (combo_box->priv->tree_view)) + gtk_combo_box_list_setup (combo_box); + } + else + { + /* Destroy all the list mode widgets, if they exist. */ + if (GTK_IS_TREE_VIEW (combo_box->priv->tree_view)) + gtk_combo_box_list_destroy (combo_box); + + /* Create the menu mode widgets, if they don't already exist. */ + if (!GTK_IS_MENU (combo_box->priv->popup_widget)) + gtk_combo_box_menu_setup (combo_box, TRUE); + } +} + +static void +gtk_combo_box_style_set (GtkWidget *widget, + GtkStyle *previous) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (widget); + + gtk_combo_box_check_appearance (combo_box); + + if (combo_box->priv->tree_view && combo_box->priv->cell_view) + gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), + &widget->style->base[GTK_WIDGET_STATE (widget)]); +} + +static void +gtk_combo_box_button_toggled (GtkWidget *widget, + gpointer data) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (data); + + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) + { + if (!combo_box->priv->popup_in_progress) + gtk_combo_box_popup (combo_box); + } + else + gtk_combo_box_popdown (combo_box); +} + +static void +gtk_combo_box_add (GtkContainer *container, + GtkWidget *widget) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (container); + + if (combo_box->priv->cell_view && combo_box->priv->cell_view->parent) + { + gtk_widget_unparent (combo_box->priv->cell_view); + GTK_BIN (container)->child = NULL; + gtk_widget_queue_resize (GTK_WIDGET (container)); + } + + gtk_widget_set_parent (widget, GTK_WIDGET (container)); + GTK_BIN (container)->child = widget; + + if (combo_box->priv->cell_view && + widget != combo_box->priv->cell_view) + { + /* since the cell_view was unparented, it's gone now */ + combo_box->priv->cell_view = NULL; + + if (!combo_box->priv->tree_view && combo_box->priv->separator) + { + gtk_container_remove (GTK_CONTAINER (combo_box->priv->separator->parent), + combo_box->priv->separator); + combo_box->priv->separator = NULL; + + gtk_widget_queue_resize (GTK_WIDGET (container)); + } + else if (combo_box->priv->cell_view_frame) + { + gtk_widget_unparent (combo_box->priv->cell_view_frame); + combo_box->priv->cell_view_frame = NULL; + } + } +} + +static void +gtk_combo_box_remove (GtkContainer *container, + GtkWidget *widget) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (container); + gboolean appears_as_list; + + gtk_widget_unparent (widget); + GTK_BIN (container)->child = NULL; + + if (combo_box->priv->destroying) + return; + + gtk_widget_queue_resize (GTK_WIDGET (container)); + + if (!combo_box->priv->tree_view) + appears_as_list = FALSE; + else + appears_as_list = TRUE; + + if (appears_as_list) + gtk_combo_box_list_destroy (combo_box); + else if (GTK_IS_MENU (combo_box->priv->popup_widget)) + { + gtk_combo_box_menu_destroy (combo_box); + gtk_menu_detach (GTK_MENU (combo_box->priv->popup_widget)); + combo_box->priv->popup_widget = NULL; + } + + if (!combo_box->priv->cell_view) + { + combo_box->priv->cell_view = gtk_cell_view_new (); + gtk_widget_set_parent (combo_box->priv->cell_view, GTK_WIDGET (container)); + GTK_BIN (container)->child = combo_box->priv->cell_view; + + gtk_widget_show (combo_box->priv->cell_view); + gtk_cell_view_set_model (GTK_CELL_VIEW (combo_box->priv->cell_view), + combo_box->priv->model); + cell_view_sync_cells (combo_box, GTK_CELL_VIEW (combo_box->priv->cell_view)); + } + + + if (appears_as_list) + gtk_combo_box_list_setup (combo_box); + else + gtk_combo_box_menu_setup (combo_box, TRUE); + + gtk_combo_box_set_active_internal (combo_box, combo_box->priv->active_item); +} + +static ComboCellInfo * +gtk_combo_box_get_cell_info (GtkComboBox *combo_box, + GtkCellRenderer *cell) +{ + GSList *i; + + for (i = combo_box->priv->cells; i; i = i->next) + { + ComboCellInfo *info = (ComboCellInfo *)i->data; + + if (info && info->cell == cell) + return info; + } + + return NULL; +} + +static void +gtk_combo_box_menu_show (GtkWidget *menu, + gpointer user_data) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button), + TRUE); + combo_box->priv->popup_in_progress = FALSE; +} + +static void +gtk_combo_box_menu_hide (GtkWidget *menu, + gpointer user_data) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button), + FALSE); +} + +static void +gtk_combo_box_detacher (GtkWidget *widget, + GtkMenu *menu) +{ + GtkComboBox *combo_box; + + g_return_if_fail (GTK_IS_COMBO_BOX (widget)); + + combo_box = GTK_COMBO_BOX (widget); + g_return_if_fail (combo_box->priv->popup_widget == (GtkWidget*) menu); + + g_signal_handlers_disconnect_by_func (menu, + gtk_combo_box_menu_show, + combo_box); + g_signal_handlers_disconnect_by_func (menu, + gtk_combo_box_menu_hide, + combo_box); + + combo_box->priv->popup_widget = NULL; +} + +static void +gtk_combo_box_set_popup_widget (GtkComboBox *combo_box, + GtkWidget *popup) +{ + if (GTK_IS_MENU (combo_box->priv->popup_widget)) + { + gtk_menu_detach (GTK_MENU (combo_box->priv->popup_widget)); + combo_box->priv->popup_widget = NULL; + } + else if (combo_box->priv->popup_widget) + { + gtk_container_remove (GTK_CONTAINER (combo_box->priv->popup_frame), + combo_box->priv->popup_widget); + g_object_unref (G_OBJECT (combo_box->priv->popup_widget)); + combo_box->priv->popup_widget = NULL; + } + + if (GTK_IS_MENU (popup)) + { + if (combo_box->priv->popup_window) + { + gtk_widget_destroy (combo_box->priv->popup_window); + combo_box->priv->popup_window = NULL; + combo_box->priv->popup_frame = NULL; + } + + combo_box->priv->popup_widget = popup; + + g_signal_connect (popup, "show", + G_CALLBACK (gtk_combo_box_menu_show), combo_box); + g_signal_connect (popup, "hide", + G_CALLBACK (gtk_combo_box_menu_hide), combo_box); + + gtk_menu_attach_to_widget (GTK_MENU (popup), + GTK_WIDGET (combo_box), + gtk_combo_box_detacher); + } + else + { + if (!combo_box->priv->popup_window) + { + combo_box->priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP); + gtk_window_set_resizable (GTK_WINDOW (combo_box->priv->popup_window), FALSE); +#if GTK_CHECK_VERSION(2,2,0) + gtk_window_set_screen (GTK_WINDOW (combo_box->priv->popup_window), + gtk_widget_get_screen (GTK_WIDGET (combo_box))); +#endif + + combo_box->priv->popup_frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->popup_frame), + GTK_SHADOW_ETCHED_IN); + gtk_container_add (GTK_CONTAINER (combo_box->priv->popup_window), + combo_box->priv->popup_frame); + + gtk_widget_show (combo_box->priv->popup_frame); + } + + gtk_container_add (GTK_CONTAINER (combo_box->priv->popup_frame), + popup); + gtk_widget_show (popup); + g_object_ref (G_OBJECT (popup)); + combo_box->priv->popup_widget = popup; + } +} + +#if GTK_CHECK_VERSION(2,2,0) +static void +gtk_combo_box_menu_position_below (GtkMenu *menu, + gint *x, + gint *y, + gint *push_in, + gpointer user_data) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); + gint sx, sy; + GtkWidget *child; + GtkRequisition req; + GdkScreen *screen; + gint monitor_num; + GdkRectangle monitor; + + /* FIXME: is using the size request here broken? */ + child = GTK_BIN (combo_box)->child; + + gdk_window_get_origin (child->window, &sx, &sy); + + if (GTK_WIDGET_NO_WINDOW (child)) + { + sx += child->allocation.x; + sy += child->allocation.y; + } + + gtk_widget_size_request (GTK_WIDGET (menu), &req); + + if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_LTR) + *x = sx; + else + *x = sx + child->allocation.width - req.width; + *y = sy; + + screen = gtk_widget_get_screen (GTK_WIDGET (combo_box)); + monitor_num = gdk_screen_get_monitor_at_window (screen, + GTK_WIDGET (combo_box)->window); + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + + if (*x < monitor.x) + *x = monitor.x; + else if (*x + req.width > monitor.x + monitor.width) + *x = monitor.x + monitor.width - req.width; + + if (monitor.y + monitor.height - *y - child->allocation.height >= req.height) + *y += child->allocation.height; + else if (*y - monitor.y >= req.height) + *y -= req.height; + else if (monitor.y + monitor.height - *y - child->allocation.height > *y - monitor.y) + *y += child->allocation.height; + else + *y -= req.height; + + *push_in = FALSE; +} + +static void +gtk_combo_box_menu_position_over (GtkMenu *menu, + gint *x, + gint *y, + gboolean *push_in, + gpointer user_data) +{ + GtkComboBox *combo_box; + GtkWidget *active; + GtkWidget *child; + GtkWidget *widget; + GtkRequisition requisition; + GList *children; + gint screen_width; + gint menu_xpos; + gint menu_ypos; + gint menu_width; + + g_return_if_fail (GTK_IS_COMBO_BOX (user_data)); + + combo_box = GTK_COMBO_BOX (user_data); + widget = GTK_WIDGET (combo_box); + + gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition); + menu_width = requisition.width; + + active = gtk_menu_get_active (GTK_MENU (combo_box->priv->popup_widget)); + gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos); + + menu_xpos += widget->allocation.x; + menu_ypos += widget->allocation.y + widget->allocation.height / 2 - 2; + + if (active != NULL) + { + gtk_widget_get_child_requisition (active, &requisition); + menu_ypos -= requisition.height / 2; + } + + children = GTK_MENU_SHELL (combo_... [truncated message content] |