Advertisement
Guest User

Log find count

a guest
Jan 18th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.00 KB | None | 0 0
  1. diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c
  2. --- a/pidgin/gtklog.c
  3. +++ b/pidgin/gtklog.c
  4. @@ -420,10 +420,24 @@
  5.  
  6.  static gboolean search_find_cb(gpointer data)
  7.  {
  8. +   char *textC;
  9. +   guint count;
  10.     PidginLogViewer *viewer = data;
  11. -   webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, 0);
  12. +
  13. +   count = webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, 0);
  14.     webkit_web_view_set_highlight_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), TRUE);
  15.     webkit_web_view_search_text(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, TRUE, TRUE);
  16. +
  17. +   if (count){
  18. +       textC = g_strdup_printf("<span weight='bold'>%s</span> %d", _("Matches found:"), count);
  19. +       gtk_label_set_markup(GTK_LABEL(viewer->label), textC);
  20. +   }
  21. +   else{
  22. +       textC = g_strdup_printf("<span weight='bold'>%s</span>", _("No matches found!"));
  23. +       gtk_label_set_markup(GTK_LABEL(viewer->label), textC);
  24. +   }
  25. +
  26. +   g_free(textC);
  27.     return FALSE;
  28.  }
  29.  
  30. @@ -448,17 +462,19 @@
  31.  
  32.     pidgin_set_cursor(viewer->window, GDK_WATCH);
  33.  
  34. -   if (log->type != PURPLE_LOG_SYSTEM) {
  35. -       char *title;
  36. -       if (log->type == PURPLE_LOG_CHAT)
  37. -           title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation in %s on %s</span>"),
  38. +   if (viewer->search == NULL) {
  39. +       if (log->type != PURPLE_LOG_SYSTEM) {
  40. +           char *title;
  41. +           if (log->type == PURPLE_LOG_CHAT)
  42. +               title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation in %s on %s</span>"),
  43.                                     log->name, log_get_date(log));
  44. -       else
  45. -           title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation with %s on %s</span>"),
  46. +           else
  47. +               title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation with %s on %s</span>"),
  48.                                     log->name, log_get_date(log));
  49.  
  50. -       gtk_label_set_markup(GTK_LABEL(viewer->label), title);
  51. -       g_free(title);
  52. +           gtk_label_set_markup(GTK_LABEL(viewer->label), title);
  53. +           g_free(title);
  54. +       }
  55.     }
  56.  
  57.     read = purple_log_read(log, &flags);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement