Revert "Implement achievement selection operations (#27)"

This reverts commit 1e4c12f51f.
This commit is contained in:
William Pierce 2019-10-30 23:31:01 -07:00
parent 1e4c12f51f
commit 33fa16b04e
14 changed files with 792 additions and 677 deletions

View File

@ -14,7 +14,7 @@
"${workspaceRoot}"
]
},
"intelliSenseMode": "gcc-x64",
"intelliSenseMode": "clang-x64",
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"

View File

@ -1,7 +1,6 @@
CXX=g++ -std=c++17 -g
RM=rm -f
RMDIR=rm -rf
HFILES:=$(shell find src/ -type f -iname *.h -print)
CXXFILES:=$(shell find src/ -type f -iname *.cpp -print)
CXXFLAGS=$(shell pkg-config --cflags --libs gtk+-3.0) -rdynamic -export-dynamic -pthread -Wall -lpthread -lgmodule-2.0 -lsteam_api -lcurl -lyajl -ldl
LDFLAGS=-L${CURDIR}/bin
@ -11,9 +10,9 @@ OBJS=$(addprefix ${OBJDIR}/,$(subst .cpp,.o,${CXXFILES}))
all: ${CURDIR}/bin/samrewritten
${CURDIR}/bin/samrewritten: $(OBJS)
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${CURDIR}/bin/samrewritten $(OBJS)
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${CURDIR}/bin/samrewritten $(shell find obj/ -type f -iname *.o -print)
${OBJDIR}/%.o: %.cpp $(HFILES)
${OBJDIR}/%.o: %.cpp
@mkdir -p $$(dirname $@)
$(CXX) $(CXXFLAGS) $< ${LDFLAGS} -c -o $@

View File

@ -68,119 +68,7 @@ telans (telans)</property>
</object>
</child>
</object>
<object class="GtkBox" id="fetch_achievements_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner">
<property name="width_request">34</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">False</property>
<property name="active">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">SamRewritten is currently fetching your achievements.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<object class="GtkBox" id="fetch_games_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner">
<property name="width_request">34</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">SamRewritten is currently fetching your games.
Give it some time, eventually it'll finish downloading all the pretty icons!</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<object class="GtkBox" id="no_achievements_found_placeholder">
<object class="GtkBox" id="game_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@ -199,8 +87,8 @@ Give it some time, eventually it'll finish downloading all the pretty icons!</pr
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">34</property>
<property name="icon_name">face-crying</property>
<property name="pixel_size">35</property>
<property name="icon_name">face-glasses</property>
</object>
<packing>
<property name="expand">False</property>
@ -212,68 +100,13 @@ Give it some time, eventually it'll finish downloading all the pretty icons!</pr
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">No achievements found!
Did you make a typo? Or maybe this game has no achievements.</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<object class="GtkBox" id="no_games_found_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">34</property>
<property name="icon_name">face-crying</property>
<property name="label" translatable="yes">Sam is currently fetching your games!
He's pretty confident they won't take much longer to arrive, but is also wrong most of the time.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">No games found!
Did you make a typo?</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="position">2</property>
</packing>
</child>
@ -305,20 +138,6 @@ Did you make a typo?</property>
<property name="text" translatable="yes">About</property>
<signal name="clicked" handler="on_about_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="refresh_games_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">Refresh Games</property>
<signal name="clicked" handler="on_refresh_games_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
@ -326,11 +145,12 @@ Did you make a typo?</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="refresh_achievements_button">
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">Refresh Achievements</property>
<signal name="clicked" handler="on_refresh_achievements_button_clicked" swapped="no"/>
<property name="text" translatable="yes">Refresh Games</property>
<signal name="clicked" handler="on_ask_game_refresh" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -338,45 +158,6 @@ Did you make a typo?</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="unlock_all_achievements_button">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">Unlock All</property>
<signal name="clicked" handler="on_unlock_all_achievements_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="lock_all_achievements_button">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">Lock All</property>
<signal name="clicked" handler="on_lock_all_achievements_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="invert_all_achievements_button">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">Invert All</property>
<signal name="clicked" handler="on_invert_all_achievements_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="submenu">main</property>
@ -384,6 +165,21 @@ Did you make a typo?</property>
</packing>
</child>
</object>
<object class="GtkPopover" id="search_popover">
<property name="can_focus">False</property>
<child>
<object class="GtkSearchEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Name of the game...</property>
<property name="input_hints">GTK_INPUT_HINT_NO_SPELLCHECK | GTK_INPUT_HINT_NONE</property>
<signal name="search-changed" handler="on_search_changed" swapped="no"/>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="main_window">
<property name="width_request">800</property>
<property name="height_request">500</property>
@ -416,37 +212,6 @@ Did you make a typo?</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="game_search_bar">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">26</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Name of the game...</property>
<property name="input_hints">GTK_INPUT_HINT_NO_SPELLCHECK | GTK_INPUT_HINT_NONE</property>
<signal name="search-changed" handler="on_game_search_changed" swapped="no"/>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="achievement_search_bar">
<property name="can_focus">True</property>
<property name="width_chars">26</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Name of the achievement...</property>
<property name="input_hints">GTK_INPUT_HINT_NO_SPELLCHECK | GTK_INPUT_HINT_NONE</property>
<signal name="search-changed" handler="on_achievement_search_changed" swapped="no"/>
</object>
<packing>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
@ -467,6 +232,26 @@ Did you make a typo?</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">search_popover</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-find-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="store_button">
<property name="can_focus">True</property>
@ -476,7 +261,7 @@ Did you make a typo?</property>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">document-save-symbolic</property>
<property name="icon_name">mail-send-receive-symbolic</property>
</object>
</child>
</object>
@ -518,7 +303,7 @@ Did you make a typo?</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="achievement_list_view">
<object class="GtkScrolledWindow" id="stats_list_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
@ -528,7 +313,7 @@ Did you make a typo?</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkListBox" id="achievement_list">
<object class="GtkListBox" id="stats_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
@ -546,4 +331,60 @@ Did you make a typo?</property>
</object>
</child>
</object>
<object class="GtkBox" id="stats_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner">
<property name="width_request">34</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">False</property>
<property name="active">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Please wait while SamRewritten fetches your games</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</interface>

