Impelment changing of project description/notes

This commit is contained in:
Nedko Arnaudov 2008-07-05 02:04:31 +03:00
parent 5bb2b68e05
commit 437d33b35c
7 changed files with 150 additions and 24 deletions

View File

@ -638,7 +638,7 @@ struct loadable_project_list_column_record : public Gtk::TreeModel::ColumnRecord
{
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> modified;
Gtk::TreeModelColumn<Glib::ustring> comment;
Gtk::TreeModelColumn<Glib::ustring> description;
};
static
@ -711,7 +711,7 @@ public:
_columns.add(_columns.name);
_columns.add(_columns.modified);
_columns.add(_columns.comment);
_columns.add(_columns.description);
_model = Gtk::ListStore::create(_columns);
_widget->set_model(_model);
@ -719,7 +719,7 @@ public:
_widget->remove_all_columns();
_widget->append_column("Project Name", _columns.name);
_widget->append_column("Modified", _columns.modified);
_widget->append_column("Comment", _columns.comment);
_widget->append_column("Description", _columns.description);
}
void
@ -736,7 +736,7 @@ public:
row[_columns.name] = iter->name;
convert_timestamp_to_string(iter->modification_time, str);
row[_columns.modified] = str;
row[_columns.comment] = iter->comment;
row[_columns.description] = iter->description;
}
_widget->signal_button_press_event().connect(sigc::mem_fun(*this, &load_project_dialog::on_load_project_dialog_button_press_event), false);

View File

