*/
#include "config.h"
+#include "empathy-search-bar.h"
-#include <glib.h>
-#include <glib-object.h>
#include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-
-#include <libempathy/empathy-utils.h>
-#include "empathy-chat-view.h"
-#include "empathy-search-bar.h"
#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathySearchBar)
-G_DEFINE_TYPE (EmpathySearchBar, empathy_search_bar, GTK_TYPE_BIN);
+G_DEFINE_TYPE (EmpathySearchBar, empathy_search_bar, GTK_TYPE_BOX);
typedef struct _EmpathySearchBarPriv EmpathySearchBarPriv;
struct _EmpathySearchBarPriv
{
- EmpathyChatView *chat_view;
+ EmpathyThemeAdium *chat_view;
GtkWidget *search_entry;
};
GtkWidget *
-empathy_search_bar_new (EmpathyChatView *view)
+empathy_search_bar_new (EmpathyThemeAdium *view)
{
EmpathySearchBar *self = g_object_new (EMPATHY_TYPE_SEARCH_BAR, NULL);
return GTK_WIDGET (self);
}
-static void
-empathy_search_bar_get_preferred_height (GtkWidget *widget,
- gint *minimun_height,
- gint *natural_height)
-{
- GtkBin *bin;
- GtkWidget *child;
-
- bin = GTK_BIN (widget);
- child = gtk_bin_get_child (bin);
-
- if (child && gtk_widget_get_visible (child))
- gtk_widget_get_preferred_height (child, minimun_height, natural_height);
-}
-
-static void
-empathy_search_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkWidget *child;
- GtkAllocation child_allocation;
-
- bin = GTK_BIN (widget);
- child = gtk_bin_get_child (bin);
-
- gtk_widget_set_allocation (widget, allocation);
-
- if (child && gtk_widget_get_visible (child))
- {
- child_allocation.x = allocation->x;
- child_allocation.y = allocation->y;
- child_allocation.width = MAX (allocation->width, 0);
- child_allocation.height = MAX (allocation->height, 0);
-
- gtk_widget_size_allocate (child, &child_allocation);
- }
-}
-
static void
empathy_search_bar_update_buttons (EmpathySearchBar *self,
gchar *search,
EmpathySearchBarPriv* priv = GET_PRIV (self);
/* update previous / next buttons */
- empathy_chat_view_find_abilities (priv->chat_view, search, match_case,
+ empathy_theme_adium_find_abilities (priv->chat_view, search, match_case,
&can_go_backward, &can_go_forward);
gtk_widget_set_sensitive (priv->search_previous,
GTK_TOGGLE_BUTTON (priv->search_match_case));
/* highlight & search */
- empathy_chat_view_highlight (priv->chat_view, search, match_case);
+ empathy_theme_adium_highlight (priv->chat_view, search, match_case);
/* update the buttons */
empathy_search_bar_update_buttons (self, search, match_case);
{
EmpathySearchBarPriv *priv = GET_PRIV (self);
- empathy_chat_view_highlight (priv->chat_view, "", FALSE);
+ empathy_theme_adium_highlight (priv->chat_view, "", FALSE);
gtk_widget_hide (GTK_WIDGET (self));
/* give the focus back to the focus-chain with the chat view */
GTK_TOGGLE_BUTTON (priv->search_match_case));
/* highlight & search */
- empathy_chat_view_highlight (priv->chat_view, search, match_case);
+ empathy_theme_adium_highlight (priv->chat_view, search, match_case);
if (next)
{
- found = empathy_chat_view_find_next (priv->chat_view,
+ found = empathy_theme_adium_find_next (priv->chat_view,
search,
new_search,
match_case);
}
else
{
- found = empathy_chat_view_find_previous (priv->chat_view,
+ found = empathy_theme_adium_find_previous (priv->chat_view,
search,
new_search,
match_case);
g_signal_connect (G_OBJECT (self), "key-press-event",
G_CALLBACK (empathy_search_bar_key_pressed), NULL);
- gtk_container_add (GTK_CONTAINER (self), internal);
+ gtk_box_pack_start (GTK_BOX (self), internal, TRUE, TRUE, 0);
gtk_widget_show_all (internal);
gtk_widget_hide (priv->search_not_found);
g_object_unref (gui);
empathy_search_bar_class_init (EmpathySearchBarClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
g_type_class_add_private (gobject_class, sizeof (EmpathySearchBarPriv));
-
- /* Neither GtkBin nor GtkContainer seems to do this for us :( */
- widget_class->get_preferred_height = empathy_search_bar_get_preferred_height;
- widget_class->size_allocate = empathy_search_bar_size_allocate;
}
void