├── examples ├── .gitignore ├── accountdialog.vala └── meson.build ├── subprojects ├── .gitignore ├── libtl.wrap └── liblistbox.wrap ├── src ├── rest │ ├── rest │ │ ├── rest-marshal.txt │ │ ├── sha1.h │ │ ├── rest-proxy-call-private.h │ │ ├── test-runner.c │ │ ├── rest-main.c │ │ ├── oauth-proxy-private.h │ │ ├── sha1.c │ │ ├── rest-params.h │ │ ├── oauth-proxy-call.h │ │ └── rest-private.h │ ├── AUTHORS │ ├── .gitignore │ └── README ├── ModelListBox.vala ├── widgets │ ├── LazyMenuButton.vala │ ├── DoubleTapButton.vala │ ├── ReplyEntry.vala │ ├── ImpostorWidget.vala │ ├── DMPlaceholderBox.vala │ ├── FollowButton.vala │ └── PixbufButton.vala ├── CbTextButton.h ├── IPage.vala ├── util │ ├── Benchmark.vala │ ├── Dirs.vala │ └── UserCompletion.vala ├── list │ ├── AddListEntry.vala │ ├── NewListEntry.vala │ ├── DMThreadEntry.vala │ ├── UserFilterEntry.vala │ ├── SnippetListEntry.vala │ └── FilterListEntry.vala ├── CbAspectImage.h ├── CbMessageReceiver.c ├── CbMaxSizeContainer.h ├── CbReplyIndicator.h ├── CbTextButton.c ├── CbFilter.h ├── CbMessageReceiver.h ├── async │ └── Barrier.vala ├── CbSurfaceProgress.h ├── CbTextTransform.h ├── CbQuoteTweetWidget.h ├── CbMediaVideoWidget.h ├── CbMediaImageWidget.h ├── main.c ├── CbDeltaUpdater.h ├── CbEmojiChooser.h ├── CbAnimation.h ├── CbTwitterItem.h ├── CbMedia.h ├── CbUserCompletionModel.h ├── CbBundleHistory.h ├── CbTextView.h ├── CbBundle.h ├── CbComposeImages.h ├── NotificationManager.vala ├── CbTweetRow.h ├── CbMediaDownloader.h ├── CbScrollWidget.h ├── CbUserStream.h ├── CbTweetListBox.h ├── CbUserCounter.h ├── CbMainWindow.h ├── CbTwitterItem.c ├── CbSnippetManager.h ├── FavoritesTimeline.vala ├── CbFilter.c ├── CbAvatarCache.h ├── sql │ └── UpdateStatement.vala └── Settings.vala ├── flatpak ├── .gitignore ├── meson-no-lib64.patch └── vala-no-valadoc.patch ├── data ├── play.png ├── play@2.png ├── no_avatar.png ├── no_banner.png ├── verified-large.png ├── verified-small.png ├── verified-large@2.png ├── verified-small@2.png ├── hicolor │ ├── 128x128 │ │ └── apps │ │ │ └── corebird.png │ ├── 16x16 │ │ └── apps │ │ │ └── corebird.png │ ├── 24x24 │ │ └── apps │ │ │ └── corebird.png │ ├── 256x256 │ │ └── apps │ │ │ └── corebird.png │ ├── 32x32 │ │ └── apps │ │ │ └── corebird.png │ ├── 48x48 │ │ └── apps │ │ │ └── corebird.png │ ├── 64x64 │ │ └── apps │ │ │ └── corebird.png │ └── 96x96 │ │ └── apps │ │ └── corebird.png ├── org.baedert.corebird.service.in ├── 16x16 │ └── apps │ │ ├── corebird-dms-symbolic.symbolic.png │ │ ├── corebird-filter-symbolic.symbolic.png │ │ ├── corebird-compose-symbolic.symbolic.png │ │ ├── corebird-favorite-symbolic.symbolic.png │ │ ├── corebird-mentions-symbolic.symbolic.png │ │ ├── corebird-profile-symbolic.symbolic.png │ │ ├── corebird-retweet-symbolic.symbolic.png │ │ ├── corebird-edit-find-symbolic.symbolic.png │ │ ├── corebird-new-window-symbolic.symbolic.png │ │ ├── corebird-user-home-symbolic.symbolic.png │ │ └── corebird-conversation-symbolic.symbolic.png ├── 32x32 │ └── apps │ │ ├── corebird-dms-symbolic.symbolic.png │ │ ├── corebird-filter-symbolic.symbolic.png │ │ ├── corebird-compose-symbolic.symbolic.png │ │ ├── corebird-favorite-symbolic.symbolic.png │ │ ├── corebird-mentions-symbolic.symbolic.png │ │ ├── corebird-profile-symbolic.symbolic.png │ │ ├── corebird-retweet-symbolic.symbolic.png │ │ ├── corebird-edit-find-symbolic.symbolic.png │ │ ├── corebird-new-window-symbolic.symbolic.png │ │ ├── corebird-user-home-symbolic.symbolic.png │ │ └── corebird-conversation-symbolic.symbolic.png ├── .gitignore ├── meson_post_install.py ├── render-icons.sh ├── org.baedert.corebird.desktop.in ├── meson.build ├── corebird.1 ├── symbolic │ └── apps │ │ ├── corebird-profile-symbolic.svg │ │ ├── corebird-filter-symbolic.svg │ │ ├── corebird-conversation-symbolic.svg │ │ └── corebird-compose-symbolic.svg ├── play.svg └── verified.svg ├── po ├── meson.build ├── .gitignore ├── LINGUAS ├── POTFILES.skip └── POTFILES.in ├── ._vimrc ├── sql ├── accounts │ ├── Create.3.sql │ ├── Create.2.sql │ └── Create.1.sql └── init │ ├── Create.1.sql │ └── Create.2.sql ├── .gitignore ├── meson_options.txt ├── .tx └── config ├── vapi ├── config.vapi ├── libtl.vapi └── gd-model-list-box.vapi ├── tests ├── meson.build ├── utils.vala ├── twitteritem.vala ├── avatarcache.vala ├── friends.vala └── avatardownload.vala ├── ui ├── menus.ui ├── media-dialog.ui ├── search-page.ui ├── new-list-entry.ui └── filter-page.ui └── config.h.meson /examples/.gitignore: -------------------------------------------------------------------------------- 1 | tweetstates 2 | accountdialog 3 | -------------------------------------------------------------------------------- /subprojects/.gitignore: -------------------------------------------------------------------------------- 1 | liblistbox/ 2 | libtl/ 3 | -------------------------------------------------------------------------------- /src/rest/rest/rest-marshal.txt: -------------------------------------------------------------------------------- 1 | BOOLEAN:OBJECT,BOOLEAN 2 | -------------------------------------------------------------------------------- /flatpak/.gitignore: -------------------------------------------------------------------------------- 1 | flatpak-builddir 2 | .flatpak-builder 3 | repo 4 | -------------------------------------------------------------------------------- /data/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/play.png -------------------------------------------------------------------------------- /data/play@2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/play@2.png -------------------------------------------------------------------------------- /data/no_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/no_avatar.png -------------------------------------------------------------------------------- /data/no_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/no_banner.png -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n = import('i18n') 2 | 3 | i18n.gettext('corebird', preset: 'glib') 4 | -------------------------------------------------------------------------------- /data/verified-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/verified-large.png -------------------------------------------------------------------------------- /data/verified-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/verified-small.png -------------------------------------------------------------------------------- /src/rest/AUTHORS: -------------------------------------------------------------------------------- 1 | Rob Bradford 2 | Ross Burton 3 | -------------------------------------------------------------------------------- /data/verified-large@2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/verified-large@2.png -------------------------------------------------------------------------------- /data/verified-small@2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/verified-small@2.png -------------------------------------------------------------------------------- /po/.gitignore: -------------------------------------------------------------------------------- 1 | _*.pot 2 | *.gmo 3 | stamp-it 4 | Makefile.in.in 5 | .intltool-merge-cache 6 | POTFILES 7 | -------------------------------------------------------------------------------- /._vimrc: -------------------------------------------------------------------------------- 1 | set wildignore+=*.c,*\~,CMakeFiles,Makefile,*.lo,test-driver,*.trs,*.stamp,Makefile.in,*.la,*.svg 2 | -------------------------------------------------------------------------------- /sql/accounts/Create.3.sql: -------------------------------------------------------------------------------- 1 | PRAGMA user_version = 3; 2 | 3 | ALTER TABLE `info` 4 | ADD last_tweet VARCHAR(255) 5 | -------------------------------------------------------------------------------- /data/hicolor/128x128/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/128x128/apps/corebird.png -------------------------------------------------------------------------------- /data/hicolor/16x16/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/16x16/apps/corebird.png -------------------------------------------------------------------------------- /data/hicolor/24x24/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/24x24/apps/corebird.png -------------------------------------------------------------------------------- /data/hicolor/256x256/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/256x256/apps/corebird.png -------------------------------------------------------------------------------- /data/hicolor/32x32/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/32x32/apps/corebird.png -------------------------------------------------------------------------------- /data/hicolor/48x48/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/48x48/apps/corebird.png -------------------------------------------------------------------------------- /data/hicolor/64x64/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/64x64/apps/corebird.png -------------------------------------------------------------------------------- /data/hicolor/96x96/apps/corebird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/hicolor/96x96/apps/corebird.png -------------------------------------------------------------------------------- /subprojects/libtl.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = libtl 3 | url=https://github.com/baedert/libtweetlength 4 | revision=head 5 | -------------------------------------------------------------------------------- /subprojects/liblistbox.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = liblistbox 3 | url=https://github.com/baedert/liblistbox 4 | revision=head 5 | -------------------------------------------------------------------------------- /data/org.baedert.corebird.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.baedert.corebird 3 | Exec=@bindir@/corebird --gapplication-service 4 | -------------------------------------------------------------------------------- /data/16x16/apps/corebird-dms-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-dms-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-dms-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-dms-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-filter-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-filter-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-filter-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-filter-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-compose-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-compose-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-favorite-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-favorite-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-mentions-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-mentions-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-profile-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-profile-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-retweet-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-retweet-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-compose-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-compose-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-favorite-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-favorite-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-mentions-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-mentions-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-profile-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-profile-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-retweet-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-retweet-symbolic.symbolic.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | ABOUT-NLS 3 | Makefile.in 4 | m4/ 5 | src/sql/*.c 6 | stats 7 | *.swp 8 | session.vim 9 | *~ 10 | build/ 11 | libcorebird.vapi 12 | -------------------------------------------------------------------------------- /data/16x16/apps/corebird-edit-find-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-edit-find-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-new-window-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-new-window-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-user-home-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-user-home-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-edit-find-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-edit-find-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-new-window-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-new-window-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-user-home-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-user-home-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/16x16/apps/corebird-conversation-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/16x16/apps/corebird-conversation-symbolic.symbolic.png -------------------------------------------------------------------------------- /data/32x32/apps/corebird-conversation-symbolic.symbolic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baedert/corebird/HEAD/data/32x32/apps/corebird-conversation-symbolic.symbolic.png -------------------------------------------------------------------------------- /sql/accounts/Create.2.sql: -------------------------------------------------------------------------------- 1 | PRAGMA user_version = 2; 2 | 3 | CREATE TABLE IF NOT EXISTS `filters`( 4 | id INTEGER PRIMARY KEY AUTOINCREMENT, 5 | content VARCHAR(100) 6 | ); 7 | -------------------------------------------------------------------------------- /data/.gitignore: -------------------------------------------------------------------------------- 1 | org.baedert.corebird.gschema.xml 2 | org.baedert.corebird.desktop.in 3 | org.baedert.corebird.desktop 4 | org.baedert.corebird.gschema.valid 5 | org.baedert.corebird.appdata.xml 6 | org.baedert.corebird.service 7 | -------------------------------------------------------------------------------- /sql/init/Create.1.sql: -------------------------------------------------------------------------------- 1 | 2 | PRAGMA user_version = 1; 3 | 4 | CREATE TABLE IF NOT EXISTS `accounts`( 5 | id NUMERIC(19,0) PRIMARY KEY, 6 | screen_name VARCHAR(30), 7 | name VARCHAR(30), 8 | avatar_url VARCHAR(255) 9 | ); 10 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('video', type: 'boolean', value: 'true') 2 | option('spellcheck', type: 'boolean', value: 'true') 3 | option('examples', type: 'boolean', value: 'false') 4 | option('experimental-listbox', type: 'boolean', value: 'false') 5 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://transifex.com 3 | 4 | [corebird.corebirdpot] 5 | file_filter = po/.po 6 | host = https://transifex.com 7 | source_file = po/corebird.pot 8 | source_lang = en 9 | type = PO 10 | lang_map = id_ID: id, ro_RO: ro, pt_PT: pt, ko_KR: ko, hi_IN: hi, ja_JP: ja, tr_TR: tr 11 | 12 | -------------------------------------------------------------------------------- /vapi/config.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")] 2 | namespace Config { 3 | public const string GETTEXT_PACKAGE; 4 | public const string PACKAGE; 5 | public const string PACKAGE_NAME; 6 | 7 | public const string DATADIR; 8 | public const string PKGDATADIR; 9 | } 10 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | ar 2 | ast 3 | ca 4 | ca@valencia 5 | de 6 | en_AU 7 | eo 8 | es 9 | es_419 10 | es_MX 11 | es_VE 12 | fa 13 | fi 14 | fr 15 | ga 16 | gl 17 | hi 18 | hu 19 | id 20 | it 21 | ja 22 | ko 23 | lt 24 | nb 25 | nl 26 | pl 27 | pt 28 | pt_BR 29 | ro 30 | ru 31 | sr 32 | sr@latin 33 | tr 34 | uk_UA 35 | zh_CN 36 | zh_TW -------------------------------------------------------------------------------- /examples/accountdialog.vala: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | void main (string[] args) { 5 | Gtk.init (ref args); 6 | 7 | Utils.load_custom_css (); 8 | Settings.init (); 9 | var acc = new Account (1337, "Some Screen Name", "Some Name"); 10 | var dialog = new AccountDialog (acc); 11 | dialog.show_all (); 12 | 13 | 14 | Gtk.main (); 15 | } 16 | -------------------------------------------------------------------------------- /examples/meson.build: -------------------------------------------------------------------------------- 1 | executable('tweetstates', 2 | 'tweetstates.vala', 3 | cb_resources, 4 | dependencies: cb_dep, 5 | vala_args: [ 6 | meson.source_root() + '/vapi/corebird-internal.vapi', 7 | meson.source_root() + '/vapi/rest-0.7.vapi', 8 | '--gresources=' + meson.source_root() + '/corebird.gresource.xml', 9 | ] 10 | ) 11 | -------------------------------------------------------------------------------- /data/meson_post_install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import subprocess 5 | 6 | schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas') 7 | 8 | if not os.environ.get('DESTDIR'): 9 | print('Compiling gsettings schemas...') 10 | subprocess.call(['glib-compile-schemas', schemadir]) 11 | -------------------------------------------------------------------------------- /sql/init/Create.2.sql: -------------------------------------------------------------------------------- 1 | 2 | PRAGMA user_version = 2; 3 | 4 | CREATE TABLE IF NOT EXISTS `snippets`( 5 | id INTEGER PRIMARY KEY AUTOINCREMENT, 6 | key VARCHAR(20), 7 | value VARCHAR(200) 8 | ); 9 | 10 | INSERT INTO `snippets` (key, value) VALUES ('dealwithit', '(•_•) ( •_•)>⌐■-■ (⌐■_■)'); 11 | INSERT INTO `snippets` (key, value) VALUES ('tableflip', '(╯°□°)╯︵ ┻━┻'); 12 | 13 | -------------------------------------------------------------------------------- /data/render-icons.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Oh god I hate bash. 4 | 5 | sizes=(16 24 32 48 64 96 128 256) 6 | 7 | for size in ${sizes[@]} 8 | do 9 | name="./hicolor/${size}x${size}/corebird.png" 10 | 11 | rsvg-convert ./corebird.svg --width="${size}" --height="${size}" \ 12 | --format=png -o ${name} 13 | # https://github.com/baedert/corebird/pull/826 14 | 15 | zopflipng --iterations=500 --keepchunks=iCCP \ 16 | --lossy_transparent --splitting=3 -my ${name} ${name} 17 | done 18 | -------------------------------------------------------------------------------- /data/org.baedert.corebird.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Corebird 3 | GenericName=Twitter Client 4 | Comment=Use Twitter from within a normal desktop application 5 | # TRANSLATORS: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! 6 | Keywords=twitter; 7 | Exec=corebird 8 | Type=Application 9 | # TRANSLATORS: Do NOT translate or transliterate this text (this is an icon file name)! 10 | Icon=corebird 11 | Categories=Network;GTK; 12 | DBusActivatable=true 13 | StartupWMClass=corebird 14 | -------------------------------------------------------------------------------- /flatpak/meson-no-lib64.patch: -------------------------------------------------------------------------------- 1 | diff -up meson-0.42.0/mesonbuild/mesonlib.py.lib64 meson-0.42.0/mesonbuild/mesonlib.py 2 | --- meson-0.42.0/mesonbuild/mesonlib.py.lib64 2017-09-14 16:01:33.812927457 +0200 3 | +++ meson-0.42.0/mesonbuild/mesonlib.py 2017-09-14 16:02:17.575331515 +0200 4 | @@ -334,7 +334,7 @@ def default_libdir(): 5 | return 'lib/' + archpath 6 | except Exception: 7 | pass 8 | - if os.path.isdir('/usr/lib64') and not os.path.islink('/usr/lib64'): 9 | + if os.path.isdir('/usr/lib64') and not os.path.islink('/usr/lib64') and False: # We disable lib64 in the freedesktop sdk 10 | return 'lib64' 11 | return 'lib' 12 | 13 | -------------------------------------------------------------------------------- /tests/meson.build: -------------------------------------------------------------------------------- 1 | 2 | tests = [ 3 | 'avatarcache', 4 | 'avatardownload', 5 | 'bundlehistory', 6 | 'dmmanager', 7 | 'filters', 8 | 'friends', 9 | 'inlinemediadownloader', 10 | 'texttransform', 11 | 'tweetmodel', 12 | 'tweetparsing', 13 | 'twitteritem', 14 | 'usercompletionmodel', 15 | 'usercounter', 16 | 'utils', 17 | ] 18 | 19 | foreach test_name : tests 20 | testcase = executable( 21 | test_name, 22 | test_name + '.vala', 23 | meson.source_root() + '/vapi/corebird-internal.vapi', 24 | meson.source_root() + '/vapi/gd-model-list-box.vapi', 25 | meson.source_root() + '/vapi/rest-0.7.vapi', 26 | cb_resources, 27 | dependencies: cb_dep, 28 | vala_args: [ 29 | '--gresources=' + meson.source_root() + '/corebird.gresource.xml', 30 | ], 31 | ) 32 | test(test_name, testcase) 33 | endforeach 34 | -------------------------------------------------------------------------------- /ui/menus.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | Settings 7 | app.show-settings 8 | 9 | 10 | Shortcuts 11 | action-disabled 12 | app.show-shortcuts 13 | 14 | 15 | About 16 | app.show-about-dialog 17 | 18 | 19 | Quit 20 | app.quit 21 | 22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- 1 | # List of source files that should *not* be translated. 2 | # Please keep this file sorted alphabetically. 3 | src/DefaultTimeline.c 4 | src/DMPage.c 5 | src/DMThreadsPage.c 6 | src/FavoritesTimeline.c 7 | src/FilterPage.c 8 | src/HomeTimeline.c 9 | src/list/DMThreadEntry.c 10 | src/list/FavImageRow.c 11 | src/ListsPage.c 12 | src/ListStatusesPage.c 13 | src/list/TweetListEntry.c 14 | src/MentionsTimeline.c 15 | src/ProfilePage.c 16 | src/SearchPage.c 17 | src/TweetInfoPage.c 18 | src/UserEventReceiver.c 19 | src/util/Utils.c 20 | src/widgets/AccountCreateWidget.c 21 | src/widgets/AvatarBannerWidget.c 22 | src/widgets/FavImageView.c 23 | src/widgets/FollowButton.c 24 | src/widgets/MediaButton.c 25 | src/widgets/PixbufButton.c 26 | src/window/AccountDialog.c 27 | src/window/ComposeTweetWindow.c 28 | src/window/ModifyFilterDialog.c 29 | src/window/ModifySnippetDialog.c 30 | src/window/SettingsDialog.c 31 | src/window/UserListDialog.c 32 | -------------------------------------------------------------------------------- /src/rest/rest/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Ross Burton 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms and conditions of the GNU Lesser General Public License, 9 | * version 2.1, as published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 14 | * more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | */ 21 | 22 | char * hmac_sha1 (const char *key, const char *message); 23 | -------------------------------------------------------------------------------- /src/ModelListBox.vala: -------------------------------------------------------------------------------- 1 | 2 | public class ModelListBox : Gd.ModelListBox { 3 | public Cb.TweetRow action_entry; 4 | public signal void retry_button_clicked (); 5 | 6 | public ModelListBox() { 7 | this.set_model (new Cb.TweetModel (), 8 | widget_fill_func, null); 9 | } 10 | 11 | private Gtk.Widget widget_fill_func (GLib.Object item, Gtk.Widget? old_row, uint index) { 12 | Cb.TweetRow row = old_row as Cb.TweetRow; 13 | Cb.Tweet tweet = item as Cb.Tweet; 14 | 15 | assert (tweet != null); 16 | 17 | if (row == null) { 18 | row = new Cb.TweetRow (tweet, (MainWindow)this.get_toplevel ()); 19 | } else { 20 | row.set_tweet (tweet); 21 | } 22 | 23 | return row; 24 | } 25 | 26 | public void set_error (string s) { 27 | } 28 | 29 | public void set_empty () { 30 | } 31 | 32 | public Gtk.Widget get_first_visible_row () { 33 | return null; 34 | } 35 | 36 | public void set_account (Account a) {} 37 | 38 | public Gtk.Widget get_row_at_index (int i) { return null; } 39 | } 40 | -------------------------------------------------------------------------------- /vapi/libtl.vapi: -------------------------------------------------------------------------------- 1 | namespace Tl { 2 | [CCode (cprefix = "TL_ENT_", cheader_filename = "libtweetlength.h")] 3 | enum EntityType { 4 | TEXT = 1, 5 | HASHTAG, 6 | LINK, 7 | MENTION, 8 | WHITESPACE 9 | } 10 | 11 | [CCode (cprefix = "TlEntity_", lower_case_cprefix = "tl_entity_", cheader_filename = "libtweetlength.h")] 12 | struct Entity { 13 | EntityType type; 14 | string *start; 15 | size_t start_character_index; 16 | size_t length_in_characters; 17 | size_t length_in_bytes; 18 | } 19 | 20 | 21 | [CCode (cprefix = "tl_", lower_case_cprefix = "tl_", cheader_filename = "libtweetlength.h")] 22 | size_t count_characters (string input); 23 | 24 | [CCode (cprefix = "tl_", lower_case_cprefix = "tl_", cheader_filename = "libtweetlength.h", 25 | array_length_pos = 1)] 26 | Entity[]? extract_entities (string input, out size_t text_length); 27 | 28 | [CCode (cprefix = "tl_", lower_case_cprefix = "tl_", cheader_filename = "libtweetlength.h", 29 | array_length_pos = 1)] 30 | Entity[]? extract_entities_and_text (string input, out size_t text_length); 31 | } 32 | -------------------------------------------------------------------------------- /vapi/gd-model-list-box.vapi: -------------------------------------------------------------------------------- 1 | namespace Gd { 2 | 3 | [CCode (cprefix = "GdModelListBox_", lower_case_cprefix = "gd_model_list_box_", cheader_filename = "gd-model-list-box.h")] 4 | public class ModelListBox : Gtk.Widget { 5 | [CCode (has_construct_function = false)] 6 | public ModelListBox (); 7 | 8 | public signal void row_activated (Gtk.Widget row, 9 | [CCode (type = "gpointer")] GLib.Object item, 10 | uint item_index); 11 | public Cb.TweetModel model; 12 | 13 | public delegate Gtk.Widget ModelListBoxFillFunc ([CCode (type = "gpointer")] GLib.Object item, 14 | Gtk.Widget widget, uint item_index); 15 | public delegate void ModelListBoxRemoveFunc (Gtk.Widget widget, 16 | [CCode (type = "gpointer")] GLib.Object item); 17 | 18 | public void set_model (GLib.ListModel model, 19 | owned ModelListBoxFillFunc? fill_func, 20 | owned ModelListBoxRemoveFunc? remove_func); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/widgets/LazyMenuButton.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | public class LazyMenuButton : Gtk.ToggleButton { 19 | public GLib.Menu menu_model { get; set; } 20 | 21 | public override void clicked () { 22 | //var popover = new Gtk.Popover.from_model (this, this.menu_model); 23 | //popover.position = Gtk.PositionType.BOTTOM; 24 | //popover.popup (); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/widgets/DoubleTapButton.vala: -------------------------------------------------------------------------------- 1 | 2 | /* This file is part of corebird, a Gtk+ linux Twitter client. 3 | * Copyright (C) 2013 Timm Bäder 4 | * 5 | * corebird is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * corebird is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with corebird. If not, see . 17 | */ 18 | public class DoubleTapButton : Gtk.ToggleButton { 19 | private bool first_step = false; 20 | 21 | public void reset () { 22 | first_step = false; 23 | } 24 | 25 | public void tap () { 26 | if (!first_step) { 27 | first_step = true; 28 | return; 29 | } 30 | this.active = !this.active; 31 | first_step = false; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/CbTextButton.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_TEXT_BUTTON_H__ 19 | #define __CB_TEXT_BUTTON_H__ 20 | 21 | #include 22 | 23 | /* This is not actually a new class, just some convenience API around 24 | * a normal GtkButton. */ 25 | 26 | GtkWidget * cb_text_button_new (const char *text); 27 | void cb_text_button_set_text (GtkWidget *button, 28 | const char *text); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /sql/accounts/Create.1.sql: -------------------------------------------------------------------------------- 1 | PRAGMA user_version = 1; 2 | 3 | -- SQL schema for an account database 4 | CREATE TABLE IF NOT EXISTS `common`( 5 | token VARCHAR(100), 6 | token_secret VARCHAR(100) 7 | ); 8 | 9 | 10 | CREATE TABLE IF NOT EXISTS `info`( 11 | id NUMERIC(19,0) PRIMARY KEY, 12 | screen_name VARCHAR(30), 13 | name VARCHAR(30) 14 | ); 15 | 16 | 17 | CREATE TABLE IF NOT EXISTS `dm_threads`( 18 | user_id NUMERIC(19,0) PRIMARY KEY, 19 | name VARCHAR(40), 20 | screen_name VARCHAR(30), 21 | last_message VARCHAR(250), 22 | last_message_id NUMERIC(19,0), 23 | avatar_url VARCHAR (250) 24 | ); 25 | 26 | CREATE TABLE IF NOT EXISTS `dms` ( 27 | from_id NUMERIC(19,0), 28 | to_id NUMERIC(19,0), 29 | from_screen_name VARCHAR(30), 30 | to_screen_name VARCHAR(40), 31 | from_name VARCHAR(30), 32 | to_name VARCHAR(30), 33 | timestamp INTEGER(11), 34 | avatar_url VARCHAR(250), 35 | id NUMERIC (19,0) PRIMARY KEY, 36 | text TEXT 37 | ); 38 | 39 | CREATE TABLE IF NOT EXISTS `user_cache`( 40 | id NUMERIC(19,0) PRIMARY KEY, 41 | screen_name VARCHAR(30), 42 | user_name VARCHAR (40), 43 | score INTEGER (11) 44 | ); 45 | 46 | INSERT INTO `user_cache` (id, screen_name, name, score) VALUES ('2877682863', 'corebirdclient', 'Corebird', 10); 47 | -------------------------------------------------------------------------------- /tests/utils.vala: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | void file_type () { 5 | string p = "foobar.png"; 6 | assert (Cb.Utils.get_file_type (p) == "png"); 7 | 8 | p = ".hidden.bar"; 9 | assert (Cb.Utils.get_file_type (p) == "bar"); 10 | 11 | p = "foo"; 12 | assert (Cb.Utils.get_file_type (p) == ""); 13 | 14 | p = "some.pointy.name.txt"; 15 | assert (Cb.Utils.get_file_type (p) == "txt"); 16 | 17 | p = "/foo/bar/zomg.txt"; 18 | assert (Cb.Utils.get_file_type (p) == "txt"); 19 | } 20 | 21 | 22 | void time_delta () { 23 | var now = new GLib.DateTime.now_local (); 24 | var then = now.add (-GLib.TimeSpan.MINUTE * 3); 25 | string delta = Utils.get_time_delta (then, now); 26 | assert (delta == "3m"); 27 | 28 | then = now; 29 | delta = Utils.get_time_delta (then, now); 30 | assert (delta == "Now"); 31 | 32 | then = now.add (-GLib.TimeSpan.HOUR * 20); 33 | delta = Utils.get_time_delta (then, now); 34 | assert (delta == "20h"); 35 | 36 | then = now; 37 | delta = Utils.get_time_delta (then, now); 38 | assert (delta == "Now"); 39 | } 40 | 41 | 42 | 43 | int main (string[] args) { 44 | GLib.Test.init (ref args); 45 | GLib.Test.add_func ("/utils/file-type", file_type); 46 | GLib.Test.add_func ("/utils/time-delta", time_delta); 47 | 48 | return GLib.Test.run (); 49 | } 50 | -------------------------------------------------------------------------------- /src/widgets/ReplyEntry.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class ReplyEntry : Gtk.Entry { 19 | [Signal (action = true)] 20 | public signal void cancelled (); 21 | 22 | 23 | 24 | 25 | public ReplyEntry () {} 26 | 27 | static construct { 28 | warning ("reply entry doesn't work."); 29 | //unowned Gtk.BindingSet binding_set = Gtk.BindingSet.by_class ((GLib.ObjectClass)typeof (ReplyEntry).class_ref ()); 30 | 31 | //Gtk.BindingEntry.add_signal (binding_set, Gdk.Key.Escape, 0, "cancelled", 0, null); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/rest/rest/rest-proxy-call-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Rob Bradford 6 | * Ross Burton 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms and conditions of the GNU Lesser General Public License, 10 | * version 2.1, as published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #ifndef _REST_PROXY_CALL_PRIVATE 24 | #define _REST_PROXY_CALL_PRIVATE 25 | 26 | #include "rest-proxy.h" 27 | #include "rest-proxy-call.h" 28 | #include "rest-params.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | const char *rest_proxy_call_get_url (RestProxyCall *call); 33 | 34 | G_END_DECLS 35 | 36 | #endif /* _REST_PROXY_CALL_PRIVATE */ 37 | -------------------------------------------------------------------------------- /src/rest/rest/test-runner.c: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (C) 2009 Intel Corporation. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms and conditions of the GNU Lesser General Public License, 7 | * version 2.1, as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 10 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 12 | * more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | #define test_add(unit_name, func) G_STMT_START { \ 23 | extern void func (void); \ 24 | g_test_add_func (unit_name, func); } G_STMT_END 25 | 26 | int 27 | main (int argc, char *argv[]) 28 | { 29 | g_test_init (&argc, &argv, NULL); 30 | 31 | test_add ("/oauth/param-encoding", test_param_encoding); 32 | 33 | return g_test_run (); 34 | } 35 | -------------------------------------------------------------------------------- /src/IPage.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | public interface IPage : Gtk.Widget { 19 | public abstract int id { get; set; } 20 | public abstract unowned Cb.MainWindow main_window { set; } 21 | 22 | public abstract void on_join(int page_id, Cb.Bundle? args); 23 | public abstract void on_leave (); 24 | public abstract void create_radio_button(Gtk.RadioButton? group); 25 | public abstract BadgeRadioButton? get_radio_button(); 26 | public abstract string get_title (); 27 | 28 | public virtual bool handles_double_open () { 29 | return false; 30 | } 31 | 32 | public virtual void double_open () {} 33 | } 34 | -------------------------------------------------------------------------------- /src/util/Benchmark.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2016 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | namespace Benchmark { 19 | public class Bench { 20 | public string name; 21 | public GLib.DateTime first; 22 | public void stop () { 23 | #if DEBUG 24 | var ts = new GLib.DateTime.now_local ().difference (first); 25 | int64 ms = (ts / 1000); 26 | 27 | debug (@"$(this.name) took $ms ms ($ts us)"); 28 | #endif 29 | } 30 | } 31 | 32 | 33 | public Bench start (string name) { 34 | var b = new Bench (); 35 | 36 | #if DEBUG 37 | b.name = name; 38 | b.first = new GLib.DateTime.now_local (); 39 | #endif 40 | return b; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/list/AddListEntry.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | public class AddListEntry : Gtk.ListBoxRow { 19 | public AddListEntry (string label) { 20 | var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5); 21 | var img = new Gtk.Image.from_icon_name ("list-add-symbolic"); 22 | img.pixel_size = 32; 23 | img.margin_start = 10; 24 | img.hexpand = true; 25 | img.halign = Gtk.Align.END; 26 | box.add (img); 27 | var l = new Gtk.Label (label); 28 | l.hexpand = true; 29 | l.halign = Gtk.Align.START; 30 | box.add (l); 31 | box.margin_bottom = 4; 32 | box.margin_top = 4; 33 | add (box); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | i18n = import('i18n') 2 | 3 | install_data( 4 | 'org.baedert.corebird.gschema.xml', 5 | install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') 6 | ) 7 | meson.add_install_script('meson_post_install.py') 8 | 9 | i18n.merge_file( 10 | input: 'org.baedert.corebird.desktop.in', 11 | output: 'org.baedert.corebird.desktop', 12 | po_dir: '../po/', 13 | type: 'desktop', 14 | install: true, 15 | install_dir: join_paths(get_option('datadir'), 'applications') 16 | ) 17 | i18n.merge_file( 18 | input: 'org.baedert.corebird.appdata.xml.in', 19 | output: 'org.baedert.corebird.appdata.xml', 20 | po_dir: '../po/', 21 | type: 'xml', 22 | install: true, 23 | install_dir: join_paths(get_option('datadir'), 'metainfo') 24 | ) 25 | 26 | install_man('corebird.1') 27 | 28 | conf = configuration_data() 29 | conf.set('bindir', join_paths(get_option('prefix'), 'bin')) 30 | 31 | configure_file( 32 | input: 'org.baedert.corebird.service.in', 33 | output: 'org.baedert.corebird.service', 34 | configuration: conf, 35 | install_dir: join_paths(get_option('datadir'), 'dbus-1/services') 36 | ) 37 | 38 | gnome.compile_schemas() 39 | 40 | # Install all application icons in one go 41 | # TODO: This will unfortunately also install the Makefile{.am} files which are still in hicolor/... 42 | install_subdir( 43 | 'hicolor', 44 | install_dir: join_paths(get_option('datadir'), 'icons') 45 | ) 46 | -------------------------------------------------------------------------------- /src/widgets/ImpostorWidget.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class ImpostorWidget : Gtk.Widget { 19 | private Gsk.RenderNode? cloned_node = null; 20 | 21 | 22 | public ImpostorWidget () { 23 | this.halign = Gtk.Align.FILL; 24 | this.valign = Gtk.Align.FILL; 25 | } 26 | 27 | public override void snapshot (Gtk.Snapshot snapshot) { 28 | if (this.cloned_node != null) { 29 | snapshot.append_node (this.cloned_node); 30 | } 31 | } 32 | 33 | public void clone (Gtk.Widget widget) { 34 | var snapshot = new Gtk.Snapshot (); 35 | widget.snapshot (snapshot); 36 | this.cloned_node = snapshot.to_node (); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /data/corebird.1: -------------------------------------------------------------------------------- 1 | .TH "corebird" "1" "08. Feb. 2014" "man page by Malcolm J Lewis" "" 2 | .SH NAME 3 | .B 4 | corebird 5 | - Native Gtk+ Twitter client for the Linux desktop. 6 | 7 | .SH SYNOPSIS 8 | .B 9 | corebird [--tweet=@screen_name] 10 | 11 | .SH DESCRIPTION 12 | - Corebird is a native GTK+ twitter client that provides vital features such as Direct Messages (DMs), tweet notifications, conversation views. 13 | 14 | - Additional features include the ability to change to the GTK+ dark theme, searching and media uploads. 15 | 16 | .SH KEYBOARD SHORTCUTS [command] 17 | .B 18 | [Ctrl + t] - 19 | Compose tweet 20 | 21 | .B 22 | [Back] - 23 | Go one page back (this can be triggered via the back button on the keyboard, the back thumb button on the mouse or [Alt + Left]) 24 | 25 | .B 26 | [Forward] - 27 | Go one page forward(this can be triggered via the forward button on the keyboard, the forward thumb button on the mouse or [Alt + Right]) 28 | 29 | .B 30 | [Alt + num] - 31 | Go to page [num] (between 1 and 5 at the moment) 32 | 33 | .B 34 | [Ctrl + Shift + s] - 35 | Show/Hide sidebar 36 | 37 | .B 38 | When a tweet is focused (via keynav) 39 | 40 | .B 41 | [r] - 42 | Reply 43 | 44 | .B 45 | [tt] - 46 | Retweet 47 | 48 | .B 49 | [f] - 50 | Favorite 51 | 52 | .B 53 | [dd] - 54 | Delete 55 | 56 | .B 57 | [Return] - 58 | Show tweet details 59 | 60 | .SH AUTHOR 61 | Written by Timm Bäder. 62 | 63 | .SH HOMEPAGE 64 | https://corebird.baedert.org/ 65 | 66 | .SH REPORTING BUGS 67 | https://github.com/baedert/corebird/issues 68 | -------------------------------------------------------------------------------- /flatpak/vala-no-valadoc.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile.am b/Makefile.am 2 | index e5dc0cc97..c84c33be7 100644 3 | --- a/Makefile.am 4 | +++ b/Makefile.am 5 | @@ -2,6 +2,14 @@ ACLOCAL_AMFLAGS = --install -I m4 ${ACLOCAL_FLAGS} 6 | 7 | NULL = 8 | 9 | +if HAVE_CGRAPH 10 | +MAYBE_VALADOC = libvaladoc valadoc 11 | +endif 12 | + 13 | +if ENABLE_DOC 14 | +MAYBE_DOC = doc 15 | +endif 16 | + 17 | SUBDIRS = \ 18 | gee \ 19 | vala \ 20 | @@ -10,11 +18,10 @@ SUBDIRS = \ 21 | compiler \ 22 | vapi \ 23 | tests \ 24 | - doc \ 25 | gobject-introspection \ 26 | vapigen \ 27 | - libvaladoc \ 28 | - valadoc \ 29 | + $(MAYBE_DOC) \ 30 | + $(MAYBE_VALADOC) \ 31 | $(NULL) 32 | 33 | if ENABLE_UNVERSIONED 34 | diff --git a/configure.ac b/configure.ac 35 | index c73d5d6b1..ad62c59a2 100644 36 | --- a/configure.ac 37 | +++ b/configure.ac 38 | @@ -98,7 +98,15 @@ PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_REQUIRED) 39 | AC_SUBST(GMODULE_CFLAGS) 40 | AC_SUBST(GMODULE_LIBS) 41 | 42 | -PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED) 43 | +AC_ARG_WITH([valadoc], AS_HELP_STRING([--with-valadoc], [Build libvaladoc])) 44 | + 45 | +AC_ARG_ENABLE(doc, AS_HELP_STRING([--enable-doc], [Build documentation]), enable_doc=$enableval, enable_doc=no) 46 | +AM_CONDITIONAL(ENABLE_DOC, test x$enable_doc = xyes) 47 | + 48 | +if test "x$with_valadoc" = "xyes"; then 49 | + PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED) 50 | +fi 51 | + 52 | AC_MSG_CHECKING([for CGRAPH]) 53 | cgraph_tmp_LIBADD="$LIBADD" 54 | cgraph_tmp_CFLAGS="$CFLAGS" 55 | -------------------------------------------------------------------------------- /tests/twitteritem.vala: -------------------------------------------------------------------------------- 1 | 2 | class TestItem : GLib.Object, Cb.TwitterItem { 3 | int64 timestamp; 4 | int64 sort_factor; 5 | GLib.TimeSpan last_timediff; 6 | 7 | public TestItem (int64 a, int64 b) { 8 | timestamp = a; 9 | sort_factor = b; 10 | } 11 | 12 | public int64 get_sort_factor () { 13 | return sort_factor; 14 | } 15 | 16 | public int64 get_timestamp () { 17 | return timestamp; 18 | } 19 | 20 | public int update_time_delta (GLib.DateTime? now = null) { 21 | return 0; 22 | } 23 | 24 | public void set_last_set_timediff (GLib.TimeSpan span) { 25 | this.last_timediff = span; 26 | } 27 | 28 | public GLib.TimeSpan get_last_set_timediff () { 29 | return this.last_timediff; 30 | } 31 | } 32 | 33 | 34 | void simple () { 35 | var a = new TestItem (1, 2); 36 | var b = new TestItem (10, 20); 37 | 38 | assert (a.get_timestamp () == 1); 39 | assert (a.get_sort_factor () == 2); 40 | 41 | assert (b.get_timestamp () == 10); 42 | assert (b.get_sort_factor () == 20); 43 | 44 | a.set_last_set_timediff (100); 45 | b.set_last_set_timediff (1000); 46 | 47 | message ("a: %s", a.get_last_set_timediff ().to_string ()); 48 | message ("b: %s", b.get_last_set_timediff ().to_string ()); 49 | 50 | assert (a.get_last_set_timediff () == 100); 51 | assert (b.get_last_set_timediff () == 1000); 52 | } 53 | 54 | int main (string[] args) { 55 | GLib.Test.init (ref args); 56 | GLib.Test.add_func ("/tweetitem/simple", simple); 57 | 58 | return GLib.Test.run (); 59 | } 60 | -------------------------------------------------------------------------------- /src/CbAspectImage.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_ASPECT_IMAGE_H__ 19 | #define __CB_ASPECT_IMAGE_H__ 20 | 21 | #include 22 | #include "CbAnimation.h" 23 | 24 | struct _CbAspectImage 25 | { 26 | GtkWidget parent_instance; 27 | 28 | GdkTexture *texture; 29 | 30 | CbAnimation opacity_animation; 31 | double opacity; 32 | }; 33 | typedef struct _CbAspectImage CbAspectImage; 34 | 35 | 36 | #define CB_TYPE_ASPECT_IMAGE cb_aspect_image_get_type () 37 | G_DECLARE_FINAL_TYPE (CbAspectImage, cb_aspect_image, CB, ASPECT_IMAGE, GtkWidget); 38 | 39 | GtkWidget * cb_aspect_image_new (void); 40 | 41 | void cb_aspect_image_set_pixbuf (CbAspectImage *self, 42 | GdkPixbuf *pixbuf); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/rest/.gitignore: -------------------------------------------------------------------------------- 1 | *.gir 2 | *.typelib 3 | *.la 4 | *.lo 5 | *.o 6 | Makefile 7 | Makefile.in 8 | .deps 9 | .libs 10 | *.bak 11 | *~ 12 | *.pc 13 | *.trs 14 | *.log 15 | aclocal.m4 16 | autom4te.cache 17 | compile 18 | configure 19 | config.* 20 | depcomp 21 | gtk-doc.make 22 | gtk-doc.m4 23 | install-sh 24 | libtool.m4 25 | ltoptions.m4 26 | ltsugar.m4 27 | ltversion.m4 28 | lt~obsolete.m4 29 | libtool 30 | ltmain.sh 31 | missing 32 | stamp-h1 33 | build/test-driver 34 | docs/reference/rest*/*-decl*.txt 35 | docs/reference/rest*/*-overrides.txt 36 | docs/reference/rest*/*-undeclared.txt 37 | docs/reference/rest*/*-undocumented.txt 38 | docs/reference/rest*/*-unused.txt 39 | docs/reference/rest*/*.args 40 | docs/reference/rest*/*.hierarchy 41 | docs/reference/rest*/*.interfaces 42 | docs/reference/rest*/*.prerequisites 43 | docs/reference/rest*/*.signals 44 | docs/reference/rest*/*.stamp 45 | docs/reference/rest*/html/ 46 | docs/reference/rest*/xml/ 47 | examples/continuous-twitter 48 | examples/dump-xml 49 | examples/get-fireeagle-location 50 | examples/get-flickr-favorites 51 | examples/lastfm-shout 52 | examples/post-twitter 53 | examples/post-twitter-media 54 | examples/test-raw 55 | examples/test-xml 56 | rest-extras/test-runner 57 | rest/rest-enum-types.c 58 | rest/rest-enum-types.h 59 | rest/stamp-rest-enum-types.h 60 | rest/rest-marshal.[ch] 61 | rest/test-runner 62 | tests/custom-serialize 63 | tests/flickr 64 | tests/lastfm 65 | tests/oauth 66 | tests/oauth-async 67 | tests/oauth2 68 | tests/proxy 69 | tests/proxy-continuous 70 | tests/threaded 71 | tests/xml 72 | -------------------------------------------------------------------------------- /src/CbMessageReceiver.c: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #include "CbMessageReceiver.h" 19 | 20 | G_DEFINE_INTERFACE (CbMessageReceiver, cb_message_receiver, G_TYPE_OBJECT); 21 | 22 | static void 23 | cb_message_receiver_default_init (CbMessageReceiverInterface *self) 24 | { 25 | self->stream_message_received = NULL; 26 | } 27 | 28 | void 29 | cb_message_receiver_stream_message_received (CbMessageReceiver *self, 30 | CbStreamMessageType type, 31 | JsonNode *node) 32 | { 33 | CbMessageReceiverInterface *iface; 34 | 35 | g_return_if_fail (CB_IS_MESSAGE_RECEIVER (self)); 36 | 37 | iface = CB_MESSAGE_RECEIVER_GET_IFACE (self); 38 | 39 | return iface->stream_message_received (self, type, node); 40 | } 41 | -------------------------------------------------------------------------------- /src/CbMaxSizeContainer.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2018 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #include 19 | #include "CbAnimation.h" 20 | 21 | typedef struct _CbMaxSizeContainer CbMaxSizeContainer; 22 | struct _CbMaxSizeContainer 23 | { 24 | GtkBin parent_instance; 25 | 26 | double fraction; 27 | 28 | CbAnimation open_animation; 29 | }; 30 | 31 | #define CB_TYPE_MAX_SIZE_CONTAINER cb_max_size_container_get_type () 32 | G_DECLARE_FINAL_TYPE (CbMaxSizeContainer, cb_max_size_container, CB, MAX_SIZE_CONTAINER, GtkBin); 33 | 34 | void cb_max_size_container_set_fraction (CbMaxSizeContainer *self, 35 | double fraction); 36 | double cb_max_size_container_get_fraction (CbMaxSizeContainer *self); 37 | void cb_max_size_container_animate_open (CbMaxSizeContainer *self); 38 | -------------------------------------------------------------------------------- /src/rest/rest/rest-main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Rob Bradford 6 | * Ross Burton 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms and conditions of the GNU Lesser General Public License, 10 | * version 2.1, as published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include "rest-private.h" 24 | 25 | guint rest_debug_flags = 0; 26 | 27 | /* 28 | * "Private" function used to set debugging flags based on environment 29 | * variables. Called upon entry into all public functions. 30 | */ 31 | void 32 | _rest_setup_debugging (void) 33 | { 34 | static gboolean setup_done = FALSE; 35 | static const GDebugKey keys[] = { 36 | { "proxy", REST_DEBUG_PROXY } 37 | }; 38 | 39 | if (G_LIKELY (setup_done)) 40 | return; 41 | 42 | rest_debug_flags = g_parse_debug_string (g_getenv ("REST_DEBUG"), 43 | keys, G_N_ELEMENTS (keys)); 44 | 45 | setup_done = TRUE; 46 | } 47 | -------------------------------------------------------------------------------- /src/CbReplyIndicator.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2018 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_REPLY_INDICATOR_H__ 19 | #define __CB_REPLY_INDICATOR_H__ 20 | 21 | #include 22 | 23 | typedef struct _CbReplyIndicator CbReplyIndicator; 24 | struct _CbReplyIndicator 25 | { 26 | GtkWidget parent_instance; 27 | 28 | GtkWidget *revealer; 29 | GtkWidget *button; 30 | }; 31 | 32 | #define CB_TYPE_REPLY_INDICATOR cb_reply_indicator_get_type () 33 | G_DECLARE_FINAL_TYPE (CbReplyIndicator, cb_reply_indicator, CB, REPLY_INDICATOR, GtkWidget); 34 | 35 | GType cb_reply_indicator_get_type (void) G_GNUC_CONST; 36 | void cb_reply_indicator_set_replies_available (CbReplyIndicator *self, 37 | gboolean replies_available); 38 | gboolean cb_reply_indicator_get_replies_available (CbReplyIndicator *self); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tests/avatarcache.vala: -------------------------------------------------------------------------------- 1 | void simple () { 2 | var texture = Twitter.no_avatar; 3 | var cache = new Cb.AvatarCache (); 4 | 5 | assert (cache.get_n_entries () == 0); 6 | cache.add (1337, texture, "some_url"); 7 | assert (cache.get_n_entries () == 1); 8 | 9 | cache.increase_refcount_for_texture (texture); 10 | assert (cache.get_n_entries () == 1); 11 | 12 | cache.decrease_refcount_for_texture (texture); 13 | assert (cache.get_n_entries () == 0); 14 | } 15 | 16 | void deferred_texture () { 17 | var texture = Twitter.no_avatar; 18 | var cache = new Cb.AvatarCache (); 19 | 20 | cache.add (1337, null, "some_url"); 21 | assert (cache.get_n_entries () == 1); 22 | 23 | bool found; 24 | var cached_texture = cache.get_texture_for_id (1337, out found); 25 | assert (cached_texture == null); 26 | assert (found); 27 | 28 | cache.set_avatar (1337, texture, "some_url"); 29 | assert (cache.get_n_entries () == 1); 30 | cache.increase_refcount_for_texture (texture); 31 | 32 | cached_texture = cache.get_texture_for_id (1337, out found); 33 | assert (cached_texture == texture); 34 | assert (found); 35 | 36 | cache.decrease_refcount_for_texture (texture); 37 | assert (cache.get_n_entries () == 0); 38 | 39 | cached_texture = cache.get_texture_for_id (1337, out found); 40 | assert (cached_texture == null); 41 | assert (!found); 42 | } 43 | 44 | int main (string[] args) { 45 | GLib.Test.init (ref args); 46 | Twitter.get ().init (); 47 | 48 | GLib.Test.add_func ("/avatarcache/simple", simple); 49 | GLib.Test.add_func ("/avatarcache/deferred_texture", deferred_texture); 50 | 51 | return GLib.Test.run (); 52 | } 53 | -------------------------------------------------------------------------------- /src/rest/rest/oauth-proxy-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Rob Bradford 6 | * Ross Burton 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms and conditions of the GNU Lesser General Public License, 10 | * version 2.1, as published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include "oauth-proxy.h" 24 | 25 | #define PROXY_GET_PRIVATE(o) \ 26 | (G_TYPE_INSTANCE_GET_PRIVATE ((o), OAUTH_TYPE_PROXY, OAuthProxyPrivate)) 27 | 28 | typedef struct { 29 | /* Application "consumer" keys */ 30 | char *consumer_key; 31 | char *consumer_secret; 32 | /* Authorisation "user" tokens */ 33 | char *token; 34 | char *token_secret; 35 | /* How we're signing */ 36 | OAuthSignatureMethod method; 37 | /* OAuth 1.0a */ 38 | gboolean oauth_10a; 39 | char *verifier; 40 | /* OAuth Echo */ 41 | gboolean oauth_echo; 42 | char *service_url; 43 | /* URL to use for signatures */ 44 | char *signature_host; 45 | } OAuthProxyPrivate; 46 | -------------------------------------------------------------------------------- /src/CbTextButton.c: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #include "CbTextButton.h" 19 | 20 | GtkWidget * 21 | cb_text_button_new (const char *text) 22 | { 23 | GtkWidget *label = gtk_label_new (text); 24 | GtkWidget *button; 25 | 26 | gtk_label_set_use_markup ((GtkLabel *)label, TRUE); 27 | gtk_label_set_ellipsize ((GtkLabel *)label, PANGO_ELLIPSIZE_END); 28 | gtk_label_set_xalign ((GtkLabel *)label, 0.0f); 29 | 30 | button = gtk_button_new (); 31 | gtk_container_add ((GtkContainer *)button, label); 32 | 33 | return button; 34 | } 35 | 36 | void 37 | cb_text_button_set_text (GtkWidget *button, 38 | const char *text) 39 | { 40 | GtkWidget *child; 41 | /* Should've been created using cb_text_button_new () */ 42 | g_assert (GTK_IS_LABEL (gtk_bin_get_child (GTK_BIN (button)))); 43 | 44 | child = gtk_bin_get_child (GTK_BIN (button)); 45 | 46 | gtk_label_set_label (GTK_LABEL (child), text); 47 | } 48 | -------------------------------------------------------------------------------- /src/CbFilter.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef FILTER_H 19 | #define FILTER_H 20 | 21 | #include 22 | 23 | G_BEGIN_DECLS 24 | 25 | typedef struct _CbFilter CbFilter; 26 | struct _CbFilter 27 | { 28 | GObject parent_instance; 29 | 30 | int id; 31 | char *contents; 32 | GRegex *regex; 33 | }; 34 | 35 | #define CB_TYPE_FILTER cb_filter_get_type () 36 | G_DECLARE_FINAL_TYPE (CbFilter, cb_filter, CB, FILTER, GObject); 37 | 38 | 39 | GType cb_filter_get_type (void) G_GNUC_CONST; 40 | CbFilter *cb_filter_new (const char *expr); 41 | void cb_filter_reset (CbFilter *filter, const char *expr); 42 | gboolean cb_filter_matches (CbFilter *filter, const char *text); 43 | const char *cb_filter_get_contents (CbFilter *filter); 44 | int cb_filter_get_id (CbFilter *filter); 45 | void cb_filter_set_id (CbFilter *filter, int id); 46 | 47 | G_END_DECLS 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/CbMessageReceiver.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_MESSAGE_RECEIVER_H__ 19 | #define __CB_MESSAGE_RECEIVER_H__ 20 | 21 | #include 22 | #include 23 | #include "CbTypes.h" 24 | 25 | #define CB_TYPE_MESSAGE_RECEIVER (cb_message_receiver_get_type()) 26 | 27 | G_DECLARE_INTERFACE (CbMessageReceiver, cb_message_receiver, CB, MESSAGE_RECEIVER, GObject) 28 | 29 | struct _CbMessageReceiverInterface 30 | { 31 | GTypeInterface base_iface; 32 | 33 | void (*stream_message_received) (CbMessageReceiver *self, 34 | CbStreamMessageType type, 35 | JsonNode *node); 36 | }; 37 | 38 | void cb_message_receiver_stream_message_received (CbMessageReceiver *self, 39 | CbStreamMessageType type, 40 | JsonNode *node); 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings. 2 | # Please keep this file sorted alphabetically. 3 | data/org.baedert.corebird.appdata.xml.in 4 | data/org.baedert.corebird.desktop.in 5 | src/CbMainWindow.c 6 | src/CbReplyIndicator.c 7 | src/CbTweetListBox.c 8 | src/CbUtils.c 9 | src/DMPage.vala 10 | src/DMThreadsPage.vala 11 | src/DefaultTimeline.vala 12 | src/FavoritesTimeline.vala 13 | src/FilterPage.vala 14 | src/HomeTimeline.vala 15 | src/ListStatusesPage.vala 16 | src/ListsPage.vala 17 | src/MentionsTimeline.vala 18 | src/ProfilePage.vala 19 | src/SearchPage.vala 20 | src/TweetInfoPage.vala 21 | src/UserEventReceiver.vala 22 | src/list/DMThreadEntry.vala 23 | src/list/FavImageRow.vala 24 | src/list/TweetListEntry.vala 25 | src/util/Utils.vala 26 | src/widgets/AccountCreateWidget.vala 27 | src/widgets/AvatarBannerWidget.vala 28 | src/widgets/FavImageView.vala 29 | src/widgets/FollowButton.vala 30 | src/widgets/MediaButton.vala 31 | src/widgets/PixbufButton.vala 32 | src/window/AccountDialog.vala 33 | src/window/ComposeTweetWindow.vala 34 | src/window/ModifyFilterDialog.vala 35 | src/window/ModifySnippetDialog.vala 36 | src/window/SettingsDialog.vala 37 | src/window/UserListDialog.vala 38 | ui/about-dialog.ui 39 | ui/account-create-widget.ui 40 | ui/account-dialog.ui 41 | ui/cb-emoji-chooser.ui 42 | ui/compose-window.ui 43 | ui/filter-list-entry.ui 44 | ui/filter-page.ui 45 | ui/list-list-entry.ui 46 | ui/list-statuses-page.ui 47 | ui/menus.ui 48 | ui/modify-filter-dialog.ui 49 | ui/modify-snippet-dialog.ui 50 | ui/new-list-entry.ui 51 | ui/profile-page.ui 52 | ui/search-page.ui 53 | ui/settings-dialog.ui 54 | ui/shortcuts-window.ui 55 | ui/start-conversation-entry.ui 56 | ui/tweet-info-page.ui 57 | ui/tweet-list-entry.ui 58 | ui/user-filter-entry.ui 59 | ui/user-list-entry.ui 60 | ui/user-lists-widget.ui 61 | -------------------------------------------------------------------------------- /src/async/Barrier.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | public class Barrier : GLib.Object { 19 | private int cur = 0; 20 | private int max; 21 | private GLib.Error? error = null; 22 | public bool done { 23 | get { 24 | return this.cur == this.max; 25 | } 26 | } 27 | 28 | 29 | public signal void finished (GLib.Error? error); 30 | 31 | public Barrier (int max) 32 | requires (max >= 0) 33 | { 34 | this.max = max; 35 | } 36 | 37 | public void emit (GLib.Error? error = null) 38 | requires (cur < max) 39 | { 40 | /* If our global error is set, something previously went wrong and we ignore 41 | this call to emit(); */ 42 | if (this.error != null) 43 | return; 44 | 45 | /* If error is set, we call finished() with that error and ignore all 46 | following calls to emit() */ 47 | if (error != null) { 48 | finished (error); 49 | this.error = error; 50 | return; 51 | } 52 | 53 | cur++; 54 | if (cur == max) { 55 | finished (null); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/rest/rest/sha1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Ross Burton 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms and conditions of the GNU Lesser General Public License, 9 | * version 2.1, as published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 14 | * more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | #include "sha1.h" 25 | 26 | #define SHA1_LENGTH 20 27 | 28 | /* 29 | * hmac_sha1: 30 | * @key: The key 31 | * @message: The message 32 | * 33 | * Given the key and message, compute the HMAC-SHA1 hash and return the base-64 34 | * encoding of it. This is very geared towards OAuth, and as such both key and 35 | * message must be NULL-terminated strings, and the result is base-64 encoded. 36 | */ 37 | char * 38 | hmac_sha1 (const char *key, const char *message) 39 | { 40 | GHmac *hmac; 41 | gsize digest_length = SHA1_LENGTH; 42 | guchar digest[digest_length]; 43 | 44 | hmac = g_hmac_new (G_CHECKSUM_SHA1, (guchar *)key, strlen (key)); 45 | g_hmac_update (hmac, (guchar *)message, -1); 46 | 47 | g_hmac_get_digest (hmac, digest, &digest_length); 48 | 49 | g_hmac_unref (hmac); 50 | 51 | return g_base64_encode (digest, digest_length); 52 | } 53 | -------------------------------------------------------------------------------- /src/CbSurfaceProgress.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | #ifndef _CB_SURFACE_PROGRESS_H_ 18 | #define _CB_SURFACE_PROGRESS_H_ 19 | 20 | #include 21 | 22 | #define CB_TYPE_SURFACE_PROGRESS cb_surface_progress_get_type () 23 | G_DECLARE_FINAL_TYPE (CbSurfaceProgress, cb_surface_progress, CB, SURFACE_PROGRESS, GtkWidget); 24 | 25 | struct _CbSurfaceProgress 26 | { 27 | GtkWidget parent_instance; 28 | 29 | GdkTexture *texture; 30 | double progress; 31 | }; 32 | typedef struct _CbSurfaceProgress CbSurfaceProgress; 33 | 34 | GtkWidget * cb_surface_progress_new (void); 35 | double cb_surface_progress_get_progress (CbSurfaceProgress *self); 36 | void cb_surface_progress_set_progress (CbSurfaceProgress *self, 37 | double progress); 38 | GdkTexture* cb_surface_progress_get_texture (CbSurfaceProgress *self); 39 | void cb_surface_progress_set_texture (CbSurfaceProgress *self, 40 | GdkTexture *texture); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/CbTextTransform.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __TEXT_TRANSFORM_H 19 | #define __TEXT_TRANSFORM_H 20 | 21 | #include 22 | #include "CbTypes.h" 23 | 24 | typedef enum { 25 | CB_TEXT_TRANSFORM_REMOVE_MEDIA_LINKS = 1 << 0, 26 | CB_TEXT_TRANSFORM_REMOVE_TRAILING_HASHTAGS = 1 << 1, 27 | CB_TEXT_TRANSFORM_EXPAND_LINKS = 1 << 2 28 | } CbTransformFlags; 29 | 30 | 31 | 32 | char *cb_text_transform_tweet (const CbMiniTweet *tweet, 33 | guint flags, 34 | guint64 quote_id); 35 | 36 | 37 | char *cb_text_transform_text (const char *text, 38 | const CbTextEntity *entities, 39 | gsize n_entities, 40 | guint flags, 41 | gsize n_medias, 42 | gint64 quote_id, 43 | guint display_range_start); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/util/Dirs.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | namespace Dirs { 19 | static string? config_dir = null; 20 | 21 | 22 | public void create_dirs () { 23 | create_folder (config ("")); 24 | create_folder (config ("accounts/")); 25 | create_folder (config ("image-favorites/")); 26 | } 27 | 28 | public string config (string path) { 29 | if (config_dir == null) { 30 | config_dir = GLib.Environment.get_home_dir () + "/.corebird/"; 31 | if (!GLib.FileUtils.test (config_dir, GLib.FileTest.EXISTS)) { 32 | config_dir = GLib.Environment.get_user_config_dir () + "/corebird/"; 33 | } 34 | } 35 | return config_dir + path; 36 | } 37 | 38 | private void create_folder (string path) { 39 | if (FileUtils.test (path, FileTest.EXISTS)) 40 | return; 41 | 42 | try { 43 | bool success = File.new_for_path (path) 44 | .make_directory (); 45 | if (!success) { 46 | critical("Couldn't create user folder %s", path); 47 | } 48 | } catch (GLib.Error e) { 49 | critical ("%s(%s)", e.message, path); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/rest/rest/rest-params.h: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Rob Bradford 6 | * Ross Burton 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms and conditions of the GNU Lesser General Public License, 10 | * version 2.1, as published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #ifndef _REST_PARAMS 24 | #define _REST_PARAMS 25 | 26 | #include 27 | #include "rest-param.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct _RestParams RestParams; 32 | typedef struct _GHashTableIter RestParamsIter; 33 | 34 | RestParams * rest_params_new (void); 35 | 36 | void rest_params_free (RestParams *params); 37 | 38 | void rest_params_add (RestParams *params, RestParam *param); 39 | 40 | RestParam *rest_params_get (RestParams *params, const char *name); 41 | 42 | void rest_params_remove (RestParams *params, const char *name); 43 | 44 | gboolean rest_params_are_strings (RestParams *params); 45 | 46 | GHashTable * rest_params_as_string_hash_table (RestParams *params); 47 | 48 | void rest_params_iter_init (RestParamsIter *iter, RestParams *params); 49 | gboolean rest_params_iter_next (RestParamsIter *iter, const char **name, RestParam **param); 50 | 51 | G_END_DECLS 52 | 53 | #endif /* _REST_PARAMS */ 54 | -------------------------------------------------------------------------------- /src/CbQuoteTweetWidget.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_QUOTE_TWEET_WIDGET_H__ 19 | #define __CB_QUOTE_TWEET_WIDGET_H__ 20 | 21 | #include 22 | #include "CbTypes.h" 23 | 24 | struct _CbQuoteTweetWidget 25 | { 26 | GtkWidget parent_instance; 27 | 28 | GtkWidget *top_row_box; 29 | GtkWidget *name_button; 30 | GtkWidget *screen_name_label; 31 | GtkWidget *time_delta_label; 32 | GtkWidget *text_label; 33 | 34 | gint64 user_id; 35 | char *screen_name; 36 | gint64 tweet_created_at; 37 | }; 38 | typedef struct _CbQuoteTweetWidget CbQuoteTweetWidget; 39 | 40 | #define CB_TYPE_QUOTE_TWEET_WIDGET cb_quote_tweet_widget_get_type () 41 | G_DECLARE_FINAL_TYPE (CbQuoteTweetWidget, cb_quote_tweet_widget, CB, QUOTE_TWEET_WIDGET, GtkWidget); 42 | 43 | GtkWidget * cb_quote_tweet_widget_new (void); 44 | void cb_quote_tweet_widget_set_tweet (CbQuoteTweetWidget *self, 45 | const CbMiniTweet *quote); 46 | void cb_quote_tweet_widget_update_time (CbQuoteTweetWidget *self, 47 | GDateTime *now); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /tests/friends.vala: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | void set () { 6 | Account account = new Account (1337, "Name", "Screen Name"); 7 | Json.Array friends = new Json.Array (); 8 | for (int i = 10; i <= 17; i ++) { 9 | friends.add_int_element (i); 10 | } 11 | 12 | account.set_friends (friends); 13 | 14 | for (int i = 10; i <= 17; i ++) { 15 | assert (account.follows_id (i)); 16 | } 17 | 18 | } 19 | 20 | 21 | void add () { 22 | Account account = new Account (1337, "Name", "Screen Name"); 23 | Json.Array friends = new Json.Array (); 24 | for (int i = 10; i <= 17; i ++) { 25 | friends.add_int_element (i); 26 | } 27 | 28 | account.set_friends (friends); 29 | 30 | account.follow_id (1337); 31 | 32 | assert (account.follows_id (1337)); 33 | 34 | for (int i = 10; i <= 17; i ++) { 35 | assert (account.follows_id (i)); 36 | } 37 | } 38 | 39 | void _remove () { 40 | Account account = new Account (1337, "Name", "Screen Name"); 41 | Json.Array friends = new Json.Array (); 42 | for (int i = 10; i <= 17; i ++) { 43 | friends.add_int_element (i); 44 | } 45 | 46 | account.set_friends (friends); 47 | 48 | account.unfollow_id (10); 49 | account.unfollow_id (11); 50 | account.unfollow_id (12); 51 | 52 | for (int i = 13; i <= 17; i ++) { 53 | assert (account.follows_id (i)); 54 | } 55 | 56 | assert (!account.follows_id (10)); 57 | assert (!account.follows_id (11)); 58 | assert (!account.follows_id (12)); 59 | 60 | 61 | account.unfollow_id (17); 62 | assert (!account.follows_id (17)); 63 | 64 | account.unfollow_id (17); 65 | assert (!account.follows_id (17)); 66 | 67 | 68 | } 69 | 70 | 71 | int main (string[] args) { 72 | GLib.Test.init (ref args); 73 | Dirs.create_dirs (); 74 | GLib.Test.add_func ("/friends/set", set); 75 | GLib.Test.add_func ("/friends/add", add); 76 | GLib.Test.add_func ("/friends/remove", _remove); 77 | 78 | return GLib.Test.run (); 79 | } 80 | -------------------------------------------------------------------------------- /src/CbMediaVideoWidget.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | #ifndef _CB_MEDIA_VIDEO_WIDGET_H_ 18 | #define _CB_MEDIA_VIDEO_WIDGET_H_ 19 | 20 | #ifdef VIDEO 21 | #include 22 | #endif 23 | #include 24 | #include 25 | #include "CbMedia.h" 26 | #include "CbSurfaceProgress.h" 27 | 28 | #define CB_TYPE_MEDIA_VIDEO_WIDGET cb_media_video_widget_get_type () 29 | G_DECLARE_FINAL_TYPE (CbMediaVideoWidget, cb_media_video_widget, CB, MEDIA_VIDEO_WIDGET, GtkWidget); 30 | 31 | struct _CbMediaVideoWidget 32 | { 33 | GtkWidget parent_instance; 34 | 35 | 36 | #ifdef VIDEO 37 | GstElement *src; 38 | GstElement *sink; 39 | #endif 40 | 41 | SoupSession *session; 42 | SoupMessage *message; 43 | 44 | GtkWidget *stack; 45 | GtkWidget *area; 46 | GtkWidget *surface_progress; 47 | GtkWidget *video_progress; 48 | GtkWidget *error_label; 49 | 50 | GCancellable *cancellable; 51 | guint video_progress_id; 52 | char *media_url; 53 | }; 54 | typedef struct _CbMediaVideoWidget CbMediaVideoWidget; 55 | 56 | CbMediaVideoWidget * cb_media_video_widget_new (CbMedia *media); 57 | void cb_media_video_widget_start (CbMediaVideoWidget *self); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/CbMediaImageWidget.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef _CB_MEDIA_IMAGE_WIDGET_H_ 19 | #define _CB_MEDIA_IMAGE_WIDGET_H_ 20 | 21 | #include 22 | #include "CbMedia.h" 23 | 24 | #define CB_TYPE_MEDIA_IMAGE_WIDGET cb_media_image_widget_get_type () 25 | G_DECLARE_FINAL_TYPE (CbMediaImageWidget, cb_media_image_widget, CB, MEDIA_IMAGE_WIDGET, GtkWidget); 26 | 27 | struct _CbMediaImageWidget 28 | { 29 | GtkWidget parent_instance; 30 | 31 | GtkWidget *scroller; 32 | GtkWidget *image; 33 | 34 | double drag_start_hvalue; 35 | double drag_start_vvalue; 36 | 37 | double initial_scroll_x; 38 | double initial_scroll_y; 39 | 40 | int img_width; 41 | int img_height; 42 | 43 | gulong hadj_changed_id; 44 | gulong vadj_changed_id; 45 | }; 46 | typedef struct _CbMediaImageWidget CbMediaImageWidget; 47 | 48 | GtkWidget * cb_media_image_widget_new (CbMedia *media); 49 | void cb_media_image_widget_scroll_to (CbMediaImageWidget *self, 50 | double px, 51 | double py); 52 | void cb_media_image_widget_calc_size (CbMediaImageWidget *self); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2018 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #include "corebird.h" 19 | #ifdef VIDEO 20 | #include 21 | #endif 22 | 23 | int 24 | main (int argc, char **argv) 25 | { 26 | GtkApplication *app; 27 | int ret; 28 | 29 | 30 | gtk_init(); 31 | GtkWidget *w = cb_scroll_widget_new(); 32 | g_assert (GTK_IS_WIDGET (w)); 33 | 34 | #ifdef VIDEO 35 | gst_init (&argc, &argv); 36 | #endif 37 | 38 | settings_init (); 39 | app = GTK_APPLICATION (corebird_new ()); 40 | ret = g_application_run (G_APPLICATION (app), argc, argv); 41 | 42 | #ifdef DEBUG 43 | { 44 | /* Explicitly destroy all remaining toplevel windows */ 45 | GList *toplevels = gtk_window_list_toplevels (); 46 | GList *l = toplevels; 47 | 48 | g_debug ("Toplevels left: %u", g_list_length (toplevels)); 49 | while (l) 50 | { 51 | GtkWidget *w = l->data; 52 | l = l->next; 53 | 54 | g_debug ("Destroying %s %p", G_OBJECT_TYPE_NAME (w), w); 55 | 56 | gtk_widget_destroy (w); 57 | } 58 | g_list_free (toplevels); 59 | } 60 | 61 | #ifdef VIDEO 62 | gst_deinit (); 63 | #endif 64 | 65 | #endif /* ifdef DEBUG */ 66 | 67 | g_object_unref (app); 68 | 69 | return ret; 70 | } 71 | -------------------------------------------------------------------------------- /src/util/UserCompletion.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class UserCompletion : GLib.Object { 19 | public signal void start_completion (); 20 | public signal void populate_completion (string screen_name, string name); 21 | private unowned GLib.Object obj; 22 | private unowned Account account; 23 | private string name_property_name; 24 | private int num_results; 25 | 26 | public UserCompletion (Account account, int num_results) { 27 | this.account = account; 28 | this.num_results = num_results; 29 | } 30 | 31 | public void connect_to (GLib.Object obj, string name_property_name) { 32 | this.obj = obj; 33 | this.name_property_name = name_property_name; 34 | obj.notify[name_property_name].connect (prop_changed); 35 | } 36 | 37 | private void prop_changed () { 38 | string name; 39 | obj.get (name_property_name, out name); 40 | if (name.has_prefix ("@")) 41 | name = name.substring (1); 42 | start_completion (); 43 | Cb.UserInfo[] names; 44 | account.user_counter.query_by_prefix (account.db.get_sqlite_db (), 45 | name, 10, 46 | out names); 47 | 48 | for (int i = 0; i < names.length; i++) 49 | populate_completion (names[i].screen_name, names[i].user_name); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/CbDeltaUpdater.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef DELTA_UPDATER_H 19 | #define DELTA_UPDATER_H 20 | 21 | #include 22 | #include 23 | #include "CbTwitterItem.h" 24 | 25 | typedef struct _CbDeltaUpdater CbDeltaUpdater; 26 | typedef struct _CbDeltaUpdaterClass CbDeltaUpdaterClass; 27 | 28 | #define CB_TYPE_DELTA_UPDATER (cb_delta_updater_get_type ()) 29 | #define CB_DELTA_UPDATER(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, CB_TYPE_DELTA_UPDATER, CbDeltaUpdater)) 30 | #define CB_DELTA_UPDATER_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST(cls, CB_TYPE_DELTA_UPDATER, CbDeltaUpdaterClass)) 31 | #define CB_IS_DELTA_UPDATER(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, CB_TYPE_DELTA_UPDATER)) 32 | #define CB_IS_DELTA_UPDATER_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE(cls, CB_TYPE_DELTA_UPDATER)) 33 | #define CB_DELTA_UPDATER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS(obj, CB_TYPE_DELTA_UPDATER, CbDeltaUpdaterClass)) 34 | 35 | struct _CbDeltaUpdater 36 | { 37 | GObject parent_instance; 38 | 39 | GtkWidget *listbox; 40 | guint minutely_id; 41 | }; 42 | 43 | struct _CbDeltaUpdaterClass 44 | { 45 | GObjectClass parent_class; 46 | }; 47 | 48 | GType cb_delta_updater_get_type (void) G_GNUC_CONST; 49 | 50 | CbDeltaUpdater * cb_delta_updater_new (GtkWidget *listbox); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/CbEmojiChooser.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_EMOJI_CHOOSER_H__ 19 | #define __CB_EMOJI_CHOOSER_H__ 20 | 21 | #include 22 | 23 | typedef struct { 24 | GtkWidget *box; 25 | GtkWidget *heading; 26 | GtkWidget *button; 27 | const char *first; 28 | gunichar label; 29 | gboolean empty; 30 | } EmojiSection; 31 | 32 | struct _CbEmojiChooser 33 | { 34 | GtkBox parent_instance; 35 | 36 | guint populated : 1; 37 | guint populate_idle_id; 38 | 39 | GtkWidget *search_entry; 40 | GtkWidget *stack; 41 | GtkWidget *scrolled_window; 42 | 43 | EmojiSection recent; 44 | EmojiSection people; 45 | EmojiSection body; 46 | EmojiSection nature; 47 | EmojiSection food; 48 | EmojiSection travel; 49 | EmojiSection activities; 50 | EmojiSection objects; 51 | EmojiSection symbols; 52 | EmojiSection flags; 53 | 54 | GVariant *data; 55 | 56 | GSettings *settings; 57 | }; 58 | typedef struct _CbEmojiChooser CbEmojiChooser; 59 | 60 | #define CB_TYPE_EMOJI_CHOOSER cb_emoji_chooser_get_type () 61 | G_DECLARE_FINAL_TYPE (CbEmojiChooser, cb_emoji_chooser, CB, EMOJI_CHOOSER, GtkBox); 62 | 63 | GtkWidget * cb_emoji_chooser_new (void); 64 | gboolean cb_emoji_chooser_try_init (CbEmojiChooser *self); 65 | void cb_emoji_chooser_populate (CbEmojiChooser *self); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/list/NewListEntry.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | [GtkTemplate (ui = "/org/baedert/corebird/ui/new-list-entry.ui")] 19 | class NewListEntry : Gtk.ListBoxRow { 20 | [GtkChild] 21 | private Gtk.Entry list_name_entry; 22 | [GtkChild] 23 | private Gtk.Revealer revealer; 24 | [GtkChild] 25 | private Gtk.Button create_list_button; 26 | 27 | public signal void create_activated (string list_name); 28 | 29 | 30 | construct { 31 | list_name_entry.buffer.notify["text"].connect (name_text_changed_cb); 32 | } 33 | 34 | public void reveal () { 35 | revealer.reveal_child = true; 36 | this.activatable = false; 37 | list_name_entry.grab_focus (); 38 | } 39 | 40 | public void unreveal () { 41 | revealer.reveal_child = false; 42 | this.activatable = true; 43 | list_name_entry.text = ""; 44 | } 45 | 46 | [GtkCallback] 47 | private void create_list_button_clicked_cb () { 48 | create_activated (list_name_entry.text); 49 | } 50 | 51 | private void name_text_changed_cb () { 52 | string name = list_name_entry.text; 53 | 54 | create_list_button.sensitive = false; 55 | 56 | if (name.length == 0 || name.char_count () > 25) 57 | return; 58 | 59 | if (name.get_char (0).isdigit()) 60 | return; 61 | 62 | 63 | create_list_button.sensitive = true; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/CbAnimation.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_ANIMATION_H__ 19 | #define __CB_ANIMATION_H__ 20 | 21 | #include 22 | 23 | #define CB_TRANSITION_DURATION (200 * 1000) 24 | 25 | 26 | typedef struct _CbAnimation CbAnimation; 27 | typedef void (*CbAnimateFunc) (CbAnimation *self, 28 | double t, 29 | gpointer user_data); 30 | 31 | struct _CbAnimation 32 | { 33 | GtkWidget *owner; 34 | guint64 duration; 35 | guint tick_id; 36 | guint reverse : 1; 37 | double start_percentage; 38 | 39 | guint64 start_time; 40 | CbAnimateFunc func; 41 | gpointer user_data; 42 | }; 43 | 44 | void cb_animation_init (CbAnimation *self, 45 | GtkWidget *owner, 46 | CbAnimateFunc func); 47 | void cb_animation_start (CbAnimation *self, 48 | gpointer user_data); 49 | void cb_animation_start_reverse (CbAnimation *self); 50 | void cb_animation_stop (CbAnimation *self); 51 | gboolean cb_animation_is_running (const CbAnimation *self); 52 | gboolean cb_animation_is_reverse (const CbAnimation *self); 53 | void cb_animation_destroy (CbAnimation *self); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/CbTwitterItem.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef _CB_TWITTER_ITEM_H_ 19 | #define _CB_TWITTER_ITEM_H_ 20 | 21 | #include 22 | 23 | #define CB_TYPE_TWITTER_ITEM (cb_twitter_item_get_type()) 24 | 25 | G_DECLARE_INTERFACE (CbTwitterItem, cb_twitter_item, CB, TWITTER_ITEM, GObject) 26 | 27 | struct _CbTwitterItemInterface 28 | { 29 | GTypeInterface base_iface; 30 | 31 | gint64 (*get_sort_factor) (CbTwitterItem *self); 32 | 33 | int (*update_time_delta) (CbTwitterItem *self, 34 | GDateTime *now); 35 | 36 | gint64 (*get_timestamp) (CbTwitterItem *self); 37 | 38 | void (*set_last_set_timediff) (CbTwitterItem *self, 39 | GTimeSpan span); 40 | 41 | GTimeSpan (*get_last_set_timediff) (CbTwitterItem *self); 42 | }; 43 | 44 | gint64 cb_twitter_item_get_sort_factor (CbTwitterItem *self); 45 | int cb_twitter_item_update_time_delta (CbTwitterItem *self, 46 | GDateTime *now); 47 | gint64 cb_twitter_item_get_timestamp (CbTwitterItem *self); 48 | 49 | /* Basically just for CbDeltaUpdater */ 50 | void cb_twitter_item_set_last_set_timediff (CbTwitterItem *self, 51 | GTimeSpan span); 52 | GTimeSpan cb_twitter_item_get_last_set_timediff (CbTwitterItem *self); 53 | 54 | 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/widgets/DMPlaceholderBox.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class DMPlaceholderBox : Gtk.Box { 19 | private AvatarWidget avatar_image; 20 | private Gtk.Label name_label; 21 | private Gtk.Label screen_name_label; 22 | 23 | public int64 user_id; 24 | 25 | public new string name { 26 | set { 27 | name_label.label = value; 28 | } 29 | } 30 | 31 | public string screen_name { 32 | set { 33 | screen_name_label.label = "@" + value; 34 | } 35 | } 36 | 37 | public string avatar_url; 38 | 39 | public void load_avatar () { 40 | Twitter.get ().get_avatar.begin (user_id, avatar_url, avatar_image); 41 | } 42 | 43 | construct { 44 | this.set_opacity (0.8); 45 | this.set_margin_top (60); 46 | this.set_orientation (Gtk.Orientation.VERTICAL); 47 | this.set_spacing (4); 48 | this.avatar_image = new AvatarWidget (); 49 | avatar_image.size = 48; 50 | avatar_image.set_halign (Gtk.Align.CENTER); 51 | this.add (avatar_image); 52 | 53 | this.name_label = new Gtk.Label (""); 54 | var attrs = new Pango.AttrList (); 55 | attrs.insert (Pango.attr_weight_new (Pango.Weight.BOLD)); 56 | name_label.set_attributes (attrs); 57 | this.add (name_label); 58 | 59 | this.screen_name_label = new Gtk.Label (""); 60 | screen_name_label.get_style_context ().add_class ("dim-label"); 61 | this.add (screen_name_label); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/CbMedia.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2016 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_MEDIA_H__ 19 | #define __CB_MEDIA_H__ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef enum { 29 | CB_MEDIA_TYPE_IMAGE, 30 | CB_MEDIA_TYPE_GIF, 31 | CB_MEDIA_TYPE_ANIMATED_GIF, 32 | CB_MEDIA_TYPE_TWITTER_VIDEO, 33 | CB_MEDIA_TYPE_INSTAGRAM_VIDEO, 34 | 35 | CB_MEDIA_TYPE_UNKNOWN 36 | } CbMediaType; 37 | 38 | 39 | struct _CbMedia 40 | { 41 | GObject parent_instance; 42 | 43 | char *url; 44 | char *thumb_url; 45 | char *target_url; 46 | 47 | int width; 48 | int height; 49 | 50 | CbMediaType type; 51 | guint loaded : 1; 52 | guint invalid : 1; 53 | double percent_loaded; 54 | 55 | GdkPixbufAnimation *animation; 56 | GdkTexture *texture; 57 | }; 58 | 59 | typedef struct _CbMedia CbMedia; 60 | 61 | #define CB_TYPE_MEDIA cb_media_get_type () 62 | G_DECLARE_FINAL_TYPE (CbMedia, cb_media, CB, MEDIA, GObject); 63 | 64 | CbMedia * cb_media_new (void); 65 | gboolean cb_media_is_video (CbMedia *media); 66 | void cb_media_loading_finished (CbMedia *media); 67 | void cb_media_update_progress (CbMedia *media, 68 | double progress); 69 | CbMediaType cb_media_type_from_url (const char *url); 70 | 71 | G_END_DECLS 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/CbUserCompletionModel.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef _CB_USER_COMPLETION_MODEL_H 19 | #define _CB_USER_COMPLETION_MODEL_H 20 | 21 | #include "CbTypes.h" 22 | #include "CbUserCounter.h" 23 | #include 24 | #include 25 | 26 | struct _CbUserCompletionModel 27 | { 28 | GObject parent_instance; 29 | 30 | GArray *items; 31 | }; 32 | 33 | typedef struct _CbUserCompletionModel CbUserCompletionModel; 34 | 35 | #define CB_TYPE_USER_COMPLETION_MODEL cb_user_completion_model_get_type () 36 | G_DECLARE_FINAL_TYPE (CbUserCompletionModel, cb_user_completion_model, CB, USER_COMPLETION_MODEL, GObject); 37 | 38 | 39 | CbUserCompletionModel * cb_user_completion_model_new (void); 40 | void cb_user_completion_model_insert_items (CbUserCompletionModel *self, 41 | CbUserIdentity *ids, 42 | guint ids_len); 43 | void cb_user_completion_model_insert_infos (CbUserCompletionModel *self, 44 | CbUserInfo *infos, 45 | guint infos_len); 46 | void cb_user_completion_model_clear (CbUserCompletionModel *self); 47 | 48 | 49 | 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/widgets/FollowButton.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class FollowButton : Gtk.Button { 19 | private bool _following = false; 20 | public bool following { 21 | get { return _following; } 22 | set { 23 | var sc = this.get_style_context (); 24 | if (value) { 25 | sc.remove_class ("suggested-action"); 26 | sc.add_class ("destructive-action"); 27 | this.stack.visible_child = unfollow_label; 28 | } else { 29 | sc.remove_class ("destructive-action"); 30 | sc.add_class ("suggested-action"); 31 | this.stack.visible_child = follow_label; 32 | } 33 | this._following = value; 34 | } 35 | } 36 | private Gtk.Stack stack; 37 | private Gtk.Label follow_label; 38 | private Gtk.Label unfollow_label; 39 | 40 | construct { 41 | this.stack = new Gtk.Stack (); 42 | 43 | this.follow_label = new Gtk.Label (_("Follow")); 44 | this.unfollow_label = new Gtk.Label (_("Unfollow")); 45 | 46 | stack.add (follow_label); 47 | stack.add (unfollow_label); 48 | stack.set_interpolate_size (true); 49 | stack.transition_type = Gtk.StackTransitionType.CROSSFADE; 50 | stack.hhomogeneous = false; 51 | stack.vhomogeneous = true; 52 | 53 | this.add (stack); 54 | this.get_style_context ().add_class ("text-button"); 55 | this.get_style_context ().add_class ("suggested-action"); /* Default is false */ 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/rest/rest/oauth-proxy-call.h: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Rob Bradford 6 | * Ross Burton 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms and conditions of the GNU Lesser General Public License, 10 | * version 2.1, as published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #ifndef _OAUTH_PROXY_CALL 24 | #define _OAUTH_PROXY_CALL 25 | 26 | #include "rest-proxy-call.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define OAUTH_TYPE_PROXY_CALL oauth_proxy_call_get_type() 31 | 32 | #define OAUTH_PROXY_CALL(obj) \ 33 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), OAUTH_TYPE_PROXY_CALL, OAuthProxyCall)) 34 | 35 | #define OAUTH_PROXY_CALL_CLASS(klass) \ 36 | (G_TYPE_CHECK_CLASS_CAST ((klass), OAUTH_TYPE_PROXY_CALL, OAuthProxyCallClass)) 37 | 38 | #define OAUTH_IS_PROXY_CALL(obj) \ 39 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OAUTH_TYPE_PROXY_CALL)) 40 | 41 | #define OAUTH_IS_PROXY_CALL_CLASS(klass) \ 42 | (G_TYPE_CHECK_CLASS_TYPE ((klass), OAUTH_TYPE_PROXY_CALL)) 43 | 44 | #define OAUTH_PROXY_CALL_GET_CLASS(obj) \ 45 | (G_TYPE_INSTANCE_GET_CLASS ((obj), OAUTH_TYPE_PROXY_CALL, OAuthProxyCallClass)) 46 | 47 | /** 48 | * OAuthProxyCall: 49 | * 50 | * #OAuthProxyCall has no publicly available members. 51 | */ 52 | typedef struct { 53 | RestProxyCall parent; 54 | } OAuthProxyCall; 55 | 56 | typedef struct { 57 | RestProxyCallClass parent_class; 58 | } OAuthProxyCallClass; 59 | 60 | GType oauth_proxy_call_get_type (void); 61 | 62 | void oauth_proxy_call_parse_token_response (OAuthProxyCall *call); 63 | 64 | G_END_DECLS 65 | 66 | #endif /* _OAUTH_PROXY_CALL */ 67 | 68 | -------------------------------------------------------------------------------- /src/widgets/PixbufButton.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class PixbufButton : Gtk.Button { 19 | private Gdk.Texture bg; 20 | private bool _round = false; 21 | public bool round { 22 | get { 23 | return _round; 24 | } 25 | set { 26 | if (value) { 27 | this.get_style_context ().add_class ("pixbuf-button-round"); 28 | } else { 29 | this.get_style_context ().remove_class ("pixbuf-button-round"); 30 | } 31 | _round = value; 32 | } 33 | } 34 | 35 | construct { 36 | get_style_context ().add_class ("pixbuf-button"); 37 | } 38 | 39 | public PixbufButton () {} 40 | 41 | public override void snapshot (Gtk.Snapshot snapshot) { 42 | if (this.bg == null) { 43 | return; 44 | } 45 | 46 | int widget_width = this.get_width (); 47 | int widget_height = this.get_height (); 48 | 49 | Graphene.Rect bounds = {}; 50 | bounds.origin.x = 0; 51 | bounds.origin.y = 0; 52 | bounds.size.width = widget_width; 53 | bounds.size.height = widget_height; 54 | 55 | if (_round) { 56 | Gsk.RoundedRect round_clip = {}; 57 | round_clip.init_from_rect (bounds, widget_width); // radius = width => round. 58 | snapshot.push_rounded_clip (round_clip); 59 | } 60 | 61 | snapshot.append_texture (this.bg, bounds); 62 | 63 | if (_round) { 64 | snapshot.pop (); 65 | } 66 | } 67 | 68 | public void set_bg (Gdk.Texture texture) { 69 | this.bg = texture; 70 | this.queue_draw (); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/CbBundleHistory.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_BUNDLE_HISTORY_H__ 19 | #define __CB_BUNDLE_HISTORY_H__ 20 | 21 | #include 22 | #include "CbBundle.h" 23 | 24 | #define HISTORY_SIZE 10 25 | 26 | struct _CbBundleHistory 27 | { 28 | GObject parent_instance; 29 | 30 | int pos; 31 | int elements[HISTORY_SIZE]; 32 | CbBundle *bundles[HISTORY_SIZE]; 33 | }; 34 | 35 | typedef struct _CbBundleHistory CbBundleHistory; 36 | 37 | #define CB_TYPE_BUNDLE_HISTORY cb_bundle_history_get_type () 38 | G_DECLARE_FINAL_TYPE (CbBundleHistory, cb_bundle_history, CB, BUNDLE_HISTORY, GObject); 39 | 40 | 41 | CbBundleHistory * cb_bundle_history_new (void); 42 | void cb_bundle_history_push (CbBundleHistory *self, 43 | int v, 44 | CbBundle *bundle); 45 | int cb_bundle_history_back (CbBundleHistory *self); 46 | int cb_bundle_history_forward (CbBundleHistory *self); 47 | gboolean cb_bundle_history_at_start (CbBundleHistory *self); 48 | gboolean cb_bundle_history_at_end (CbBundleHistory *self); 49 | void cb_bundle_history_remove_current (CbBundleHistory *self); 50 | int cb_bundle_history_get_current (CbBundleHistory *self); 51 | CbBundle * cb_bundle_history_get_current_bundle (CbBundleHistory *self); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/rest/rest/rest-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * librest - RESTful web services access 3 | * Copyright (c) 2008, 2009, Intel Corporation. 4 | * 5 | * Authors: Rob Bradford 6 | * Ross Burton 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms and conditions of the GNU Lesser General Public License, 10 | * version 2.1, as published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #ifndef _REST_PRIVATE 24 | #define _REST_PRIVATE 25 | 26 | #include 27 | #include "rest-proxy.h" 28 | #include "rest-proxy-call.h" 29 | #include 30 | 31 | G_BEGIN_DECLS 32 | 33 | typedef enum 34 | { 35 | REST_DEBUG_PROXY = 1 << 1, 36 | REST_DEBUG_ALL = REST_DEBUG_PROXY 37 | } RestDebugFlags; 38 | 39 | extern guint rest_debug_flags; 40 | 41 | #define REST_DEBUG_ENABLED(category) (rest_debug_flags & REST_DEBUG_##category) 42 | 43 | #define REST_DEBUG(category,x,a...) G_STMT_START { \ 44 | if (REST_DEBUG_ENABLED(category)) \ 45 | { g_message ("[" #category "] " G_STRLOC ": " x, ##a); } \ 46 | } G_STMT_END 47 | 48 | void _rest_setup_debugging (void); 49 | 50 | gboolean _rest_proxy_get_binding_required (RestProxy *proxy); 51 | const gchar *_rest_proxy_get_bound_url (RestProxy *proxy); 52 | void _rest_proxy_queue_message (RestProxy *proxy, 53 | SoupMessage *message, 54 | SoupSessionCallback callback, 55 | gpointer user_data); 56 | void _rest_proxy_cancel_message (RestProxy *proxy, 57 | SoupMessage *message); 58 | 59 | G_END_DECLS 60 | #endif /* _REST_PRIVATE */ 61 | -------------------------------------------------------------------------------- /src/CbTextView.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_TEXT_VIEW_H__ 19 | #define __CB_TEXT_VIEW_H__ 20 | 21 | #include 22 | #include "CbUserCompletionModel.h" 23 | #include "CbAnimation.h" 24 | 25 | struct _CbTextView 26 | { 27 | GtkWidget parent_instance; 28 | 29 | void *account; 30 | 31 | GtkWidget *text_view; 32 | GtkWidget *scrolled_window; 33 | GtkWidget *box; 34 | 35 | /* Completion */ 36 | char *completion_word; 37 | CbAnimation completion_show_animation; 38 | double completion_show_factor; 39 | GCancellable *completion_cancellable; 40 | GtkWidget *completion_listbox; 41 | GtkWidget *completion_scroller; 42 | CbUserCompletionModel *completion_model; 43 | int selected_row; 44 | }; 45 | 46 | #define CB_TYPE_TEXT_VIEW cb_text_view_get_type () 47 | G_DECLARE_FINAL_TYPE (CbTextView, cb_text_view, CB, TEXT_VIEW, GtkWidget); 48 | 49 | 50 | GtkWidget * cb_text_view_new (void); 51 | void cb_text_view_set_account (CbTextView *self, 52 | void *acc); 53 | void cb_text_view_add_widget (CbTextView *self, 54 | GtkWidget *widget); 55 | void cb_text_view_insert_at_cursor (CbTextView *self, 56 | const char *text); 57 | void cb_text_view_set_text (CbTextView *self, 58 | const char *text); 59 | char * cb_text_view_get_text (CbTextView *self); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/CbBundle.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef _CB_BUNDLE_H_ 19 | #define _CB_BUNDLE_H_ 20 | 21 | #include 22 | 23 | /* 24 | * TODO: 25 | * Make every CbBundle instance take a fixed amount of data instead 26 | * of keeping two GArrays around. The keys are already required to be 27 | * integers, so just also require them to be subsequent integers starting 28 | * from 0 and just them as indeces into an array. 29 | */ 30 | 31 | struct _CbBundle 32 | { 33 | GObject parent_instance; 34 | 35 | GArray *values; 36 | GArray *keys; 37 | }; 38 | 39 | typedef struct _CbBundle CbBundle; 40 | 41 | #define CB_TYPE_BUNDLE cb_bundle_get_type () 42 | G_DECLARE_FINAL_TYPE (CbBundle, cb_bundle, CB, BUNDLE, GObject); 43 | 44 | CbBundle * cb_bundle_new (void); 45 | gboolean cb_bundle_equals (CbBundle *self, CbBundle *other); 46 | void cb_bundle_put_string (CbBundle *self, int key, const char *val); 47 | const char * cb_bundle_get_string (CbBundle *self, int key); 48 | void cb_bundle_put_int (CbBundle *self, int key, int val); 49 | int cb_bundle_get_int (CbBundle *self, int key); 50 | void cb_bundle_put_int64 (CbBundle *self, int key, gint64 val); 51 | gint64 cb_bundle_get_int64 (CbBundle *self, int key); 52 | void cb_bundle_put_bool (CbBundle *self, int key, gboolean val); 53 | gboolean cb_bundle_get_bool (CbBundle *self, int key); 54 | void cb_bundle_put_object (CbBundle *self, int key, GObject *object); 55 | GObject * cb_bundle_get_object (CbBundle *self, int key); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/CbComposeImages.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2018 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_COMPOSE_IMAGES_H__ 19 | #define __CB_COMPOSE_IMAGES_H__ 20 | 21 | #include 22 | #include "CbAnimation.h" 23 | 24 | typedef struct _CbComposeImages CbComposeImages; 25 | struct _CbComposeImages 26 | { 27 | GtkWidget parent_instance; 28 | 29 | GArray *images; 30 | CbAnimation delete_animation; 31 | }; 32 | 33 | #define CB_TYPE_COMPOSE_IMAGES cb_compose_images_get_type () 34 | G_DECLARE_FINAL_TYPE (CbComposeImages, cb_compose_images, CB, COMPOSE_IMAGES, GtkWidget); 35 | 36 | GType cb_compose_images_get_type (void) G_GNUC_CONST; 37 | void cb_compose_images_load_image (CbComposeImages *self, 38 | const char *image_path); 39 | void cb_compose_images_set_image_progress (CbComposeImages *self, 40 | const char *image_path, 41 | double progress); 42 | void cb_compose_images_end_image_progress (CbComposeImages *self, 43 | const char *image_path, 44 | const char *error_message); 45 | int cb_compose_images_get_n_images (CbComposeImages *self); 46 | gboolean cb_compose_images_is_full (CbComposeImages *self); 47 | gboolean cb_compose_images_has_gif (CbComposeImages *self); 48 | 49 | void cb_compose_images_insensitivize_buttons (CbComposeImages *self); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /tests/avatardownload.vala: -------------------------------------------------------------------------------- 1 | 2 | 3 | void simple () { 4 | var loop = new GLib.MainLoop (); 5 | Twitter.get ().init (); 6 | 7 | var avatar_widget = new AvatarWidget (); 8 | Twitter.get ().get_avatar.begin (10, "http://i.imgur.com/GzdoOMu.jpg", 9 | avatar_widget, 48, false, () => { 10 | assert (avatar_widget.texture != null); 11 | 12 | loop.quit (); 13 | }); 14 | 15 | loop.run (); 16 | } 17 | 18 | void cached () { 19 | var loop = new GLib.MainLoop (); 20 | Twitter.get ().init (); 21 | 22 | var avatar_widget = new AvatarWidget (); 23 | var avatar_widget2 = new AvatarWidget (); 24 | Twitter.get ().get_avatar.begin (10, "http://i.imgur.com/GzdoOMu.jpg", 25 | avatar_widget, 48, false, () => { 26 | assert (avatar_widget.texture != null); 27 | 28 | Twitter.get ().get_avatar.begin (10, "http://i.imgur.com/GzdoOMu.jpg", 29 | avatar_widget2, 48, false, () => { 30 | 31 | assert (avatar_widget2.texture != null); 32 | assert (avatar_widget2.texture == avatar_widget.texture); 33 | loop.quit (); 34 | }); 35 | }); 36 | 37 | loop.run (); 38 | } 39 | 40 | void double_download () 41 | { 42 | var loop = new GLib.MainLoop (); 43 | Twitter.get ().init (); 44 | 45 | var avatar_widget = new AvatarWidget (); 46 | var avatar_widget2 = new AvatarWidget (); 47 | Twitter.get ().get_avatar.begin (10, "http://i.imgur.com/GzdoOMu.jpg", 48 | avatar_widget, 48, false, () => { 49 | assert (avatar_widget.texture != null); 50 | loop.quit (); 51 | }); 52 | 53 | Twitter.get ().get_avatar.begin (10, "http://i.imgur.com/GzdoOMu.jpg", 54 | avatar_widget2, 48, false, () => { 55 | assert (avatar_widget2.texture != null); 56 | }); 57 | 58 | loop.run (); 59 | } 60 | 61 | int main (string[] args) { 62 | GLib.Test.init (ref args); 63 | Gtk.init (); 64 | Settings.init (); 65 | Utils.init_soup_session (); 66 | 67 | GLib.Test.add_func ("/avatar-download/simple", simple); 68 | GLib.Test.add_func ("/avatar-download/cached", cached); 69 | GLib.Test.add_func ("/avatar-download/double_download", double_download); 70 | 71 | /* We can't test load_avatar_for_user_id here since we can't 72 | properly use Accounts and their proxies... */ 73 | 74 | 75 | return GLib.Test.run (); 76 | } 77 | -------------------------------------------------------------------------------- /src/NotificationManager.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | public class NotificationManager : GLib.Object { 19 | private unowned Account account; 20 | 21 | public NotificationManager (Account account) { 22 | this.account = account; 23 | } 24 | 25 | public void withdraw (string id) { 26 | GLib.Application.get_default ().withdraw_notification (id); 27 | } 28 | 29 | public string send (string summary, string body, string? id_suffix = null) { 30 | var n = new GLib.Notification (summary); 31 | n.set_body (body); 32 | 33 | string id = "%s-%s".printf (account.id.to_string (), id_suffix ?? ""); 34 | 35 | /* Default action: Bring the account window to the front */ 36 | n.set_default_action_and_target_value ("app.show-window", account.id); 37 | 38 | GLib.Application.get_default ().send_notification (id, n); 39 | 40 | return id; 41 | } 42 | 43 | public string send_dm (int64 sender_id, 44 | string? existing_id, 45 | string summary, 46 | string text) { 47 | if (existing_id != null) { 48 | this.withdraw (existing_id); 49 | } 50 | 51 | string new_id = "new-dm-%s".printf (sender_id.to_string ()); 52 | 53 | var n = new GLib.Notification (summary); 54 | var value = new GLib.Variant.tuple ({new GLib.Variant.int64 (account.id), 55 | new GLib.Variant.int64 (sender_id)}); 56 | n.set_default_action_and_target_value ("app.show-dm-thread", value); 57 | n.set_body (text); 58 | 59 | GLib.Application.get_default ().send_notification (new_id, n); 60 | 61 | return new_id; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/list/DMThreadEntry.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | [GtkTemplate (ui = "/org/baedert/corebird/ui/dm-thread-entry.ui")] 19 | class DMThreadEntry : Gtk.ListBoxRow { 20 | [GtkChild] 21 | private Gtk.Label name_label; 22 | [GtkChild] 23 | private Gtk.Label screen_name_label; 24 | [GtkChild] 25 | private Gtk.Label last_message_label; 26 | [GtkChild] 27 | private AvatarWidget avatar_image; 28 | [GtkChild] 29 | private Gtk.Label unread_count_label; 30 | public int64 user_id; 31 | public new string name { 32 | set { 33 | name_label.label = value; 34 | } 35 | } 36 | public string screen_name { 37 | set { 38 | screen_name_label.label = "@" + value; 39 | } 40 | } 41 | public string last_message { 42 | set { 43 | last_message_label.label = value; 44 | } 45 | } 46 | public Gdk.Texture? avatar { 47 | set { avatar_image.texture = value;} 48 | } 49 | 50 | private int _unread_count = 0; 51 | public int unread_count { 52 | get { 53 | return this._unread_count; 54 | } 55 | set { 56 | this._unread_count = value; 57 | this.update_unread_count (); 58 | } 59 | } 60 | 61 | public DMThreadEntry (int64 user_id) { 62 | this.user_id = user_id; 63 | update_unread_count (); 64 | } 65 | 66 | private void update_unread_count () { 67 | if (unread_count == 0) 68 | unread_count_label.hide (); 69 | else { 70 | unread_count_label.show (); 71 | unread_count_label.label = ngettext ("(%d unread)", 72 | "(%d unread)", 73 | unread_count).printf(unread_count); 74 | } 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/list/UserFilterEntry.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | [GtkTemplate (ui = "/org/baedert/corebird/ui/user-filter-entry.ui")] 19 | class UserFilterEntry : Gtk.ListBoxRow { 20 | [GtkChild] 21 | private Gtk.Label name_label; 22 | [GtkChild] 23 | private Gtk.Label screen_name_label; 24 | [GtkChild] 25 | private AvatarWidget avatar_image; 26 | [GtkChild] 27 | private Gtk.Stack stack; 28 | [GtkChild] 29 | private Gtk.Box delete_box; 30 | [GtkChild] 31 | private Gtk.Grid grid; 32 | [GtkChild] 33 | private Gtk.Revealer revealer; 34 | 35 | public new string name { 36 | set { name_label.label = value; } 37 | } 38 | 39 | public string screen_name { 40 | set { screen_name_label.label = "@" + value; } 41 | } 42 | 43 | public string avatar_url { 44 | set { real_set_avatar (value); } 45 | } 46 | 47 | public bool seen { 48 | get { return true; } 49 | set {} 50 | } 51 | 52 | public int64 user_id; 53 | 54 | public signal void deleted (int64 id); 55 | 56 | public bool muted = false; 57 | public bool blocked = false; 58 | 59 | private void real_set_avatar (string avatar_url) { 60 | Twitter.get ().get_avatar.begin (user_id, avatar_url, avatar_image, 48 * this.get_scale_factor ()); 61 | } 62 | 63 | [GtkCallback] 64 | private void menu_button_clicked_cb () { 65 | stack.visible_child = delete_box; 66 | } 67 | 68 | [GtkCallback] 69 | private void cancel_button_clicked_cb () { 70 | stack.visible_child = grid; 71 | } 72 | 73 | [GtkCallback] 74 | private void delete_button_clicked_cb () { 75 | revealer.reveal_child = false; 76 | revealer.notify["child-revealed"].connect (() => { 77 | deleted (user_id); 78 | }); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/list/SnippetListEntry.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class SnippetListEntry : Gtk.ListBoxRow { 19 | private Gtk.Label key_label; 20 | private Gtk.Label value_label; 21 | private Gtk.Revealer revealer; 22 | public string key { 23 | get { 24 | return key_label.label; 25 | } 26 | set { 27 | key_label.label = value; 28 | } 29 | } 30 | public string value { 31 | get { 32 | return value_label.label; 33 | } 34 | set { 35 | value_label.label = value; 36 | } 37 | } 38 | 39 | public SnippetListEntry (string key, string value) { 40 | this.revealer = new Gtk.Revealer (); 41 | revealer.reveal_child = true; 42 | var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 12); 43 | box.margin_start = box.margin_end = box.margin_top = box.margin_bottom = 6; 44 | box.homogeneous = true; 45 | 46 | key_label = new Gtk.Label (key); 47 | key_label.halign = Gtk.Align.START; 48 | key_label.hexpand = true; 49 | key_label.ellipsize = Pango.EllipsizeMode.END; 50 | box.add (key_label); 51 | 52 | value_label = new Gtk.Label (value); 53 | value_label.halign = Gtk.Align.START; 54 | value_label.hexpand = true; 55 | value_label.xalign = 0; 56 | value_label.ellipsize = Pango.EllipsizeMode.END; 57 | box.add (value_label); 58 | 59 | revealer.add (box); 60 | this.add (revealer); 61 | this.get_style_context ().add_class ("border-bottom"); 62 | } 63 | 64 | public void reveal () { 65 | revealer.notify["child-revealed"].connect (() => { 66 | if (!revealer.child_revealed) { 67 | ((Gtk.Container)this.get_parent ()).remove (this); 68 | } 69 | }); 70 | revealer.reveal_child = false; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /ui/media-dialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 60 | 61 | -------------------------------------------------------------------------------- /src/CbTweetRow.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_TWEET_ROW_H__ 19 | #define __CB_TWEET_ROW_H__ 20 | 21 | #include 22 | #include "CbTweet.h" 23 | #include "CbMainWindow.h" 24 | 25 | struct _CbTweetRow 26 | { 27 | GtkListBoxRow parent_instance; 28 | 29 | gulong tweet_state_changed_id; 30 | 31 | CbTweet *tweet; 32 | void *main_window; // TODO: Make this an actual typed pointer 33 | 34 | GtkWidget *avatar_widget; 35 | GtkWidget *name_button; 36 | GtkWidget *screen_name_label; 37 | GtkWidget *time_delta_label; 38 | GtkWidget *text_label; 39 | GtkWidget *top_row_box; 40 | 41 | /* Only conditionally created widgets */ 42 | GtkWidget *rt_image; 43 | GtkWidget *rt_label; 44 | GtkWidget *reply_label; 45 | GtkWidget *mm_widget; 46 | GtkWidget *quote_box; 47 | GtkWidget *quote_widget; 48 | 49 | GTimeSpan last_timediff; 50 | }; 51 | typedef struct _CbTweetRow CbTweetRow; 52 | 53 | 54 | #define CB_TYPE_TWEET_ROW cb_tweet_row_get_type () 55 | G_DECLARE_FINAL_TYPE (CbTweetRow, cb_tweet_row, CB, TWEET_ROW, GtkListBoxRow); 56 | 57 | GtkWidget * cb_tweet_row_new (CbTweet *tweet, 58 | CbMainWindow *main_window); 59 | void cb_tweet_row_set_tweet (CbTweetRow *self, 60 | CbTweet *tweet); 61 | void cb_tweet_row_toggle_mode (CbTweetRow *self); 62 | gboolean cb_tweet_row_shows_actions (CbTweetRow *self); 63 | void cb_tweet_row_set_read_only (CbTweetRow *self); 64 | void cb_tweet_row_set_avatar (CbTweetRow *self, 65 | GdkTexture *avatar); 66 | #endif 67 | -------------------------------------------------------------------------------- /src/rest/README: -------------------------------------------------------------------------------- 1 | librest 2 | ======= 3 | 4 | This library has been designed to make it easier to access web services that 5 | claim to be "RESTful". A reasonable definition of what this means can be found 6 | on Wikipedia [1]. However a reasonable description is that a RESTful service 7 | should have urls that represent remote objects which methods can then be 8 | called on. 9 | 10 | However it should be noted that the majority of services don't actually adhere 11 | to this strict definition. Instead their RESTful end-point usually has an API 12 | that is just simpler to use compared to other types of APIs they may support 13 | (XML-RPC, for instance.). It is this kind of API that this library is 14 | attempting to support. 15 | 16 | It comprises of two parts: the first aims to make it easier to make requests 17 | by providing a wrapper around libsoup [2], the second aids with XML parsing by 18 | wrapping libxml2 [3]. 19 | 20 | Making requests 21 | ~~~~~~~~~~~~~~~ 22 | 23 | When a proxy is created for a url you are able to present a format string. 24 | This format string is intended to represent the type of path for a remote 25 | object, it is then possible to bind this format string with specific names of 26 | objects to make this proxy concrete rather than abstract. We abstract the 27 | parameters required for a particular call into it's own object which we can 28 | then invoke both asynchronously and pseudo-asynchronously (by spinning the 29 | main loop whilst waiting for an answer.) This has the advantage of allowing us 30 | to support complex behaviour that depends on the parameters, for instance 31 | signing a request: a requirement for many web services. 32 | 33 | Handling the result 34 | ~~~~~~~~~~~~~~~~~~~ 35 | 36 | Standard XML parsers require a significant amount of work to parse a piece of 37 | XML. In terms of a SAX parser this involves setting up the functions before 38 | hand, in terms of a DOM parser this means dealing with complexity of a DOM 39 | tree. The XML parsing components of librest are designed to try and behave a 40 | bit like the BeautifulSoup parser [4]. It does this by parsing the XML into an 41 | easily walkable tree were nodes have children for their descendents and 42 | siblings for the nodes of the same type that share the same parent. This makes 43 | it easy for instance to get a list of all the "photo" nodes in a document from 44 | the root. 45 | 46 | [1] - http://en.wikipedia.org/wiki/Representational_State_Transfer 47 | [2] - http://live.gnome.org/LibSoup 48 | [3] - http://xmlsoft.org/ 49 | [4] - http://www.crummy.com/software/BeautifulSoup/ 50 | -------------------------------------------------------------------------------- /src/CbMediaDownloader.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2016 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef _CB_INLINE_MEDIA_DOWNLOADER_H_ 19 | #define _CB_INLINE_MEDIA_DOWNLOADER_H_ 20 | 21 | #include 22 | #include 23 | #include "CbMedia.h" 24 | #include "CbTypes.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | struct _CbMediaDownloader 29 | { 30 | GObject parent_instance; 31 | 32 | GCancellable *cancellable; 33 | guint disabled : 1; 34 | }; 35 | 36 | typedef struct _CbMediaDownloader CbMediaDownloader; 37 | 38 | #define CB_TYPE_MEDIA_DOWNLOADER (cb_media_downloader_get_type ()) 39 | G_DECLARE_FINAL_TYPE (CbMediaDownloader, cb_media_downloader, CB, MEDIA_DOWNLOADER, GObject); 40 | 41 | CbMediaDownloader * cb_media_downloader_get_default (void); 42 | void cb_media_downloader_load_all (CbMediaDownloader *downloader, 43 | CbMiniTweet *t); 44 | void cb_media_downloader_load_async (CbMediaDownloader *downloader, 45 | CbMedia *media, 46 | GAsyncReadyCallback callback, 47 | gpointer user_data); 48 | gboolean cb_media_downloader_load_finish (CbMediaDownloader *downloader, 49 | GAsyncResult *result, 50 | GError **error); 51 | void cb_media_downloader_disable (CbMediaDownloader *downloader); 52 | void cb_media_downloader_shutdown (CbMediaDownloader *downloader); 53 | gboolean is_media_candidate (const char *url); 54 | 55 | G_END_DECLS 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /data/symbolic/apps/corebird-profile-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 40 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 65 | 67 | 72 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/CbScrollWidget.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2019 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_SCROLL_WIDGET_H__ 19 | #define __CB_SCROLL_WIDGET_H__ 20 | 21 | #include 22 | 23 | #define CB_TYPE_SCROLL_WIDGET cb_scroll_widget_get_type () 24 | G_DECLARE_DERIVABLE_TYPE (CbScrollWidget, cb_scroll_widget, CB, SCROLL_WIDGET, GtkWidget); 25 | 26 | struct _CbScrollWidgetClass 27 | { 28 | GtkWidgetClass parent_class; 29 | }; 30 | 31 | 32 | GType cb_scroll_widget_get_type (void) G_GNUC_CONST; 33 | GtkWidget * cb_scroll_widget_new (void); 34 | 35 | void cb_scroll_widget_set_policy (CbScrollWidget *self, 36 | GtkPolicyType hscroll_policy, 37 | GtkPolicyType vscroll_policy); 38 | gboolean cb_scroll_widget_scrolled_down (CbScrollWidget *self); 39 | gboolean cb_scroll_widget_scrolled_up (CbScrollWidget *self); 40 | void cb_scroll_widget_scroll_down_next (CbScrollWidget *self, 41 | gboolean animate, 42 | gboolean force_start); 43 | void cb_scroll_widget_scroll_up_next (CbScrollWidget *self, 44 | gboolean animate, 45 | gboolean force_start); 46 | void cb_scroll_widget_balance_next_upper_change (CbScrollWidget *self, 47 | int mode); 48 | GtkAdjustment * cb_scroll_widget_get_vadjustment (CbScrollWidget *self); 49 | 50 | void cb_scroll_widget_add (CbScrollWidget *self, GtkWidget *child); 51 | #endif 52 | -------------------------------------------------------------------------------- /src/CbUserStream.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_USER_STREAM_H__ 19 | #define __CB_USER_STREAM_H__ 20 | 21 | #include 22 | #include "rest/rest/rest-proxy.h" 23 | #include "CbMessageReceiver.h" 24 | #include "CbTypes.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | #define CB_TYPE_USER_STREAM (cb_user_stream_get_type ()) 29 | G_DECLARE_FINAL_TYPE (CbUserStream, cb_user_stream, CB, USER_STREAM, GObject); 30 | 31 | struct _CbUserStream 32 | { 33 | GObject parent_instance; 34 | 35 | GString *data; 36 | GPtrArray *receivers; 37 | RestProxy *proxy; 38 | RestProxyCall *proxy_call; 39 | GNetworkMonitor *network_monitor; 40 | 41 | guint network_timeout_id; 42 | guint heartbeat_timeout_id; 43 | guint network_changed_id; 44 | 45 | char *account_name; 46 | 47 | guint state; 48 | guint restarting : 1; 49 | guint proxy_data_set : 1; 50 | guint network_available: 1; 51 | 52 | guint stresstest : 1; 53 | }; 54 | typedef struct _CbUserStream CbUserStream; 55 | 56 | CbUserStream * cb_user_stream_new (const char *account_name, 57 | gboolean stresstest); 58 | void cb_user_stream_set_proxy_data (CbUserStream *self, 59 | const char *token, 60 | const char *token_secret); 61 | void cb_user_stream_register (CbUserStream *self, 62 | CbMessageReceiver *receiver); 63 | void cb_user_stream_unregister (CbUserStream *self, 64 | CbMessageReceiver *receiver); 65 | void cb_user_stream_start (CbUserStream *self); 66 | void cb_user_stream_stop (CbUserStream *self); 67 | void cb_user_stream_push_data (CbUserStream *self, 68 | const char *data); 69 | 70 | G_END_DECLS; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/CbTweetListBox.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2018 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_TWEET_LIST_BOX_H__ 19 | #define __CB_TWEET_LIST_BOX_H__ 20 | 21 | #include 22 | #include "CbDeltaUpdater.h" 23 | #include "CbTweetModel.h" 24 | 25 | typedef struct _CbTweetListBox CbTweetListBox; 26 | struct _CbTweetListBox 27 | { 28 | GtkWidget parent_instance; 29 | 30 | GtkWidget *widget; 31 | 32 | void *account; 33 | 34 | CbTweetModel *model; 35 | CbDeltaUpdater *delta_updater; 36 | GtkWidget *placeholder; 37 | GtkWidget *error_label; 38 | GtkWidget *no_entries_label; 39 | 40 | GtkWidget *action_entry; 41 | }; 42 | 43 | #define CB_TYPE_TWEET_LIST_BOX cb_tweet_list_box_get_type () 44 | G_DECLARE_FINAL_TYPE (CbTweetListBox, cb_tweet_list_box, CB, TWEET_LIST_BOX, GtkWidget); 45 | 46 | CbTweetListBox * cb_tweet_list_box_new (void); 47 | GtkWidget * cb_tweet_list_box_get_widget (CbTweetListBox *self); 48 | void cb_tweet_list_box_set_account (CbTweetListBox *self, 49 | void *account); 50 | void cb_tweet_list_box_set_empty (CbTweetListBox *self); 51 | void cb_tweet_list_box_set_unempty (CbTweetListBox *self); 52 | void cb_tweet_list_box_set_error (CbTweetListBox *self, 53 | const char *error_message); 54 | void cb_tweet_list_box_set_placeholder_text (CbTweetListBox *self, 55 | const char *placeholder_text); 56 | void cb_tweet_list_box_reset_placeholder_text (CbTweetListBox *self); 57 | GtkWidget * cb_tweet_list_box_get_first_visible_row (CbTweetListBox *self); 58 | GtkWidget * cb_tweet_list_box_get_placeholder (CbTweetListBox *self); 59 | void cb_tweet_list_box_remove_all (CbTweetListBox *self); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/CbUserCounter.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_USER_COUNTER_H__ 19 | #define __CB_USER_COUNTER_H__ 20 | 21 | #include 22 | #include 23 | 24 | #include "CbTypes.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | 29 | typedef struct _CbUserInfo CbUserInfo; 30 | struct _CbUserInfo 31 | { 32 | gint64 user_id; 33 | char *screen_name; 34 | char *user_name; 35 | guint score; 36 | guint changed : 1; 37 | }; 38 | 39 | 40 | typedef struct _CbUserCounter CbUserCOunter; 41 | struct _CbUserCounter 42 | { 43 | GObject parent_instance; 44 | 45 | guint changed : 1; 46 | GArray *user_infos; 47 | }; 48 | 49 | #define CB_TYPE_USER_COUNTER cb_user_counter_get_type () 50 | G_DECLARE_FINAL_TYPE (CbUserCounter, cb_user_counter, CB, USER_COUNTER, GObject); 51 | 52 | 53 | CbUserCounter * cb_user_counter_new (void); 54 | void cb_user_counter_id_seen (CbUserCounter *counter, 55 | const CbUserIdentity *id); 56 | void cb_user_counter_user_seen (CbUserCounter *counter, 57 | gint64 user_id, 58 | const char *screen_name, 59 | const char *user_name); 60 | int cb_user_counter_save (CbUserCounter *counter, 61 | sqlite3 *db); 62 | void cb_user_counter_query_by_prefix (CbUserCounter *counter, 63 | sqlite3 *db, 64 | const char *prefix, 65 | guint max_results, 66 | CbUserInfo **results, 67 | int *n_results); 68 | 69 | /* CbUserInfo */ 70 | void cb_user_info_destroy (CbUserInfo *info); 71 | 72 | G_END_DECLS 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /data/play.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 38 | 40 | 41 | 43 | image/svg+xml 44 | 46 | 47 | 48 | 49 | 50 | 55 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /config.h.meson: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if translation of program messages to the user's native 4 | language is requested. */ 5 | #mesondefine ENABLE_NLS 6 | 7 | /* Gettext Package */ 8 | #mesondefine GETTEXT_PACKAGE 9 | 10 | /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the 11 | CoreFoundation framework. */ 12 | #mesondefine HAVE_CFLOCALECOPYCURRENT 13 | 14 | /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in 15 | the CoreFoundation framework. */ 16 | #mesondefine HAVE_CFPREFERENCESCOPYAPPVALUE 17 | 18 | /* Define if the GNU dcgettext() function is already present or preinstalled. 19 | */ 20 | #mesondefine HAVE_DCGETTEXT 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #mesondefine HAVE_DLFCN_H 24 | 25 | /* Define if the GNU gettext() function is already present or preinstalled. */ 26 | #mesondefine HAVE_GETTEXT 27 | 28 | /* Define if you have the iconv() function and it works. */ 29 | #mesondefine HAVE_ICONV 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #mesondefine HAVE_INTTYPES_H 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #mesondefine HAVE_MEMORY_H 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #mesondefine HAVE_STDINT_H 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #mesondefine HAVE_STDLIB_H 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #mesondefine HAVE_STRINGS_H 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #mesondefine HAVE_STRING_H 48 | 49 | /* Define to 1 if you have the header file. */ 50 | #mesondefine HAVE_SYS_STAT_H 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #mesondefine HAVE_SYS_TYPES_H 54 | 55 | /* Define to 1 if you have the header file. */ 56 | #mesondefine HAVE_UNISTD_H 57 | 58 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 59 | #mesondefine LT_OBJDIR 60 | 61 | /* Name of package */ 62 | #mesondefine PACKAGE 63 | 64 | /* Define to the address where bug reports for this package should be sent. */ 65 | #mesondefine PACKAGE_BUGREPORT 66 | 67 | /* Define to the full name of this package. */ 68 | #mesondefine PACKAGE_NAME 69 | 70 | /* Define to the full name and version of this package. */ 71 | #mesondefine PACKAGE_STRING 72 | 73 | /* Define to the one symbol short name of this package. */ 74 | #mesondefine PACKAGE_TARNAME 75 | 76 | /* Define to the home page for this package. */ 77 | #mesondefine PACKAGE_URL 78 | 79 | /* Define to the version of this package. */ 80 | #mesondefine PACKAGE_VERSION 81 | 82 | /* Define to 1 if you have the ANSI C header files. */ 83 | #mesondefine STDC_HEADERS 84 | 85 | /* Version number of package */ 86 | #mesondefine VERSION 87 | -------------------------------------------------------------------------------- /data/symbolic/apps/corebird-filter-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 41 | 48 | 49 | 51 | 52 | 54 | image/svg+xml 55 | 57 | 58 | 59 | 60 | 61 | 66 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /data/symbolic/apps/corebird-conversation-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 41 | 48 | 49 | 51 | 52 | 54 | image/svg+xml 55 | 57 | 58 | 59 | 60 | 61 | 66 | 72 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /ui/search-page.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 48 | 49 | 6 50 | 6 51 | 1 52 | 0 53 | Tweets 54 | 55 | 56 | 57 | 58 | 59 | 60 | 6 61 | 6 62 | 1 63 | 0 64 | Users 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/list/FilterListEntry.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | [GtkTemplate (ui = "/org/baedert/corebird/ui/filter-list-entry.ui")] 18 | class FilterListEntry : Gtk.ListBoxRow { 19 | [GtkChild] 20 | private Gtk.Label content_label; 21 | [GtkChild] 22 | private Gtk.Revealer revealer; 23 | [GtkChild] 24 | private Gtk.Stack stack; 25 | [GtkChild] 26 | private Gtk.Grid normal_box; 27 | [GtkChild] 28 | private Gtk.Box delete_box; 29 | 30 | private unowned Cb.Filter _filter; 31 | public unowned Cb.Filter filter { 32 | set { 33 | content_label.label = value.get_contents (); 34 | _filter = value; 35 | } 36 | get { 37 | return _filter; 38 | } 39 | } 40 | public string content { 41 | set { 42 | content_label.label = value; 43 | } 44 | get { 45 | return content_label.label; 46 | } 47 | } 48 | private unowned Account account; 49 | private unowned Cb.MainWindow main_window; 50 | 51 | public FilterListEntry (Cb.Filter f, 52 | Account account, 53 | Cb.MainWindow main_window) { 54 | this.filter = f; 55 | this.account = account; 56 | this.main_window = main_window; 57 | } 58 | 59 | construct { 60 | revealer.notify["child-revealed"].connect (() => { 61 | if (!revealer.child_revealed) { 62 | ((Gtk.Container)this.get_parent ()).remove (this); 63 | } 64 | }); 65 | } 66 | 67 | [GtkCallback] 68 | private void menu_button_clicked_cb () { 69 | stack.visible_child = delete_box; 70 | this.activatable = false; 71 | } 72 | 73 | [GtkCallback] 74 | private void cancel_button_clicked_cb () { 75 | stack.visible_child = normal_box; 76 | this.activatable = true; 77 | } 78 | 79 | [GtkCallback] 80 | private void delete_button_clicked_cb () { 81 | for (int i = 0; i < account.filters.length; i ++) { 82 | var f = account.filters.get (i); 83 | if (f.get_id () == this.filter.get_id ()) { 84 | account.filters.remove (f); 85 | account.db.exec ("DELETE FROM `filters` WHERE `id`='%d'".printf (f.get_id ())); 86 | revealer.reveal_child = false; 87 | main_window.rerun_filters (); 88 | return; 89 | } 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/CbMainWindow.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2018 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef __CB_MAIN_WINDOW_H__ 19 | #define __CB_MAIN_WINDOW_H__ 20 | 21 | #include 22 | 23 | typedef struct _CbMainWindow CbMainWindow; 24 | struct _CbMainWindow 25 | { 26 | GtkApplicationWindow parent_instance; 27 | 28 | GtkWidget *headerbar; 29 | GtkWidget *main_widget; 30 | GtkWidget *title_stack; 31 | GtkWidget *title_label; 32 | GtkWidget *last_page_label; 33 | GtkWidget *account_button; 34 | GtkWidget *avatar_widget; 35 | GtkWidget *compose_tweet_button; 36 | GtkWidget *back_button; 37 | GtkWidget *accounts_popover; 38 | GtkWidget *accounts_list; 39 | GtkWidget *header_box; /* Box in the upper left, showing those 3 buttons. */ 40 | GtkWidget *app_menu_button; 41 | 42 | GtkWidget *compose_window; 43 | 44 | void *account; /* XXX should be Account instance */ 45 | }; 46 | 47 | #define CB_TYPE_MAIN_WINDOW (cb_main_window_get_type ()) 48 | G_DECLARE_FINAL_TYPE (CbMainWindow, cb_main_window, CB, MAIN_WINDOW, GtkApplicationWindow); 49 | 50 | GtkWidget * cb_main_window_new (void *account); 51 | void cb_main_window_change_account (CbMainWindow *self, 52 | void *account); 53 | void cb_main_window_set_window_title (CbMainWindow *self, 54 | const char *title, 55 | GtkStackTransitionType transition_type); 56 | void cb_main_window_rerun_filters (CbMainWindow *self); 57 | void cb_main_window_save_geometry (CbMainWindow *self); 58 | void cb_main_window_reply_to_tweet (CbMainWindow *self, 59 | gint64 tweet_id); 60 | void cb_main_window_mark_tweet_as_read (CbMainWindow *self, 61 | gint64 tweet_id); 62 | int cb_main_window_get_cur_page_id (CbMainWindow *self); 63 | void * cb_main_window_get_page (CbMainWindow *self, 64 | int page_id); 65 | 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/CbTwitterItem.c: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #include "CbTwitterItem.h" 19 | 20 | 21 | G_DEFINE_INTERFACE (CbTwitterItem, cb_twitter_item, G_TYPE_OBJECT); 22 | 23 | 24 | static int 25 | default_update_time_delta (CbTwitterItem *self, 26 | GDateTime *now) 27 | { 28 | /* NOPE */ 29 | return 0; 30 | } 31 | 32 | static void 33 | cb_twitter_item_default_init (CbTwitterItemInterface *self) 34 | { 35 | self->get_sort_factor = NULL; 36 | self->update_time_delta = default_update_time_delta; 37 | self->get_timestamp = NULL; 38 | self->set_last_set_timediff = NULL; 39 | self->get_last_set_timediff = NULL; 40 | } 41 | 42 | gint64 43 | cb_twitter_item_get_sort_factor (CbTwitterItem *self) 44 | { 45 | CbTwitterItemInterface *iface; 46 | 47 | g_return_val_if_fail (CB_IS_TWITTER_ITEM (self), 0); 48 | 49 | iface = CB_TWITTER_ITEM_GET_IFACE (self); 50 | 51 | return iface->get_sort_factor (self); 52 | } 53 | 54 | int 55 | cb_twitter_item_update_time_delta (CbTwitterItem *self, 56 | GDateTime *now) 57 | { 58 | CbTwitterItemInterface *iface; 59 | 60 | g_return_val_if_fail (CB_IS_TWITTER_ITEM (self), 0); 61 | 62 | iface = CB_TWITTER_ITEM_GET_IFACE (self); 63 | 64 | return iface->update_time_delta (self, now); 65 | } 66 | 67 | gint64 68 | cb_twitter_item_get_timestamp (CbTwitterItem *self) 69 | { 70 | CbTwitterItemInterface *iface; 71 | 72 | g_return_val_if_fail (CB_IS_TWITTER_ITEM (self), 0); 73 | 74 | iface = CB_TWITTER_ITEM_GET_IFACE (self); 75 | 76 | return iface->get_timestamp (self); 77 | } 78 | 79 | void 80 | cb_twitter_item_set_last_set_timediff (CbTwitterItem *self, 81 | GTimeSpan span) 82 | { 83 | CbTwitterItemInterface *iface; 84 | 85 | g_return_if_fail (CB_IS_TWITTER_ITEM (self)); 86 | 87 | iface = CB_TWITTER_ITEM_GET_IFACE (self); 88 | 89 | iface->set_last_set_timediff (self, span); 90 | } 91 | 92 | GTimeSpan 93 | cb_twitter_item_get_last_set_timediff (CbTwitterItem *self) 94 | { 95 | CbTwitterItemInterface *iface; 96 | 97 | g_return_val_if_fail (CB_IS_TWITTER_ITEM (self), 0); 98 | 99 | iface = CB_TWITTER_ITEM_GET_IFACE (self); 100 | 101 | return iface->get_last_set_timediff (self); 102 | } 103 | -------------------------------------------------------------------------------- /src/CbSnippetManager.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | #ifndef CB_SNIPPET_MANAGER_H 18 | #define CB_SNIPPET_MANAGER_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | struct _CbSnippetManager 26 | { 27 | GObject parent_instance; 28 | 29 | GHashTable *snippets; 30 | sqlite3 *db; 31 | guint inited : 1; 32 | }; 33 | typedef struct _CbSnippetManager CbSnippetManager; 34 | 35 | #define CB_TYPE_SNIPPET_MANAGER cb_snippet_manager_get_type() 36 | G_DECLARE_FINAL_TYPE (CbSnippetManager, cb_snippet_manager, CB, SNIPPET_MANAGER, GObject); 37 | 38 | /* 39 | * TODO: This is only a GObject because we can bind that properly in the vapi, 40 | * but a SnippetManager exists only once and for the entire lifetime of the GtkApplication 41 | * object we have... 42 | */ 43 | 44 | CbSnippetManager * cb_snippet_manager_new (sqlite3 *db); 45 | guint cb_snippet_manager_n_snippets (CbSnippetManager *self); 46 | void cb_snippet_manager_remove_snippet (CbSnippetManager *self, 47 | const char *snippet_key); 48 | void cb_snippet_manager_insert_snippet (CbSnippetManager *self, 49 | const char *key, 50 | const char *value); 51 | gboolean cb_snippet_manager_has_snippet_n (CbSnippetManager *self, 52 | const char *key, 53 | gsize key_length_in_bytes); 54 | const char * cb_snippet_manager_get_snippet (CbSnippetManager *self, 55 | const char *key); 56 | void cb_snippet_manager_query_snippets (CbSnippetManager *self, 57 | GHFunc func, 58 | gpointer user_data); 59 | void cb_snippet_manager_set_snippet (CbSnippetManager *self, 60 | const char *old_key, 61 | const char *key, 62 | const char *value); 63 | #endif 64 | -------------------------------------------------------------------------------- /src/FavoritesTimeline.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | class FavoritesTimeline : Cb.MessageReceiver, DefaultTimeline { 19 | protected override string function { 20 | get { 21 | return "1.1/favorites/list.json"; 22 | } 23 | } 24 | 25 | public FavoritesTimeline (int id, Account account) { 26 | base (id); 27 | this.account = account; 28 | //this.tweet_list.account = account; 29 | } 30 | 31 | private void stream_message_received (Cb.StreamMessageType type, Json.Node root) { 32 | if (type == Cb.StreamMessageType.EVENT_FAVORITE) { 33 | Json.Node tweet_obj = root.get_object ().get_member ("target_object"); 34 | int64 tweet_id = tweet_obj.get_object ().get_int_member ("id"); 35 | 36 | // the source object is a user object indicating who made the favorite 37 | Json.Object source_obj = root.get_object ().get_object_member ("source"); 38 | if (source_obj.get_int_member ("id") != account.id) 39 | return; 40 | 41 | Cb.Tweet? existing_tweet = this.tweet_list.model.get_for_id (tweet_id, 0); 42 | if (existing_tweet != null) { 43 | /* This tweet is already in the model, so just mark it as favorited */ 44 | tweet_list.model.set_tweet_flag (existing_tweet, Cb.TweetState.FAVORITED); 45 | return; 46 | } 47 | 48 | var tweet = new Cb.Tweet (); 49 | tweet.load_from_json (tweet_obj, account.id, new GLib.DateTime.now_local ()); 50 | tweet.set_flag (Cb.TweetState.FAVORITED); 51 | this.tweet_list.model.add (tweet); 52 | } else if (type == Cb.StreamMessageType.EVENT_UNFAVORITE) { 53 | int64 id = root.get_object ().get_object_member ("target_object").get_int_member ("id"); 54 | toggle_favorite (id, false); 55 | } 56 | } 57 | 58 | 59 | public override void on_leave () { 60 | for (uint i = 0; i < tweet_list.model.get_n_items (); i ++) { 61 | var tweet = (Cb.Tweet) tweet_list.model.get_item (i); 62 | if (!tweet.is_flag_set (Cb.TweetState.FAVORITED)) { 63 | tweet_list.model.remove_tweet (tweet); 64 | i --; 65 | } 66 | } 67 | 68 | base.on_leave (); 69 | } 70 | 71 | public override string get_title () { 72 | return _("Favorites"); 73 | } 74 | 75 | public override void create_radio_button (Gtk.RadioButton? group) { 76 | radio_button = new BadgeRadioButton(group, "corebird-favorite-symbolic", _("Favorites")); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/CbFilter.c: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2017 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #include "CbFilter.h" 19 | 20 | 21 | G_DEFINE_TYPE (CbFilter, cb_filter, G_TYPE_OBJECT); 22 | 23 | static void 24 | cb_filter_finalize (GObject *obj) 25 | { 26 | CbFilter *filter = CB_FILTER (obj); 27 | 28 | g_free (filter->contents); 29 | if (filter->regex != NULL) 30 | g_regex_unref (filter->regex); 31 | 32 | G_OBJECT_CLASS (cb_filter_parent_class)->finalize (obj); 33 | } 34 | 35 | static void 36 | cb_filter_init (CbFilter *filter) 37 | { 38 | filter->contents = NULL; 39 | filter->regex = NULL; 40 | } 41 | 42 | static void 43 | cb_filter_class_init (CbFilterClass *klass) 44 | { 45 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 46 | 47 | object_class->finalize = cb_filter_finalize; 48 | } 49 | 50 | CbFilter * 51 | cb_filter_new (const char *expr) 52 | { 53 | CbFilter *filter = CB_FILTER (g_object_new (CB_TYPE_FILTER, NULL)); 54 | 55 | cb_filter_reset (filter, expr); 56 | 57 | return filter; 58 | } 59 | 60 | void 61 | cb_filter_reset (CbFilter *filter, const char *expr) 62 | { 63 | g_return_if_fail (CB_IS_FILTER (filter)); 64 | g_return_if_fail (expr != NULL); 65 | 66 | filter->regex = g_regex_new (expr, 67 | G_REGEX_CASELESS, 68 | 0, /* No match flags */ 69 | NULL); 70 | filter->contents = g_strdup (expr); 71 | } 72 | 73 | gboolean 74 | cb_filter_matches (CbFilter *filter, const char *text) 75 | { 76 | g_return_val_if_fail (CB_IS_FILTER (filter), FALSE); 77 | g_return_val_if_fail (text != NULL, FALSE); 78 | 79 | if (filter->regex == NULL) 80 | return FALSE; 81 | 82 | return g_regex_match (filter->regex, 83 | text, 84 | 0, 85 | NULL); 86 | } 87 | 88 | 89 | const char * 90 | cb_filter_get_contents (CbFilter *filter) 91 | { 92 | g_return_val_if_fail (CB_IS_FILTER (filter), ""); 93 | 94 | return filter->contents; 95 | } 96 | 97 | int 98 | cb_filter_get_id (CbFilter *filter) 99 | { 100 | g_return_val_if_fail (CB_IS_FILTER (filter), 0); 101 | 102 | return filter->id; 103 | } 104 | 105 | void 106 | cb_filter_set_id (CbFilter *filter, int id) 107 | { 108 | g_return_if_fail (CB_IS_FILTER (filter)); 109 | g_return_if_fail (id >= 0); 110 | 111 | filter->id = id; 112 | } 113 | -------------------------------------------------------------------------------- /data/symbolic/apps/corebird-compose-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 41 | 48 | 49 | 51 | 52 | 54 | image/svg+xml 55 | 57 | 58 | 59 | 60 | 61 | 66 | 69 | 77 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /src/CbAvatarCache.h: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2016 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | #ifndef AVATAR_CACHE_H 19 | #define AVATAR_CACHE_H 20 | 21 | #include 22 | #include 23 | 24 | G_BEGIN_DECLS 25 | 26 | typedef struct _CbAvatarCache CbAvatarCache; 27 | struct _CbAvatarCache 28 | { 29 | GObject parent_instance; 30 | 31 | GArray *entries; 32 | }; 33 | 34 | #define CB_TYPE_AVATAR_CACHE cb_avatar_cache_get_type () 35 | G_DECLARE_FINAL_TYPE (CbAvatarCache, cb_avatar_cache, CB, AVATAR_CACHE, GObject); 36 | 37 | CbAvatarCache * cb_avatar_cache_new (void); 38 | void cb_avatar_cache_decrease_refcount_for_texture (CbAvatarCache *self, 39 | GdkTexture *texture); 40 | void cb_avatar_cache_increase_refcount_for_texture (CbAvatarCache *self, 41 | GdkTexture *texture); 42 | void cb_avatar_cache_add (CbAvatarCache *self, 43 | gint64 user_id, 44 | GdkTexture *texture, 45 | const char *url); 46 | void cb_avatar_cache_set_avatar (CbAvatarCache *self, 47 | gint64 user_id, 48 | GdkTexture *texture, 49 | const char *url); 50 | GdkTexture * cb_avatar_cache_get_texture_for_id (CbAvatarCache *self, 51 | gint64 user_id, 52 | gboolean *out_found); 53 | const char * cb_avatar_cache_get_url_for_id (CbAvatarCache *self, 54 | gint64 user_id); 55 | guint cb_avatar_cache_get_n_entries (CbAvatarCache *self); 56 | void cb_avatar_cache_set_url (CbAvatarCache *self, 57 | gint64 user_id, 58 | const char *url); 59 | G_END_DECLS 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /ui/new-list-entry.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 72 | 73 | -------------------------------------------------------------------------------- /data/verified.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 23 | 24 | 26 | image/svg+xml 27 | 29 | 30 | 31 | 32 | 33 | 35 | 72 | 83 | 89 | 90 | -------------------------------------------------------------------------------- /ui/filter-page.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 67 | 68 | 1 69 | Users 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/sql/UpdateStatement.vala: -------------------------------------------------------------------------------- 1 | 2 | /* This file is part of corebird, a Gtk+ linux Twitter client. 3 | * Copyright (C) 2013 Timm Bäder 4 | * 5 | * corebird is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * corebird is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with corebird. If not, see . 17 | */ 18 | 19 | namespace Sql { 20 | 21 | public class UpdateStatement : GLib.Object { 22 | public unowned Sqlite.Database db; 23 | private StringBuilder query_builder = new StringBuilder (); 24 | private GLib.GenericArray bindings = new GLib.GenericArray (); 25 | private bool ran = false; 26 | 27 | public UpdateStatement (string table_name) { 28 | query_builder.append ("UPDATE `").append (table_name).append ("` SET "); 29 | } 30 | 31 | public int64 run () { 32 | Sqlite.Statement stmt; 33 | query_builder.append(";"); 34 | int ok = db.prepare_v2 (query_builder.str, -1, out stmt); 35 | 36 | if (ok != Sqlite.OK) { 37 | critical (db.errmsg ()); 38 | return -1; 39 | } 40 | for (int i = 0; i < bindings.length; i++) { 41 | stmt.bind_text (i + 1, bindings.get (i)); 42 | } 43 | ok = stmt.step (); 44 | if (ok == Sqlite.ERROR) { 45 | critical (db.errmsg ()); 46 | critical (stmt.sql ()); 47 | return -1; 48 | } 49 | ran = true; 50 | return db.last_insert_rowid (); 51 | } 52 | 53 | public UpdateStatement where (string where) { 54 | query_builder.append (" WHERE ").append (where); 55 | return this; 56 | } 57 | 58 | public UpdateStatement where_eq (string col, string value) { 59 | query_builder.append (" WHERE `").append (col).append ("`='").append (value).append ("'"); 60 | return this; 61 | } 62 | 63 | public UpdateStatement where_eqi (string col, int64 iv) { 64 | return where_eq (col, iv.to_string ()); 65 | } 66 | 67 | public UpdateStatement val (string col_name, string col_value) { 68 | if (bindings.length > 0) 69 | query_builder.append (", "); 70 | query_builder.append ("`").append (col_name).append ("` = ?"); 71 | bindings.add (col_value); 72 | return this; 73 | } 74 | 75 | public UpdateStatement vali (string col_name, int col_value) { 76 | return val (col_name, col_value.to_string ()); 77 | } 78 | 79 | public UpdateStatement vali64 (string col_name, int64 col_value) { 80 | return val (col_name, col_value.to_string ()); 81 | } 82 | 83 | public UpdateStatement valb (string col_name, bool col_value) { 84 | return val (col_name, col_value ? "1" : "0"); 85 | } 86 | #if DEBUG 87 | ~UpdateStatement () { 88 | if (!ran) 89 | critical ("UpdateStatement for %s did not run.", query_builder.str); 90 | } 91 | #endif 92 | 93 | 94 | } 95 | 96 | } 97 | 98 | 99 | -------------------------------------------------------------------------------- /src/Settings.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of corebird, a Gtk+ linux Twitter client. 2 | * Copyright (C) 2013 Timm Bäder 3 | * 4 | * corebird is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * corebird is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with corebird. If not, see . 16 | */ 17 | 18 | public enum MediaVisibility{ 19 | SHOW = 1, 20 | HIDE = 2, 21 | HIDE_IN_TIMELINES = 3 22 | } 23 | 24 | public class Settings : GLib.Object { 25 | private static GLib.Settings settings; 26 | 27 | public static void init(){ 28 | settings = new GLib.Settings("org.baedert.corebird"); 29 | } 30 | 31 | public static new GLib.Settings get () { 32 | return settings; 33 | } 34 | 35 | /** 36 | * Returns how many tweets should be stacked before a 37 | * notification should be created. 38 | */ 39 | public static int get_tweet_stack_count() { 40 | int setting_val = settings.get_enum("new-tweets-notify"); 41 | return setting_val; 42 | } 43 | 44 | public static bool notify_new_mentions(){ 45 | return settings.get_boolean("new-mentions-notify"); 46 | } 47 | 48 | public static bool notify_new_dms(){ 49 | return settings.get_boolean("new-dms-notify"); 50 | } 51 | 52 | public static bool auto_scroll_on_new_tweets () { 53 | return settings.get_boolean ("auto-scroll-on-new-tweets"); 54 | } 55 | 56 | public static string get_accel (string accel_name) { 57 | return settings.get_string ("accel-" + accel_name); 58 | } 59 | 60 | public static double max_media_size () { 61 | return settings.get_double ("max-media-size"); 62 | } 63 | 64 | public static void toggle_topbar_visible () { 65 | settings.set_boolean ("sidebar-visible", !settings.get_boolean ("sidebar-visible")); 66 | } 67 | 68 | 69 | public static string get_consumer_key () { 70 | return settings.get_string ("consumer-key"); 71 | } 72 | 73 | public static string get_consumer_secret () { 74 | return settings.get_string ("consumer-secret"); 75 | } 76 | 77 | public static void add_text_transform_flag (Cb.TransformFlags flag) { 78 | settings.set_uint ("text-transform-flags", 79 | settings.get_uint ("text-transform-flags") | flag); 80 | } 81 | 82 | public static void remove_text_transform_flag (Cb.TransformFlags flag) { 83 | settings.set_uint ("text-transform-flags", 84 | settings.get_uint ("text-transform-flags") & ~flag); 85 | } 86 | 87 | public static Cb.TransformFlags get_text_transform_flags () { 88 | return (Cb.TransformFlags) settings.get_uint ("text-transform-flags"); 89 | } 90 | 91 | public static bool hide_nsfw_content () { 92 | return settings.get_boolean ("hide-nsfw-content"); 93 | } 94 | 95 | public static MediaVisibility get_media_visiblity () { 96 | return (MediaVisibility)settings.get_enum ("media-visibility"); 97 | } 98 | } 99 | --------------------------------------------------------------------------------