@ -334,6 +334,7 @@ lash_proxy::get_available_projects(
const char * key;
const char * value_type;
dbus_uint32_t value_uint32;
const char * value_string;
lash_project_info project_info;
if (!_impl_ptr->call(true, LASH_IFACE_CONTROL, "GetProjects", &reply_ptr, DBUS_TYPE_INVALID))
@ -361,6 +362,7 @@ lash_proxy::get_available_projects(
project_info.name = project_name;
project_info.modification_time = 0;
project_info.description.erase();
dbus_message_iter_next(&struct_iter);
@ -378,8 +380,18 @@ lash_proxy::get_available_projects(
switch (*value_type)
{
case DBUS_TYPE_UINT32:
dbus_message_iter_get_basic(&variant_iter, &value_uint32);
project_info.modification_time = value_uint32;
if (strcmp(key, "Modification Time") == 0)
{
dbus_message_iter_get_basic(&variant_iter, &value_uint32);
project_info.modification_time = value_uint32;
}
break;
case DBUS_TYPE_STRING:
if (strcmp(key, "Description") == 0)
{
dbus_message_iter_get_basic(&variant_iter, &value_string);
project_info.description = value_string;
}
break;
}
}
@ -550,17 +562,17 @@ lash_proxy::get_loaded_project_properties(
switch (*value_type)
{
case DBUS_TYPE_BOOLEAN:
if (strcmp(key, "Modified Status"))
if (strcmp(key, "Modified Status") == 0)
{
dbus_message_iter_get_basic(&variant_iter, &value_bool);
properties.modified_status = value_bool;
}
break;
case DBUS_TYPE_STRING:
if (strcmp(key, "Comment"))
if (strcmp(key, "Description") == 0)
{
dbus_message_iter_get_basic(&variant_iter, &value_string);
properties.modified_status = value_string;
properties.description = value_string;
}
break;
}
@ -570,3 +582,57 @@ lash_proxy::get_loaded_project_properties(
unref:
dbus_message_unref(reply_ptr);
}
void
lash_proxy::project_set_description(
const string& project_name,
const string& description)
{
DBusMessage * reply_ptr;
const char * project_name_cstr;
const char * description_cstr;
project_name_cstr = project_name.c_str();
description_cstr = description.c_str();
if (!_impl_ptr->call(
true,
LASH_IFACE_CONTROL,
"SetLoadedProjectDescription",
&reply_ptr,
DBUS_TYPE_STRING, &project_name_cstr,
DBUS_TYPE_STRING, &description_cstr,
DBUS_TYPE_INVALID))
{
return;
}
dbus_message_unref(reply_ptr);
}
void
lash_proxy::project_set_notes(
const string& project_name,
const string& notes)
{
DBusMessage * reply_ptr;
const char * project_name_cstr;
const char * notes_cstr;
project_name_cstr = project_name.c_str();
notes_cstr = notes.c_str();
if (!_impl_ptr->call(
true,
LASH_IFACE_CONTROL,
"SetLoadedProjectNotes",
&reply_ptr,
DBUS_TYPE_STRING, &project_name_cstr,
DBUS_TYPE_STRING, &notes_cstr,
DBUS_TYPE_INVALID))
{
return;
}
dbus_message_unref(reply_ptr);
}

View File

@ -25,13 +25,14 @@ struct lash_project_info
{
string name;
time_t modification_time;
string comment;
string description;
};
struct lash_loaded_project_properties
{
bool modified_status;
string comment;
string description;
string notes;
};
class session;
@ -52,6 +53,8 @@ public:
void close_all_projects();
void project_rename(const string& old_name, const string& new_name);
void get_loaded_project_properties(const string& name, lash_loaded_project_properties& properties);
void project_set_description(const string& project_name, const string& description);
void project_set_notes(const string& project_name, const string& notes);
private:
lash_proxy_impl * _impl_ptr;

View File

@ -725,12 +725,10 @@ Nedko Arnaudov &lt;nedko@arnaudov.name&gt;</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkEntry" id="short_comment">
<widget class="GtkEntry" id="project_description">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="text" translatable="yes">not implemented yet</property>
</widget>
</child>
<child>
@ -757,14 +755,12 @@ Nedko Arnaudov &lt;nedko@arnaudov.name&gt;</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkTextView" id="long_comment">
<widget class="GtkTextView" id="project_notes">
<property name="width_request">300</property>
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="text" translatable="yes">not implemented yet</property>
</widget>
</child>
<child>

View File

@ -24,7 +24,8 @@ struct project_impl
{
lash_proxy * lash_ptr;
string name;
string comment;
string description;
string notes;
bool modified_status;
};
@ -40,7 +41,8 @@ project::project(
_impl_ptr->lash_ptr = lash_ptr;
_impl_ptr->name = name;
_impl_ptr->comment = properties.comment;
_impl_ptr->description = properties.description;
_impl_ptr->notes = properties.notes;
_impl_ptr->modified_status = properties.modified_status;
}
@ -65,9 +67,17 @@ project::on_name_changed(
}
void
project::get_comment(
string& comment)
project::get_description(
string& description)
{
description = _impl_ptr->description;
}
void
project::get_notes(
string& notes)
{
notes = _impl_ptr->notes;
}
bool
@ -88,5 +98,28 @@ void
project::do_rename(
const string& name)
{
_impl_ptr->lash_ptr->project_rename(_impl_ptr->name, name);
if (_impl_ptr->name != name)
{
_impl_ptr->lash_ptr->project_rename(_impl_ptr->name, name);
}
}
void
project::do_change_description(
const string& description)
{
if (_impl_ptr->description != description)
{
_impl_ptr->lash_ptr->project_set_description(_impl_ptr->name, description);
}
}
void
project::do_change_notes(
const string& notes)
{
if (_impl_ptr->notes != notes)
{
_impl_ptr->lash_ptr->project_set_notes(_impl_ptr->name, notes);
}
}

View File

@ -37,8 +37,12 @@ public:
string& name);
void
get_comment(
string& comment);
get_description(
string& description);
void
get_notes(
string& notes);
bool
get_modified_status();
@ -47,6 +51,14 @@ public:
do_rename(
const string& name);
void
do_change_description(
const string& description);
void
do_change_notes(
const string& notes);
signal<void> _signal_renamed;
signal<void> _signal_modified_status_changed;

View File

@ -29,6 +29,8 @@ struct project_properties_dialog_impl
{
Widget<Gtk::Dialog> _dialog;
Widget<Gtk::Entry> _name;
Widget<Gtk::Entry> _description;
Widget<Gtk::TextView> _notes;
project_properties_dialog_impl();
};
@ -49,15 +51,27 @@ project_properties_dialog::run(
shared_ptr<project> project_ptr)
{
string name;
string description;
string notes;
Glib::RefPtr<Gtk::TextBuffer> buffer;
int result;
project_ptr->get_name(name);
_impl_ptr->_name->set_text(name);
project_ptr->get_description(description);
_impl_ptr->_description->set_text(description);
project_ptr->get_notes(notes);
buffer = _impl_ptr->_notes->get_buffer();
buffer->set_text(notes);
result = _impl_ptr->_dialog->run();
if (result == 2)
{
project_ptr->do_rename(_impl_ptr->_name->get_text());
project_ptr->do_change_description(_impl_ptr->_description->get_text());
project_ptr->do_change_notes(buffer->get_text());
}
_impl_ptr->_dialog->hide();
@ -67,4 +81,6 @@ project_properties_dialog_impl::project_properties_dialog_impl()
{
_dialog.init(g_xml, "project_properties_dialog");
_name.init(g_xml, "project_name");
_description.init(g_xml, "project_description");
_notes.init(g_xml, "project_notes");
}