Skip to content

Commit

Permalink
feature #74 base of new dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
diegorubin committed Jul 1, 2020
1 parent 0c512ef commit 8bfb1f2
Show file tree
Hide file tree
Showing 6 changed files with 355 additions and 163 deletions.
91 changes: 86 additions & 5 deletions data/gnomato.ui
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.22.2 -->
<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>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
Expand Down Expand Up @@ -135,6 +135,78 @@
<action-widget response="0">btnTaskOk</action-widget>
</action-widgets>
</object>
<object class="GtkDialog" id="DialogWorkLogEntries">
<property name="name">DialogWorkLogEntries</property>
<property name="can_focus">False</property>
<property name="window_position">center</property>
<property name="type_hint">dialog</property>
<property name="gravity">center</property>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="name">DialogWorkLogEntries</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="btnWorkLogCancel">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="name">btnWorkLogCancel</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>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnWorkLogSave">
<property name="label">gtk-save</property>
<property name="name">btnWorkLogSave</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Save Changes</property>
<property name="use_stock">True</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">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">btnWorkLogCancel</action-widget>
</action-widgets>
</object>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-justify-center</property>
</object>
<object class="GtkAction" id="action1"/>
<object class="GtkAdjustment" id="adjInactiveInterval">
<property name="lower">1</property>
Expand Down Expand Up @@ -168,7 +240,7 @@
<property name="window_position">center-always</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<child>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
Expand Down Expand Up @@ -468,7 +540,7 @@
<property name="can_focus">False</property>
<property name="default_width">580</property>
<property name="default_height">320</property>
<child>
<child type="titlebar">
<placeholder/>
</child>
<child>
Expand Down Expand Up @@ -544,6 +616,15 @@
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnuWorkLogEntries">
<property name="label" translatable="yes">Worklog</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
</object>
</child>
</object>
</child>
</object>
Expand Down Expand Up @@ -1045,7 +1126,7 @@
<property name="authors">Diego Rubin </property>
<property name="logo_icon_name">help-about</property>
<property name="license_type">gpl-2-0</property>
<child>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ gnomato_CPPFLAGS = \
gnomato_SOURCES = main.cc \
win_main.cc \
dialog_preferences.cc \
dialog_work_log_entries.cc \
dialog_task.cc \
database.cc \
task.cc \
Expand Down
47 changes: 47 additions & 0 deletions src/dialog_work_log_entries.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/*!
* dialog_preferences.cc
* Copyright (C) Diego Rubin 2020 <[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]>
*
*/

#include "dialog_work_log_entries.h"
#include <gdkmm/rgba.h>

DialogWorkLogEntries::DialogWorkLogEntries(
BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &refGlade)
: Gtk::Dialog(cobject), m_refGlade(refGlade) {

// buttons
m_refGlade->get_widget("btnWorkLogSave", btnOk);
m_refGlade->get_widget("btnWorkLogCancel", btnCancel);

// connect signals
btnCancel->signal_clicked().connect(
sigc::mem_fun(*this, &DialogWorkLogEntries::on_button_cancel_clicked));
btnOk->signal_clicked().connect(
sigc::mem_fun(*this, &DialogWorkLogEntries::on_button_ok_clicked));

show_all();
}

DialogWorkLogEntries::~DialogWorkLogEntries() {}

void DialogWorkLogEntries::on_button_cancel_clicked() { hide(); }

void DialogWorkLogEntries::on_button_ok_clicked() { hide(); }
50 changes: 50 additions & 0 deletions src/dialog_work_log_entries.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/*!
* dialog_preferences.h
* Copyright (C) Diego Rubin 2020 <[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_WORK_LOG_ENTRIES_H_
#define _WIN_WORK_LOG_ENTRIES_H_

#include <gtkmm.h>

using namespace Gtk;

class DialogWorkLogEntries : public Gtk::Dialog {
public:
DialogWorkLogEntries(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> &refGlade);

virtual ~DialogWorkLogEntries();

protected:
private:
// attributes
Button *btnOk;
Button *btnCancel;

Glib::RefPtr<Gtk::Builder> m_refGlade;

// callback methods
virtual void on_button_cancel_clicked();
virtual void on_button_ok_clicked();
};

#endif // WIN_WORK_LOG_ENTRIES
10 changes: 10 additions & 0 deletions src/win_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ WinMain::WinMain(BaseObjectType *cobject,
m_refGlade->get_widget("mnuNew", mnuNew);
m_refGlade->get_widget("mnuQuit", mnuQuit);
m_refGlade->get_widget("mnuPreferences", mnuPreferences);
m_refGlade->get_widget("mnuWorkLogEntries", mnuWorkLogEntries);
m_refGlade->get_widget("mnuAbout", mnuAbout);

m_refGlade->get_widget_derived("trvTasks", trvTasks);
Expand Down Expand Up @@ -125,6 +126,8 @@ WinMain::WinMain(BaseObjectType *cobject,
sigc::mem_fun(*this, &WinMain::on_menu_file_quit));
mnuPreferences->signal_activate().connect(
sigc::mem_fun(*this, &WinMain::on_menu_edit_preferences));
mnuWorkLogEntries->signal_activate().connect(
sigc::mem_fun(*this, &WinMain::on_menu_edit_work_log_entries));
mnuAbout->signal_activate().connect(
sigc::mem_fun(*this, &WinMain::on_menu_help_about));

Expand Down Expand Up @@ -669,6 +672,13 @@ void WinMain::on_menu_edit_preferences() {
configure_interface();
}

void WinMain::on_menu_edit_work_log_entries() {
DialogWorkLogEntries *dlgWorkLogEntries = 0;

m_refGlade->get_widget_derived("DialogWorkLogEntries", dlgWorkLogEntries);
dlgWorkLogEntries->run();
}

void WinMain::on_menu_help_about() {
m_refGlade->get_widget("winAbout", abtDialog);
abtDialog->run();
Expand Down
Loading

0 comments on commit 8bfb1f2

Please sign in to comment.