Skip to content

Commit

Permalink
adding shortcuts and closes #73
Browse files Browse the repository at this point in the history
  • Loading branch information
diegorubin committed Aug 26, 2019
1 parent 2872c76 commit 4650107
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 63 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Pomodoro Technique timer for GNU/Linux.

## Installing

Download the stable tarball [1.1.0](https://github.com/diegorubin/gnomato/releases/download/1.1.0/gnomato-1.1.0.tar.gz)
Download the stable tarball [1.2.0](https://github.com/diegorubin/gnomato/releases/download/1.2.0/gnomato-1.2.0.tar.gz)

tar -zxvf gnomato-1.1.0.tar.gz
cd gnomato-1.1.0
tar -zxvf gnomato-1.2.0.tar.gz
cd gnomato-1.2.0
./configure
make
sudo make install
Expand All @@ -36,6 +36,18 @@ To generate `configure` script and `Makefiles` execute:

autoreconf -vi

## Usage

### Shortcuts

- __Crtl+s__: Start/Stop timer
- __Crtl+a__: Open New Task Dialog
- __Crtl+r__: Remove selected task
- __Crtl+d__: Finish selected task
- __Crtl+c__: Cancel selected task
- __Crtl+f__: Filter field focus
- __Crtl+l__: Task list focus

## Contacting

To report bugs send email to rubin.diego[at]gmail.com or
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_INIT([Gnomato],[1.0.3],[[email protected]])
AC_INIT([Gnomato],[1.2.0],[[email protected]])

AM_INIT_AUTOMAKE(gnomato,1.0.3)
AM_INIT_AUTOMAKE(gnomato,1.2.0)

AC_PROG_CC
AC_PROG_CXX
Expand Down
37 changes: 29 additions & 8 deletions data/gnomato.ui
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="DialogTask">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
Expand Down Expand Up @@ -165,6 +168,9 @@
<property name="window_position">center-always</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox">
<property name="can_focus">False</property>
Expand Down Expand Up @@ -462,6 +468,9 @@
<property name="can_focus">False</property>
<property name="default_width">580</property>
<property name="default_height">320</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="vbxMain">
<property name="visible">True</property>
Expand Down Expand Up @@ -599,10 +608,10 @@
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">00:00</property>
<property name="single_line_mode">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="font-desc" value="Sans 40"/>
<attribute name="style" value="normal"/>
Expand Down Expand Up @@ -642,13 +651,15 @@
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="btnStart">
<property name="label" translatable="yes">Start</property>
<property name="label">gtk-media-play</property>
<property name="use_action_appearance">False</property>
<property name="width_request">100</property>
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -658,12 +669,13 @@
</child>
<child>
<object class="GtkButton" id="btnRestart">
<property name="label" translatable="yes">Restart</property>
<property name="label">gtk-refresh</property>
<property name="use_action_appearance">False</property>
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -716,6 +728,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<accelerator key="c" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -730,6 +743,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -867,6 +881,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_length">200</property>
<accelerator key="f" signal="grab-focus" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">True</property>
Expand Down Expand Up @@ -894,6 +909,7 @@
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
<accelerator key="l" signal="grab-focus" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
</object>
Expand Down Expand Up @@ -924,6 +940,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -939,6 +956,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -1003,8 +1021,8 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="xalign">2.2351741291171123e-10</property>
<property name="lines">1</property>
<property name="xalign">2.2351741291171123e-10</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -1021,12 +1039,15 @@
<property name="title" translatable="yes">Gnomato</property>
<property name="type_hint">dialog</property>
<property name="program_name">Gnomato</property>
<property name="version">1.0</property>
<property name="version">1.2.0</property>
<property name="website">http://diegorubin.com</property>
<property name="website_label" translatable="yes">Gnomato Website</property>
<property name="authors">Diego Rubin </property>
<property name="logo_icon_name">image-missing</property>
<property name="logo_icon_name">help-about</property>
<property name="license_type">gpl-2-0</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="aboutdialog-vbox1">
<property name="can_focus">False</property>
Expand Down
2 changes: 1 addition & 1 deletion src/win_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

WinMain::WinMain(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> &refGlade)
: Gtk::Window(cobject), m_refGlade(refGlade),
: Gtk::ShortcutsWindow(cobject), m_refGlade(refGlade),

lblDisplay(0)

Expand Down
96 changes: 47 additions & 49 deletions src/win_main.h
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/*!
* win_main.h
* Copyright (C) Diego Rubin 2011 <[email protected]>
*
* Gnomato is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Gnomato 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Diego Rubin <[email protected]>
*
*/
* win_main.h
* Copyright (C) Diego Rubin 2011 <[email protected]>
*
* Gnomato is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Gnomato 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Diego Rubin <[email protected]>
*
*/

#ifndef _WIN_MAIN_H_
#define _WIN_MAIN_H_

#include <gtkmm.h>
#include <glibmm/i18n.h>
#include <libnotify/notify.h>
#include <gtkmm.h>
#include <iostream>
#include <libnotify/notify.h>
#include <sstream>

#include "boost/date_time/posix_time/posix_time.hpp"
#include "boost/date_time/posix_time/posix_time.hpp"

#include "config.h"
#include "dialog_preferences.h"
#include "dialog_task.h"
#include "python_executor.h"
#include "task.h"
#include "task_list.h"
#include "dialog_task.h"
#include "dialog_preferences.h"
#include "config.h"
#include "utils.h"
#include "python_executor.h"

using namespace Gtk;
using namespace boost::posix_time;

const int MINUTE_IN_SECONDS = 60000;

class WinMain: public Gtk::Window
{
class WinMain : public Gtk::ShortcutsWindow {
public:
WinMain(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& refGlade);
WinMain(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &refGlade);
virtual ~WinMain();

void on_menu_file_new_task();
Expand All @@ -64,25 +63,25 @@ class WinMain: public Gtk::Window
Glib::ustring get_cycle();

private:

class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
public:
ModelColumns()
{ add(id); add(title); }
Gtk::TreeModelColumn<Glib::ustring> id;
Gtk::TreeModelColumn<Glib::ustring> title;
ModelColumns() {
add(id);
add(title);
}
Gtk::TreeModelColumn<Glib::ustring> id;
Gtk::TreeModelColumn<Glib::ustring> title;
};

class TasksView: public Gtk::TreeView
{

class TasksView : public Gtk::TreeView {

public:
TasksView(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& refGlade);

TasksView(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> &refGlade);

void set_win_main_ref(WinMain *win_main);
Glib::RefPtr<Gtk::Builder> m_refGlade;
virtual void on_drag_end(const Glib::RefPtr< Gdk::DragContext >& context);
virtual void on_drag_end(const Glib::RefPtr<Gdk::DragContext> &context);
virtual void on_menu_move_task();
virtual bool on_button_press_event(GdkEventButton *ev);

Expand All @@ -94,13 +93,13 @@ class WinMain: public Gtk::Window
bool showed;
bool started;
unsigned int time_elapsed;
unsigned int minutes,seconds;
unsigned int minutes, seconds;
int cycle_number;

Config configs;

Task *currentTask;
std::list<TaskList*> lists;
std::list<TaskList *> lists;

// For pomodoro
sigc::slot<bool> timer;
Expand Down Expand Up @@ -150,7 +149,7 @@ class WinMain: public Gtk::Window

PythonExecutor *pe;

//dialogs
// dialogs
DialogTask *dlgTask;
AboutDialog *abtDialog;

Expand All @@ -165,7 +164,7 @@ class WinMain: public Gtk::Window
void notify_with_green_icon(const char *message);
void notify_with_gray_icon(const char *message);

Task* get_current_task();
Task *get_current_task();
void inc_current_task();
void execute(string script);
void run_python_script(string script);
Expand All @@ -188,8 +187,8 @@ class WinMain: public Gtk::Window
virtual void on_button_finish_clicked();
virtual void on_button_cancel_clicked();
virtual void on_button_clear_list_clicked();
virtual void on_treeview_tasks_row_activated(const TreeModel::Path& path,
TreeViewColumn* column);
virtual void on_treeview_tasks_row_activated(const TreeModel::Path &path,
TreeViewColumn *column);
virtual void on_button_del_task_clicked();
virtual bool on_timeout(int timer_number);
virtual bool on_inactive_timeout(int timer_number);
Expand All @@ -203,7 +202,6 @@ class WinMain: public Gtk::Window

// callback methods - window
virtual void on_resize();

};

#endif //__WIN_MAIN_H_

0 comments on commit 4650107

Please sign in to comment.