Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 25 Sep 2014 15:05:55 UTC Commit: 187dca29573f9247dab607738274341b08e105a1 https://github.com/geany/geany/commit/187dca29573f9247dab607738274341b08e105...
Log Message: ----------- Use named constants everywhere for msgwin/compiler internal columns
Modified Paths: -------------- src/msgwindow.c
Modified: src/msgwindow.c 31 lines changed, 20 insertions(+), 11 deletions(-) =================================================================== @@ -75,6 +75,13 @@ enum MSG_COL_COUNT };
+enum +{ + COMPILER_COL_COLOR = 0, + COMPILER_COL_STRING, + COMPILER_COL_COUNT +}; +
static void prepare_msg_tree_view(void); static void prepare_status_tree_view(void); @@ -194,7 +201,7 @@ static void prepare_msg_tree_view(void)
renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(NULL, renderer, - "foreground-gdk", 2, "text", 3, NULL); + "foreground-gdk", MSG_COL_COLOR, "text", MSG_COL_STRING, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(msgwindow.tree_msg), column);
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(msgwindow.tree_msg), FALSE); @@ -225,12 +232,13 @@ static void prepare_compiler_tree_view(void) GtkTreeViewColumn *column; GtkTreeSelection *selection;
- msgwindow.store_compiler = gtk_list_store_new(2, GDK_TYPE_COLOR, G_TYPE_STRING); + msgwindow.store_compiler = gtk_list_store_new(COMPILER_COL_COUNT, GDK_TYPE_COLOR, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(msgwindow.tree_compiler), GTK_TREE_MODEL(msgwindow.store_compiler)); g_object_unref(msgwindow.store_compiler);
renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(NULL, renderer, "foreground-gdk", 0, "text", 1, NULL); + column = gtk_tree_view_column_new_with_attributes(NULL, renderer, + "foreground-gdk", COMPILER_COL_COLOR, "text", COMPILER_COL_STRING, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(msgwindow.tree_compiler), column);
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(msgwindow.tree_compiler), FALSE); @@ -304,7 +312,8 @@ void msgwin_compiler_add_string(gint msg_color, const gchar *msg) utf8_msg = (gchar *) msg;
gtk_list_store_append(msgwindow.store_compiler, &iter); - gtk_list_store_set(msgwindow.store_compiler, &iter, 0, color, 1, utf8_msg, -1); + gtk_list_store_set(msgwindow.store_compiler, &iter, + COMPILER_COL_COLOR, color, COMPILER_COL_STRING, utf8_msg, -1);
if (ui_prefs.msgwindow_visible && interface_prefs.compiler_tab_autoscroll) { @@ -458,7 +467,7 @@ on_compiler_treeview_copy_activate(GtkMenuItem *menuitem, gpointer user_data) GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; - gint str_idx = 1; + gint str_idx = COMPILER_COL_STRING;
switch (GPOINTER_TO_INT(user_data)) { @@ -473,7 +482,7 @@ on_compiler_treeview_copy_activate(GtkMenuItem *menuitem, gpointer user_data)
case MSG_MESSAGE: tv = msgwindow.tree_msg; - str_idx = 3; + str_idx = MSG_COL_STRING; break; } selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); @@ -498,7 +507,7 @@ static void on_compiler_treeview_copy_all_activate(GtkMenuItem *menuitem, gpoint GtkListStore *store = msgwindow.store_compiler; GtkTreeIter iter; GString *str = g_string_new(""); - gint str_idx = 1; + gint str_idx = COMPILER_COL_STRING; gboolean valid;
switch (GPOINTER_TO_INT(user_data)) @@ -514,7 +523,7 @@ static void on_compiler_treeview_copy_all_activate(GtkMenuItem *menuitem, gpoint
case MSG_MESSAGE: store = msgwindow.store_msg; - str_idx = 3; + str_idx = MSG_COL_STRING; break; }
@@ -624,7 +633,7 @@ find_prev_build_dir(GtkTreePath *cur, GtkTreeModel *model, gchar **prefix) if (gtk_tree_model_get_iter(model, &iter, cur)) { gchar *string; - gtk_tree_model_get(model, &iter, 1, &string, -1); + gtk_tree_model_get(model, &iter, COMPILER_COL_STRING, &string, -1); if (string != NULL && build_parse_make_dir(string, prefix)) { g_free(string); @@ -710,7 +719,7 @@ gboolean msgwin_goto_compiler_file_line(gboolean focus_editor) if (gtk_tree_selection_get_selected(selection, &model, &iter)) { /* if the item is not coloured red, it's not an error line */ - gtk_tree_model_get(model, &iter, 0, &color, -1); + gtk_tree_model_get(model, &iter, COMPILER_COL_COLOR, &color, -1); if (color == NULL || ! gdk_color_equal(color, &color_error)) { if (color != NULL) @@ -719,7 +728,7 @@ gboolean msgwin_goto_compiler_file_line(gboolean focus_editor) } gdk_color_free(color);
- gtk_tree_model_get(model, &iter, 1, &string, -1); + gtk_tree_model_get(model, &iter, COMPILER_COL_STRING, &string, -1); if (string != NULL) { gint line;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).