#include "folder.h"
#include "scoring.h"
+#include "matcher_parser.h"
+
static struct Scoring {
GtkWidget *window;
pointer to the function for widget setting
*/
-#define VSPACING 12
-#define VSPACING_NARROW 4
-#define DEFAULT_ENTRY_WIDTH 80
-#define PREFSBUFSIZE 1024
-
/* widget creating functions */
static void prefs_scoring_create (void);
if (prefs_rc_is_readonly(SCORING_RC))
return;
- inc_autocheck_timer_remove();
+ inc_lock();
if (!scoring.window) {
prefs_scoring_create();
void prefs_scoring_open_with_scoring(ScoringProp * prop)
{
- inc_autocheck_timer_remove();
+ inc_lock();
if (!scoring.window) {
prefs_scoring_create();
GtkWidget *kill_score_entry;
GtkWidget *kill_score_label;
- gchar *title[] = {_("Registered rules")};
+ gchar *title[1];
- debug_print(_("Creating scoring setting window...\n"));
+ debug_print("Creating scoring setting window...\n");
window = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
GTK_SIGNAL_FUNC(prefs_scoring_deleted), NULL);
gtk_signal_connect (GTK_OBJECT(window), "key_press_event",
GTK_SIGNAL_FUNC(prefs_scoring_key_pressed), NULL);
- gtk_signal_connect (GTK_OBJECT(window), "focus_in_event",
- GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
- gtk_signal_connect (GTK_OBJECT(window), "focus_out_event",
- GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
+ MANAGE_WINDOW_SIGNALS_CONNECT (window);
gtk_signal_connect (GTK_OBJECT(ok_btn), "clicked",
GTK_SIGNAL_FUNC(prefs_scoring_ok), NULL);
gtk_signal_connect (GTK_OBJECT(cancel_btn), "clicked",
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+ title[0] = _("Registered rules");
cond_clist = gtk_clist_new_with_titles(1, title);
gtk_widget_show (cond_clist);
gtk_container_add (GTK_CONTAINER (cond_scrolledwin), cond_clist);
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);
- kill_score_label = gtk_label_new (_("Kill score"));
+ kill_score_label = gtk_label_new (_("Hide score"));
gtk_widget_show (kill_score_label);
gtk_misc_set_alignment (GTK_MISC (kill_score_label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox1), kill_score_label,
ScoringProp *prop;
GSList * cur;
gchar * scoring_str;
- gchar * tmp;
GSList * prefs_scoring;
if (cur_item == NULL)
while (gtk_clist_get_text(GTK_CLIST(scoring.cond_clist),
row, 0, &scoring_str)) {
if (strcmp(scoring_str, _("(New)")) != 0) {
- tmp = scoring_str;
- prop = scoringprop_parse(&tmp);
+ prop = matcher_parser_get_scoring(scoring_str);
if (prop != NULL)
prefs_scoring = g_slist_append(prefs_scoring,
prop);
cond_str = gtk_entry_get_text(GTK_ENTRY(scoring.cond_entry));
if (*cond_str != '\0') {
- gchar * tmp;
-
- tmp = cond_str;
- matchers = matcherlist_parse(&tmp);
- if (tmp == NULL)
+ matchers = matcher_parser_get_cond(cond_str);
+ if (matchers == NULL)
alertpanel_error(_("Match string is not valid."));
}
gchar * score_str;
ScoringProp * prop;
gint score;
- gchar * tmp;
cond_str = gtk_entry_get_text(GTK_ENTRY(scoring.cond_entry));
if (*cond_str == '\0') {
}
score = atoi(score_str);
- tmp = cond_str;
- cond = matcherlist_parse(&tmp);
+ cond = matcher_parser_get_cond(cond_str);
- if (tmp == NULL) {
+ if (cond == NULL) {
alertpanel_error(_("Match string is not valid."));
return;
}
gchar * score_str;
ScoringProp * prop;
gint score;
- gchar * tmp;
if (!clist->selection) return;
}
score = atoi(score_str);
- tmp = cond_str;
- cond = matcherlist_parse(&tmp);
+ cond = matcher_parser_get_cond(cond_str);
- if (tmp == NULL) {
+ if (cond == NULL) {
alertpanel_error(_("Match string is not valid."));
return;
}
row = GPOINTER_TO_INT(clist->selection->data);
if (row > 1) {
gtk_clist_row_move(clist, row, row - 1);
+ if(gtk_clist_row_is_visible(clist, row - 1) != GTK_VISIBILITY_FULL) {
+ gtk_clist_moveto(clist, row - 1, 0, 0, 0);
+ }
}
}
row = GPOINTER_TO_INT(clist->selection->data);
if (row > 0 && row < clist->rows - 1) {
gtk_clist_row_move(clist, row, row + 1);
+ if(gtk_clist_row_is_visible(clist, row + 1) != GTK_VISIBILITY_FULL) {
+ gtk_clist_moveto(clist, row + 1, 0, 1, 0);
+ }
}
}
GdkEvent *event)
{
ScoringProp * prop;
- gchar * tmp;
gchar * scoring_str;
row, 0, &scoring_str))
return;
- tmp = scoring_str;
- prop = scoringprop_parse(&tmp);
- if (tmp == NULL)
+ prop = matcher_parser_get_scoring(scoring_str);
+ if (prop == NULL)
return;
prefs_scoring_select_set_dialog(prop);
static void prefs_scoring_ok(void)
{
+ prefs_common_save_config();
prefs_scoring_set_list();
- prefs_scoring_write_config();
+ prefs_matcher_write_config();
if (cur_item != NULL)
prefs_folder_item_save_config(cur_item);
gtk_widget_hide(scoring.window);
+ inc_unlock();
}
static void prefs_scoring_cancel(void)
{
- prefs_scoring_read_config();
+ prefs_matcher_read_config();
gtk_widget_hide(scoring.window);
+ inc_unlock();
}