[gnome-commander] advrename: setup component on received "show" signal
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] advrename: setup component on received "show" signal
- Date: Sat, 2 Jul 2011 09:30:45 +0000 (UTC)
commit 1590376a9a574de36a171c0f9bdcb3efa75402a5
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Sat Jul 2 11:27:24 2011 +0200
advrename: setup component on received "show" signal
src/dialogs/gnome-cmd-advrename-dialog.cc | 8 ++++++++
src/dialogs/gnome-cmd-edit-profile-dialog.h | 2 ++
src/gnome-cmd-advrename-profile-component.cc | 10 +---------
3 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-advrename-dialog.cc b/src/dialogs/gnome-cmd-advrename-dialog.cc
index 2f1e552..8f2b73d 100644
--- a/src/dialogs/gnome-cmd-advrename-dialog.cc
+++ b/src/dialogs/gnome-cmd-advrename-dialog.cc
@@ -81,6 +81,7 @@ struct GnomeCmdAdvrenameDialog::Private
static void on_files_view_row_activated (GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, GnomeCmdAdvrenameDialog *dialog);
static void on_files_view_cursor_changed (GtkTreeView *view, GnomeCmdAdvrenameDialog *dialog);
+ static void on_dialog_show (GtkWidget *widget, GnomeCmdAdvrenameDialog *dialog);
static gboolean on_dialog_delete (GtkWidget *widget, GdkEvent *event, GnomeCmdAdvrenameDialog *dialog);
static void on_dialog_size_allocate (GtkWidget *widget, GtkAllocation *allocation, GnomeCmdAdvrenameDialog *dialog);
static void on_dialog_response (GnomeCmdAdvrenameDialog *dialog, int response_id, gpointer data);
@@ -416,6 +417,12 @@ void GnomeCmdAdvrenameDialog::Private::on_files_view_cursor_changed (GtkTreeView
}
+void GnomeCmdAdvrenameDialog::Private::on_dialog_show(GtkWidget *widget, GnomeCmdAdvrenameDialog *dialog)
+{
+ dialog->priv->profile_component->update();
+}
+
+
gboolean GnomeCmdAdvrenameDialog::Private::on_dialog_delete (GtkWidget *widget, GdkEvent *event, GnomeCmdAdvrenameDialog *dialog)
{
return event->type==GDK_DELETE;
@@ -705,6 +712,7 @@ GnomeCmdAdvrenameDialog::GnomeCmdAdvrenameDialog(GnomeCmdData::AdvrenameConfig &
g_signal_connect (priv->files_view, "row-activated", G_CALLBACK (Private::on_files_view_row_activated), this);
g_signal_connect (priv->files_view, "cursor-changed", G_CALLBACK (Private::on_files_view_cursor_changed), this);
+ g_signal_connect (this, "show", G_CALLBACK (Private::on_dialog_show), this);
g_signal_connect (this, "delete-event", G_CALLBACK (Private::on_dialog_delete), this);
g_signal_connect (this, "size-allocate", G_CALLBACK (Private::on_dialog_size_allocate), this);
g_signal_connect (this, "response", G_CALLBACK (Private::on_dialog_response), this);
diff --git a/src/dialogs/gnome-cmd-edit-profile-dialog.h b/src/dialogs/gnome-cmd-edit-profile-dialog.h
index 5a4c61c..6b250be 100644
--- a/src/dialogs/gnome-cmd-edit-profile-dialog.h
+++ b/src/dialogs/gnome-cmd-edit-profile-dialog.h
@@ -133,6 +133,8 @@ namespace GnomeCmd
component = new COMPONENT(profile);
gtk_container_add (GTK_CONTAINER (vbox), *component);
+ component->update();
+
#if GTK_CHECK_VERSION (2, 14, 0)
gtk_widget_show_all (content_area);
#else
diff --git a/src/gnome-cmd-advrename-profile-component.cc b/src/gnome-cmd-advrename-profile-component.cc
index a16dc94..70bedfd 100644
--- a/src/gnome-cmd-advrename-profile-component.cc
+++ b/src/gnome-cmd-advrename-profile-component.cc
@@ -1124,23 +1124,16 @@ static void gnome_cmd_advrename_profile_component_class_init (GnomeCmdAdvrenameP
GnomeCmdAdvrenameProfileComponent::GnomeCmdAdvrenameProfileComponent(GnomeCmdData::AdvrenameConfig::Profile &p): profile(p)
{
// Template
- gtk_entry_set_text (GTK_ENTRY (priv->template_entry), profile.template_string.empty() ? "$N" : profile.template_string.c_str());
- gtk_editable_set_position (GTK_EDITABLE (priv->template_entry), -1);
gtk_widget_grab_focus (priv->template_entry);
- gtk_entry_select_region (GTK_ENTRY (priv->template_entry), -1, -1);
g_signal_connect (priv->template_combo, "changed", G_CALLBACK (Private::on_template_entry_changed), this);
// Counter
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->counter_start_spin), profile.counter_start);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->counter_step_spin), profile.counter_step);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->counter_digits_spin), profile.counter_width);
g_signal_connect (priv->counter_start_spin, "value-changed", G_CALLBACK (Private::on_counter_start_spin_value_changed), this);
g_signal_connect (priv->counter_step_spin, "value-changed", G_CALLBACK (Private::on_counter_step_spin_value_changed), this);
g_signal_connect (priv->counter_digits_spin, "value-changed", G_CALLBACK (Private::on_counter_digits_spin_value_changed), this);
// Regex
priv->regex_model = create_regex_model ();
- priv->fill_regex_model(profile);
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->regex_view), priv->regex_model);
g_signal_connect (priv->regex_model, "row-deleted", G_CALLBACK (Private::on_regex_model_row_deleted), this);
@@ -1151,8 +1144,6 @@ GnomeCmdAdvrenameProfileComponent::GnomeCmdAdvrenameProfileComponent(GnomeCmdDat
g_signal_connect (priv->regex_remove_all_button, "clicked", G_CALLBACK (Private::on_regex_remove_all_btn_clicked), this);
// Case conversion & blank triming
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->case_combo), profile.case_conversion);
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->trim_combo), profile.trim_blanks);
g_signal_connect (priv->case_combo, "changed", G_CALLBACK (Private::on_case_combo_changed), this);
g_signal_connect (priv->trim_combo, "changed", G_CALLBACK (Private::on_trim_combo_changed), this);
}
@@ -1252,6 +1243,7 @@ void GnomeCmdAdvrenameProfileComponent::update()
{
gtk_entry_set_text (GTK_ENTRY (priv->template_entry), profile.template_string.empty() ? "$N" : profile.template_string.c_str());
gtk_editable_set_position (GTK_EDITABLE (priv->template_entry), -1);
+ gtk_editable_select_region (GTK_EDITABLE (priv->template_entry), -1, -1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->counter_start_spin), profile.counter_start);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->counter_step_spin), profile.counter_step);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]