View File

@ -0,0 +1,379 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright (C)
This file is part of SamRewritten.
SamRewritten is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SamRewritten is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with SamRewritten. If not, see <http://www.gnu.org/licenses/>.
Author: Paul Combaldieu
-->
<interface>
<requires lib="gtk+" version="3.20"/>
<!-- interface-license-type lgplv3 -->
<!-- interface-name SamRewritten -->
<!-- interface-authors Paul Combaldieu -->
<object class="GtkBox" id="game_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">35</property>
<property name="icon_name">face-glasses</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Sam is currently fetching your games!
He's pretty confident they won't take much longer to arrive, but is also wrong most of the time.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<object class="GtkPopoverMenu" id="popovermenu">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">About</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">Refresh Games</property>
<signal name="clicked" handler="on_ask_game_refresh" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="submenu">main</property>
<property name="position">1</property>
</packing>
</child>
</object>
<object class="GtkPopover" id="search_popover">
<property name="can_focus">False</property>
<child>
<object class="GtkSearchEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Name of the game...</property>
<property name="input_hints">GTK_INPUT_HINT_NO_SPELLCHECK | GTK_INPUT_HINT_NONE</property>
<signal name="search-changed" handler="on_search_changed" swapped="no"/>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="main_window">
<property name="width_request">800</property>
<property name="height_request">500</property>
<property name="can_focus">False</property>
<property name="icon_name">face-wink</property>
<signal name="delete-event" handler="on_close_button_clicked" swapped="no"/>
<signal name="show" handler="on_main_window_show" swapped="no"/>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title">SamRewritten</property>
<property name="subtitle">Steam Achievements Manager</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="back_button">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Return to the game list</property>
<signal name="clicked" handler="on_back_button_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">go-previous-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">popovermenu</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">search_popover</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-find-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="store_button">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_store_button_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">mail-send-receive-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="transition_type">slide-left-right</property>
<child>
<object class="GtkScrolledWindow" id="game_list_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchEntry">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Type a game name</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="game_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="stats_list_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkListBox" id="stats_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkBox" id="stats_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner">
<property name="width_request">34</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">False</property>
<property name="active">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Please wait while SAM fetches the results</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</interface>

View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.3 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkPopover" id="mypop">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Infos supplémentaires</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Achieved by 98% of the players</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Progression de l'achievement</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkLevelBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="value">0.17000000000000001</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">15 / 100</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Ach tiel</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Ach desc</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">20</property>
<property name="margin_bottom">20</property>
<property name="popover">mypop</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-about</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkToggleButton">
<property name="label" translatable="yes">Locked</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</interface>

View File

