Example #1
0
static void
log_window_button_previous_clicked_cb (GtkWidget       *widget,
				       EmpathyLogWindow *window)
{
	if (window->last_find) {
		gboolean can_do_previous;
		gboolean can_do_next;

		empathy_chat_view_find_previous (window->chatview_find,
						window->last_find,
						FALSE);
		empathy_chat_view_find_abilities (window->chatview_find,
						 window->last_find,
						 &can_do_previous,
						 &can_do_next);
		gtk_widget_set_sensitive (window->button_previous, can_do_previous);
		gtk_widget_set_sensitive (window->button_next, can_do_next);
	}
}
Example #2
0
static void
empathy_search_bar_search (EmpathySearchBar *self,
    gboolean next,
    gboolean new_search)
{
  gchar *search;
  gboolean found;
  gboolean match_case;
  EmpathySearchBarPriv *priv;

  priv = GET_PRIV (self);

  search = gtk_editable_get_chars (GTK_EDITABLE(priv->search_entry), 0, -1);
  match_case = gtk_toggle_button_get_active (
      GTK_TOGGLE_BUTTON (priv->search_match_case));

  /* highlight & search */
  empathy_chat_view_highlight (priv->chat_view, search, match_case);
  if (next)
    {
      found = empathy_chat_view_find_next (priv->chat_view,
          search,
          new_search,
          match_case);
    }
  else
    {
      found = empathy_chat_view_find_previous (priv->chat_view,
          search,
          new_search,
          match_case);
    }

  /* (don't) display the not found label */
  gtk_widget_set_visible (priv->search_not_found,
      !(found || EMP_STR_EMPTY (search)));

  /* update the buttons */
  empathy_search_bar_update_buttons (self, search, match_case);

  g_free (search);
}