@ -217,11 +217,4 @@ MySteam::commit_changes() {
// Clear all pending changes
m_pending_ach_modifications.clear();
}
// => commit_changes
void
MySteam::clear_changes() {
// Clear all pending changes
m_pending_ach_modifications.clear();
}
// => clear_changes
// => commit_changes

View File

@ -26,6 +26,16 @@ public:
*/
static std::string get_steam_install_path();
/**
* Simple getter for m_pending_ach_modifications
*/
std::map<std::string, bool> get_pending_ach_modifications() const { return m_pending_ach_modifications; };
/**
* Simple getter for m_pending_stat_modifications
*/
std::map<std::string, double> get_pending_stat_modifications() const { return m_pending_stat_modifications; };
/**
* Starts a process that will emulate a steam game with the
* given appId. Returns false if this process failed to launch.
@ -87,11 +97,6 @@ public:
*/
void commit_changes();
/**
* Clear pending changes without committing them.
*/
void clear_changes();
MySteam(MySteam const&) = delete;
void operator=(MySteam const&) = delete;
private:

View File

@ -8,114 +8,45 @@
extern "C"
{
void
on_achievement_button_toggle(GtkToggleButton* but, gpointer ach_row) {
// Urgh, in gtk when you call gtk_toggle_button_set_active,
// you get a toggle/click event and there's no way to disable it.
// So ignore the one we do get. Trying to use another signal doesn't
// work out easily either
GtkAchievementBoxRow * this_row = (GtkAchievementBoxRow *)ach_row;
if (this_row->m_ignore_toggle) return;
on_achievement_button_toggle(GtkToggleButton* but, gpointer achievement) {
const Achievement_t* ach = (Achievement_t *)achievement;
const bool active = gtk_toggle_button_get_active(but);
const bool achieved = ach->achieved;
const std::string ach_id = ach->id;
// TODO: just register invert as the signal handler directly when transformed
// to proper GTKMM C++
// This will cause GTK to call this function recursively once, but it will
// be ignored.
this_row->invert();
if(active && achieved) {
gtk_button_set_label(GTK_BUTTON(but), "🔓 Unlocked");
g_steam->remove_modification_ach(ach_id);
}
else if (active && !achieved) {
gtk_button_set_label(GTK_BUTTON(but), "To unlock");
g_steam->add_modification_ach(ach_id, true);
}
else if (!active && achieved) {
gtk_button_set_label(GTK_BUTTON(but), "To relock");
g_steam->add_modification_ach(ach_id, false);
}
else if (!active && !achieved) {
gtk_button_set_label(GTK_BUTTON(but), "🔒 Locked");
g_steam->remove_modification_ach(ach_id);
}
}
}
void
GtkAchievementBoxRow::unlock() {
m_ignore_toggle = true;
const bool achieved = m_data.achieved;
const std::string ach_id = m_data.id;
if (!m_active && !achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "To unlock");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), TRUE);
m_active = true;
g_steam->add_modification_ach(ach_id, true);
} else if (m_active && achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "🔓 Unlocked");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), FALSE);
m_active = false;
g_steam->remove_modification_ach(ach_id);
}
// Do nothing for all other conditions
m_ignore_toggle = false;
}
// => unlock
void
GtkAchievementBoxRow::lock() {
m_ignore_toggle = true;
const bool achieved = m_data.achieved;
const std::string ach_id = m_data.id;
if (!m_active && achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "To relock");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), TRUE);
m_active = true;
g_steam->add_modification_ach(ach_id, false);
} else if (m_active && !achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "🔒 Locked");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), FALSE);
m_active = false;
g_steam->remove_modification_ach(ach_id);
}
// Do nothing for all other conditions
m_ignore_toggle = false;
}
// => lock
void
GtkAchievementBoxRow::invert() {
m_ignore_toggle = true;
const bool achieved = m_data.achieved;
const std::string ach_id = m_data.id;
// TODO: is this the expected behavior for invert? Who uses this?
if (!m_active && achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "To relock");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), TRUE);
m_active = true;
g_steam->add_modification_ach(ach_id, false);
} else if (m_active && achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "🔓 Unlocked");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), FALSE);
m_active = false;
g_steam->remove_modification_ach(ach_id);
} else if (!m_active && !achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "To unlock");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), TRUE);
m_active = true;
g_steam->add_modification_ach(ach_id, true);
} else if (m_active && !achieved) {
gtk_button_set_label(GTK_BUTTON(m_lock_unlock_button), "🔒 Locked");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), FALSE);
m_active = false;
g_steam->remove_modification_ach(ach_id);
}
m_ignore_toggle = false;
}
// => invert
GtkAchievementBoxRow::GtkAchievementBoxRow(const Achievement_t& data)
:
m_data(data),
m_active(false),
m_ignore_toggle(false)
m_data(data)
{
// TODO achievement icons
// TODO Rewrite. Ugly AF for unknown reasons
std::string ach_title_text, ach_player_percent_text, ach_locked_text;
gboolean pressed;
if ( data.achieved ) {
ach_locked_text = "🔓 Unlocked";
pressed = TRUE;
} else {
ach_locked_text = "🔒 Locked";
pressed = FALSE;
}
ach_title_text = "<b>" + data.name + "</b>";
@ -131,7 +62,7 @@ m_ignore_toggle(false)
GtkWidget *desc_label = gtk_label_new(data.desc.c_str());
GtkWidget *more_info_button = gtk_menu_button_new();
GtkWidget *more_info_image = gtk_image_new_from_icon_name("gtk-about", GTK_ICON_SIZE_BUTTON);
m_lock_unlock_button = gtk_toggle_button_new_with_label(ach_locked_text.c_str());
GtkWidget *lock_unlock_button = gtk_toggle_button_new_with_label(ach_locked_text.c_str());
GtkWidget *popover_menu = gtk_popover_new( more_info_button );
GtkWidget *popover_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 3);
GtkWidget *more_info_label = gtk_label_new("");
@ -148,8 +79,8 @@ m_ignore_toggle(false)
gtk_menu_button_set_popover(GTK_MENU_BUTTON(more_info_button), GTK_WIDGET(popover_menu));
gtk_widget_set_valign(GTK_WIDGET(more_info_button), GTK_ALIGN_CENTER);
gtk_widget_set_margin_end(GTK_WIDGET(more_info_button), 10);
gtk_widget_set_size_request(GTK_WIDGET(m_lock_unlock_button), 150, -1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_lock_unlock_button), FALSE);
gtk_widget_set_size_request(GTK_WIDGET(lock_unlock_button), 150, -1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lock_unlock_button), pressed);
gtk_container_set_border_width(GTK_CONTAINER(popover_box), 5);
gtk_style_context_add_class(
gtk_widget_get_style_context( GTK_WIDGET(more_info_button) ),
@ -162,7 +93,7 @@ m_ignore_toggle(false)
gtk_box_pack_start(GTK_BOX(layout), GTK_WIDGET(ach_pic), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(layout), GTK_WIDGET(title_desc_box), TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(layout), GTK_WIDGET(more_info_button), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(layout), GTK_WIDGET(m_lock_unlock_button), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(layout), GTK_WIDGET(lock_unlock_button), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(popover_box), GTK_WIDGET(more_info_label), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(popover_box), GTK_WIDGET(sep_one), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(popover_box), GTK_WIDGET(percentage_players_label), FALSE, TRUE, 0);
@ -175,7 +106,7 @@ m_ignore_toggle(false)
gtk_widget_show_all(popover_box);
gtk_container_add(GTK_CONTAINER(m_main_box), GTK_WIDGET(layout));
g_signal_connect(m_lock_unlock_button, "toggled", (GCallback)on_achievement_button_toggle, (gpointer)this);
g_signal_connect(lock_unlock_button, "toggled", (GCallback)on_achievement_button_toggle, (gpointer)&m_data);
}
GtkAchievementBoxRow::~GtkAchievementBoxRow() {

View File

@ -8,31 +8,10 @@ public:
GtkAchievementBoxRow(const Achievement_t& data);
~GtkAchievementBoxRow();
/**
* Unlock the achievement represented by this row if it is locked
*/
void unlock();
/**
* Lock the achievement represented by this row if it is unlocked
*/
void lock();
/**
* Invert (or toggle) the achievement represented by this row
*/
void invert();
Achievement_t get_achievement() { return m_data; };
GtkWidget* get_main_widget() { return m_main_box; };
// TODO: pull this data back into private when transformed
// to proper GTKMM C++ signal handlers
Achievement_t m_data;
// Whether the achievement has a pending change
// This simplifies logic with the toggle button.
bool m_active;
bool m_ignore_toggle;
private:
Achievement_t m_data;
GtkWidget *m_main_box;
GtkWidget *m_lock_unlock_button; // Cache this for easy lookups
};

View File

@ -7,7 +7,17 @@
#include "gtk_callbacks.h"
MainPickerWindow::MainPickerWindow()
MainPickerWindow::MainPickerWindow()
:
m_main_window(nullptr),
m_about_dialog(nullptr),
m_back_button(nullptr),
m_game_list(nullptr),
m_stats_list(nullptr),
m_builder(nullptr),
m_main_stack(nullptr),
m_game_list_view(nullptr),
m_stats_list_view(nullptr)
{
const char ui_file[] = "glade/main_window.glade";
// This function does all error handling and aborts if there is an error.
@ -15,34 +25,30 @@ MainPickerWindow::MainPickerWindow()
// Load the required widgets through the builder
m_game_list = GTK_LIST_BOX(gtk_builder_get_object(m_builder, "game_list"));
m_game_search_bar = GTK_SEARCH_ENTRY(gtk_builder_get_object(m_builder, "game_search_bar"));
m_achievement_search_bar = GTK_SEARCH_ENTRY(gtk_builder_get_object(m_builder, "achievement_search_bar"));
m_achievement_list = GTK_LIST_BOX(gtk_builder_get_object(m_builder, "achievement_list"));
m_stats_list = GTK_LIST_BOX(gtk_builder_get_object(m_builder, "stats_list"));
m_main_window = GTK_WIDGET(gtk_builder_get_object(m_builder, "main_window"));
m_about_dialog = GTK_WIDGET(gtk_builder_get_object(m_builder, "about_dialog"));
m_main_stack = GTK_STACK(gtk_builder_get_object(m_builder, "main_stack"));
m_game_list_view = GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_builder, "game_list_view"));
m_achievement_list_view = GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_builder, "achievement_list_view"));
m_stats_list_view = GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_builder, "stats_list_view"));
m_back_button = GTK_BUTTON(gtk_builder_get_object(m_builder, "back_button"));
m_store_button = GTK_BUTTON(gtk_builder_get_object(m_builder, "store_button"));
m_refresh_games_button = GTK_BUTTON(gtk_builder_get_object(m_builder, "refresh_games_button"));
m_refresh_achievements_button = GTK_BUTTON(gtk_builder_get_object(m_builder, "refresh_achievements_button"));
m_unlock_all_achievements_button = GTK_BUTTON(gtk_builder_get_object(m_builder, "unlock_all_achievements_button"));
m_lock_all_achievements_button = GTK_BUTTON(gtk_builder_get_object(m_builder, "lock_all_achievements_button"));
m_invert_all_achievements_button = GTK_BUTTON(gtk_builder_get_object(m_builder, "invert_all_achievements_button"));
m_fetch_games_placeholder = GTK_WIDGET(gtk_builder_get_object(m_builder, "fetch_games_placeholder"));
m_no_games_found_placeholder = GTK_WIDGET(gtk_builder_get_object(m_builder, "no_games_found_placeholder"));
m_fetch_achievements_placeholder = GTK_WIDGET(gtk_builder_get_object(m_builder, "fetch_achievements_placeholder"));
m_no_achievements_found_placeholder = GTK_WIDGET(gtk_builder_get_object(m_builder, "no_achievements_found_placeholder"));
GtkWidget* game_placeholder = GTK_WIDGET(gtk_builder_get_object(m_builder, "game_placeholder"));
GtkWidget* stats_placeholder = GTK_WIDGET(gtk_builder_get_object(m_builder, "stats_placeholder"));
g_signal_connect(m_game_list, "row-activated", (GCallback)on_game_row_activated, NULL);
gtk_builder_connect_signals(m_builder, NULL);
// Show the placeholder widget right away, which is the loading widget
show_fetch_games_placeholder();
gtk_list_box_set_placeholder(m_game_list, game_placeholder);
gtk_list_box_set_placeholder(m_stats_list, stats_placeholder);
gtk_widget_show(game_placeholder);
}
// => Constructor
/**
* See https://stackoverflow.com/questions/9192223/remove-gtk-container-children-repopulate-it-then-refresh
* used here and other methods, tells you how to iterate through widgets with a relationship.
@ -119,15 +125,15 @@ MainPickerWindow::add_to_achievement_list(const Achievement_t& achievement) {
GtkAchievementBoxRow *row = new GtkAchievementBoxRow(achievement);
m_achievement_list_rows.push_back(row);
gtk_list_box_insert(m_achievement_list, GTK_WIDGET( row->get_main_widget() ), -1);
gtk_list_box_insert(m_stats_list, GTK_WIDGET( row->get_main_widget() ), -1);
}
// => add_to_achievement_list
void
MainPickerWindow::confirm_achievement_list() {
gtk_widget_show_all( GTK_WIDGET(m_achievement_list) );
MainPickerWindow::confirm_stats_list() {
gtk_widget_show_all( GTK_WIDGET(m_stats_list) );
}
// => confirm_achievement_list
// => confirm_stats_list
/**
* Draws all the games that have not been shown yet
@ -140,6 +146,7 @@ MainPickerWindow::confirm_game_list() {
/**
* Refreshes the icon for the specified app ID
* if app_id is zero, it means the downloaded file isn't an app icon
* As per GTK, this must only ever be called from the main thread.
*/
void
@ -221,25 +228,6 @@ MainPickerWindow::filter_games(const char* filter_text) {
}
// => filter_games
void
MainPickerWindow::filter_achievements(const char* filter_text) {
const std::string text_filter(filter_text);
std::string text_label;
gtk_widget_show_all( GTK_WIDGET(m_achievement_list) );
if(text_filter.empty()) {
return;
}
for ( GtkAchievementBoxRow* row : m_achievement_list_rows )
{
if (!strstri(row->get_achievement().name, text_filter)) {
gtk_widget_hide( row->get_main_widget() );
}
}
}
// => filter_achievements
unsigned long
MainPickerWindow::get_corresponding_appid_for_row(GtkListBoxRow *row) {
for(std::map<unsigned long, GtkWidget*>::iterator it = m_game_list_rows.begin(); it != m_game_list_rows.end(); ++it)
@ -253,94 +241,25 @@ MainPickerWindow::get_corresponding_appid_for_row(GtkListBoxRow *row) {
// => get_corresponding_appid_for_row
void
MainPickerWindow::unlock_all_achievements() {
for ( GtkAchievementBoxRow* row : m_achievement_list_rows )
{
row->unlock();
}
}
// => unlock_all_achievements
void
MainPickerWindow::lock_all_achievements() {
for ( GtkAchievementBoxRow* row : m_achievement_list_rows )
{
row->lock();
}
}
// => lock_all_achievements
void
MainPickerWindow::invert_all_achievements() {
for ( GtkAchievementBoxRow* row : m_achievement_list_rows )
{
row->invert();
}
}
// => invert_all_achievements
void
MainPickerWindow::show_fetch_games_placeholder() {
gtk_list_box_set_placeholder(m_game_list, m_fetch_games_placeholder);
gtk_widget_show(m_fetch_games_placeholder);
}
// => show_fetch_games_placeholder
void
MainPickerWindow::show_no_games_found_placeholder() {
gtk_list_box_set_placeholder(m_game_list, m_no_games_found_placeholder);
gtk_widget_show(m_no_games_found_placeholder);
}
// => show_no_games_found_placeholder
void
MainPickerWindow::show_fetch_achievements_placeholder() {
gtk_list_box_set_placeholder(m_achievement_list, m_fetch_achievements_placeholder);
gtk_widget_show(m_fetch_achievements_placeholder);
}
// => show_fetch_achievements_placeholder
void
MainPickerWindow::show_no_achievements_found_placeholder() {
gtk_list_box_set_placeholder(m_achievement_list, m_no_achievements_found_placeholder);
gtk_widget_show(m_no_achievements_found_placeholder);
}
// => show_no_achievements_found_placeholder
void
MainPickerWindow::switch_to_achievement_page() {
MainPickerWindow::switch_to_stats_page() {
gtk_widget_set_visible(GTK_WIDGET(m_back_button), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_game_search_bar), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_achievement_search_bar), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_store_button), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_refresh_games_button), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_refresh_achievements_button), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_unlock_all_achievements_button), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_lock_all_achievements_button), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_invert_all_achievements_button), TRUE);
gtk_stack_set_visible_child(GTK_STACK(m_main_stack), GTK_WIDGET(m_achievement_list_view));
gtk_stack_set_visible_child(GTK_STACK(m_main_stack), GTK_WIDGET(m_stats_list_view));
}
// => switch_to_achievement_page
// => switch_to_stats_page
void
MainPickerWindow::switch_to_games_page() {
gtk_widget_set_visible(GTK_WIDGET(m_back_button), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_game_search_bar), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_achievement_search_bar), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_store_button), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_refresh_games_button), TRUE);
gtk_widget_set_visible(GTK_WIDGET(m_refresh_achievements_button), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_unlock_all_achievements_button), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_lock_all_achievements_button), FALSE);
gtk_widget_set_visible(GTK_WIDGET(m_invert_all_achievements_button), FALSE);
gtk_stack_set_visible_child(GTK_STACK(m_main_stack), GTK_WIDGET(m_game_list_view));
gtk_entry_set_text(GTK_ENTRY(m_achievement_search_bar), "");
reset_achievements_list();
// Clear achievements list
for(GtkAchievementBoxRow* i : m_achievement_list_rows) {
delete i;
}
m_achievement_list_rows.clear();
}
// => switch_to_games_page

View File

@ -68,7 +68,7 @@ public:
* Shows all widget that has been added to the list, removes all
* the deleted entries from the GUI list.
*/
void confirm_achievement_list();
void confirm_stats_list();
/**
* When a game is added to the list, the "missing icon" is used by default
@ -83,61 +83,16 @@ public:
*/
void filter_games(const char* filter_text);
/**
* Filters the achievement list. For an achievement to stay displayed,
* filter_text must be included in it
*/
void filter_achievements(const char* filter_text);
/**
* Give it a pointer to a row from the main game list, returns the associated
* appid. Returns 0 on error;
*/
unsigned long get_corresponding_appid_for_row(GtkListBoxRow *row);
/**
* Access m_achievement_list_rows and call unlock for every one of them
*/
void unlock_all_achievements();
/**
* Access m_achievement_list_rows and call lock for every one of them
*/
void lock_all_achievements();
/**
* Access m_achievement_list_rows and call invert for every one of them
*/
void invert_all_achievements();
/**
* Set the game_list placeholder to the no games found placeholder
* and show it
*/
void show_fetch_games_placeholder();
/**
* Set the game_list placeholder to the fetching games placeholder
* and show it
*/
void show_no_games_found_placeholder();
/**
* Set the achievement_list placeholder to the no achievements found placeholder
* and show it
*/
void show_fetch_achievements_placeholder();
/**
* Set the game_list placeholder to the fetching achievements placeholder
* and show it
*/
void show_no_achievements_found_placeholder();
/**
* Shows the achievements list instead of the game list
*/
void switch_to_achievement_page();
void switch_to_stats_page();
/**
* Shows the games list instead of the stats and achievements list
@ -173,7 +128,7 @@ public:
*/
/**
* Mutex to prevent on_refresh_games_button_clicked from being reentrant
* Mutex to prevent on_ask_game_refresh from being reentrant
* and allowing multiple idle threads to corrupt the main window.
*/
std::mutex m_game_refresh_lock;
@ -187,23 +142,12 @@ private:
GtkWidget *m_about_dialog;
GtkButton *m_back_button;
GtkButton *m_store_button;
GtkButton *m_refresh_games_button;
GtkButton *m_refresh_achievements_button;
GtkButton *m_unlock_all_achievements_button;
GtkButton *m_lock_all_achievements_button;
GtkButton *m_invert_all_achievements_button;
GtkListBox *m_game_list;
GtkListBox *m_achievement_list;
GtkListBox *m_stats_list;
GtkBuilder *m_builder;
GtkStack *m_main_stack;
GtkSearchEntry *m_game_search_bar;
GtkSearchEntry *m_achievement_search_bar;
GtkScrolledWindow *m_game_list_view;
GtkScrolledWindow *m_achievement_list_view;
GtkWidget *m_fetch_games_placeholder;
GtkWidget *m_no_games_found_placeholder;
GtkWidget *m_fetch_achievements_placeholder;
GtkWidget *m_no_achievements_found_placeholder;
GtkScrolledWindow *m_stats_list_view;
std::map<unsigned long, GtkWidget*> m_game_list_rows;
std::vector<GtkAchievementBoxRow*> m_achievement_list_rows;

View File

@ -23,7 +23,8 @@ extern "C"
g_main_gui->add_to_achievement_list(achievement);
}
g_main_gui->confirm_achievement_list();
// TODO: these are not stats they are general achievements
g_main_gui->confirm_stats_list();
}
// => populate_achievements
@ -165,22 +166,11 @@ extern "C"
g_perfmon->log("Library parsed.");
g_free(data);
g_main_gui->m_game_refresh_lock.unlock();
g_main_gui->show_no_games_found_placeholder();
}
// => finish_load_items
void
on_about_button_clicked() {
g_main_gui->show_about_dialog();
}
void
on_about_dialog_close_button_clicked() {
g_main_gui->hide_about_dialog();
}
void
on_refresh_games_button_clicked() {
on_ask_game_refresh() {
if (g_main_gui->m_game_refresh_lock.try_lock()) {
IdleData *data;
@ -188,7 +178,6 @@ extern "C"
data->current_item = 0;
data->state = STATE_STARTED;
g_main_gui->outstanding_icon_downloads = 0;
g_main_gui->show_fetch_games_placeholder();
// Use low priority so we don't block showing the main window
// This allows the main window to show up immediately
@ -200,52 +189,35 @@ extern "C"
std::cerr << "Not refreshing games because a refresh is already in progress" << std::endl;
}
}
// => on_refresh_games_button_clicked
void
on_refresh_achievements_button_clicked() {
g_steam->clear_changes();
populate_achievements();
}
// => on_refresh_achievements_button_clicked
void
on_unlock_all_achievements_button_clicked() {
g_main_gui->unlock_all_achievements();
}
// => on_unlock_all_achievements_button_clicked
void
on_lock_all_achievements_button_clicked() {
g_main_gui->lock_all_achievements();
}
// => on_lock_all_achievements_button_clicked
void
on_invert_all_achievements_button_clicked() {
g_main_gui->invert_all_achievements();
}
// => on_invert_all_achievements_button_clicked
// => on_ask_game_refresh
void
on_main_window_show() {
on_refresh_games_button_clicked();
on_ask_game_refresh();
}
// => on_main_window_show
void
on_game_search_changed(GtkWidget* search_widget) {
const char* filter_text = gtk_entry_get_text( GTK_ENTRY(search_widget) );
g_main_gui->filter_games(filter_text);
on_about_button_clicked() {
g_main_gui->show_about_dialog();
}
// => on_game_search_changed
void
on_achievement_search_changed(GtkWidget* search_widget) {
const char* filter_text = gtk_entry_get_text( GTK_ENTRY(search_widget) );
g_main_gui->filter_achievements(filter_text);
on_about_dialog_close_button_clicked() {
g_main_gui->hide_about_dialog();
}
// => on_achievement_search_changed
void
on_search_changed(GtkWidget* search_widget) {
const char* filter_text = gtk_entry_get_text( GTK_ENTRY(search_widget) );
//if !g_steam->isgamerunning
g_main_gui->filter_games(filter_text);
//else
//g_main_gui->filter_stats(filter_text)
}
// => on_search_changed
void
on_game_row_activated(GtkListBox *box, GtkListBoxRow *row) {
@ -253,17 +225,9 @@ extern "C"
const AppId_t appId = g_main_gui->get_corresponding_appid_for_row(row);
if( appId != 0 ) {
// Currently this doesn't actually show the fetch_achievements_placeholder
// because the thread gets blocked behind populate_achievements and gtk_main
// never gets a chance to run and refresh the window before it's replaced
// with achievement rows.
// So TODO: fire this populate_achievements in a different thread to not
// block main thread?
g_main_gui->show_fetch_achievements_placeholder();
g_main_gui->switch_to_achievement_page();
g_main_gui->switch_to_stats_page();
g_steam->launch_game(appId);
populate_achievements();
g_main_gui->show_no_achievements_found_placeholder();
} else {
std::cerr << "An error occurred figuring out which app to launch.. You can report this to the developer." << std::endl;
}

View File

@ -43,12 +43,6 @@ extern "C"
void
on_close_button_clicked();
void
on_about_button_clicked();
void
on_about_dialog_close_button_clicked();
/**
* When the user wants to refresh the game list.
* This is also called when the main window just got spawned.
@ -60,40 +54,7 @@ extern "C"
* - Draw the result.
*/
void
on_refresh_games_button_clicked();
/**
* Refresh the achievements by clearing the list and re-retrieving them.
* This clears all pending modifications.
*/
void
on_refresh_achievements_button_clicked();
/**
* Set all achievements which are not already unlocked to unlocked.
* This does not commit changes.
*/
void
on_unlock_all_achievements_button_clicked();
/**
* Set all achievements which are not already locked to locked.
* This does not commit changes.
*/
void
on_lock_all_achievements_button_clicked();
/**
* Invert which achievements are locked and which are unlocked
* Why you would use this is beyond me, but the original SAM has it.
* This does not commit changes.
*/
void
on_invert_all_achievements_button_clicked();
/**
* TODO: Implement reset when stats are implemented?
*/
on_ask_game_refresh();
/**
* When the main window... started showing / will be showing??
@ -103,6 +64,12 @@ extern "C"
void
on_main_window_show();
void
on_about_button_clicked();
void
on_about_dialog_close_button_clicked ();
void
on_search_changed(GtkWidget* search_widget);

View File

@ -5,7 +5,7 @@ class MyServerSocket : public MySocket
{
/**
* The server socket constructor is responsible for creating
* the socket file both server and client will communicate through.
* the socket file both server and socket will communicate through.
*/
public:
void run_server();