PIPS
gtk_utils.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "genC.h"
#include "misc.h"
#include <gtk/gtk.h>
#include "gpips.h"
+ Include dependency graph for gtk_utils.c:

Go to the source code of this file.

Functions

char * getwd ()
 
const char * gpips_gtk_menu_item_get_label (GtkWidget *w)
 
bool gpips_gtk_widget_get_sensitive (GtkWidget *w)
 
void gpips_gtk_menu_item_set_label (GtkWidget *w, gchar *text)
 
GtkWidget * gpips_gtk_dialog_get_content_area (GtkDialog *dialog)
 
gdouble gpips_gtk_adjustment_get_upper (GtkAdjustment *adjustment)
 
gint hide_window (GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
 
gint load_file (const gchar *filename, gchar **data)
 

Function Documentation

◆ getwd()

char* getwd ( )

◆ gpips_gtk_adjustment_get_upper()

gdouble gpips_gtk_adjustment_get_upper ( GtkAdjustment *  adjustment)

Definition at line 84 of file gtk_utils.c.

84  {
85  g_return_val_if_fail(GTK_IS_ADJUSTMENT(adjustment), 0.0);
86  return adjustment->upper;
87 }

Referenced by insert_something_in_the_gpips_log_window().

+ Here is the caller graph for this function:

◆ gpips_gtk_dialog_get_content_area()

GtkWidget* gpips_gtk_dialog_get_content_area ( GtkDialog *  dialog)

Definition at line 79 of file gtk_utils.c.

79  {
80  g_return_val_if_fail(GTK_IS_DIALOG(dialog), NULL);
81  return dialog->vbox;
82 }

Referenced by create_query_window().

+ Here is the caller graph for this function:

◆ gpips_gtk_menu_item_get_label()

const char* gpips_gtk_menu_item_get_label ( GtkWidget *  w)

Definition at line 43 of file gtk_utils.c.

43  {
44  guint i;
45  const char * label;
46  GtkWidget * child;
47  if (!GTK_IS_MENU_ITEM(w))
48  return NULL;
49  GList * children = gtk_container_get_children(GTK_CONTAINER(w));
50  for (i = 0; i < g_list_length(children); i++) {
51  child = (GtkWidget *) g_list_nth_data(children, i);
52  if (!GTK_IS_LABEL(child))
53  continue;
54  label = gtk_label_get_text(GTK_LABEL(child));
55  }
56  g_list_free(children);
57  return (label);
58 }

Referenced by apply_on_each_options_menu_item(), directory_gen_pullright(), display_or_hide_options_frame(), generate_a_directory_menu_notify(), hpfc_notify(), notify_hpfc_file_view(), options_menu_callback(), quit_notify(), select_module_from_status_menu_callback(), select_workspace_notify(), synch_viewmenu_and_opframe_search_in_view(), transform_notify(), update_options(), and view_notify().

+ Here is the caller graph for this function:

◆ gpips_gtk_menu_item_set_label()

void gpips_gtk_menu_item_set_label ( GtkWidget *  w,
gchar *  text 
)

Definition at line 64 of file gtk_utils.c.

64  {
65  guint i;
66  GtkWidget * child;
67  if (!GTK_IS_MENU_ITEM(w))
68  return;
69  GList * children = gtk_container_get_children(GTK_CONTAINER(w));
70  for (i = 0; i < g_list_length(children); i++) {
71  child = (GtkWidget *) g_list_nth_data(children, i);
72  if (!GTK_IS_LABEL(child))
73  continue;
74  gtk_label_set_text(GTK_LABEL(child), text);
75  }
76  g_list_free(children);
77 }

Referenced by close_log_subwindow(), display_or_hide_options_frame(), edit_close_notify(), edit_notify(), gpips_file_view(), open_log_subwindow(), and options_window_done_procedure().

+ Here is the caller graph for this function:

◆ gpips_gtk_widget_get_sensitive()

bool gpips_gtk_widget_get_sensitive ( GtkWidget *  w)

Definition at line 60 of file gtk_utils.c.

60  {
61  return GTK_WIDGET_SENSITIVE(w);
62 }

Referenced by alloc_first_initialized_window(), and edit_close_notify().

+ Here is the caller graph for this function:

◆ hide_window()

gint hide_window ( GtkWidget *  window,
GdkEvent *ev   __attribute__(unused),
gpointer data   __attribute__(unused) 
)

◆ load_file()

gint load_file ( const gchar *  filename,
gchar **  data 
)

Definition at line 94 of file gtk_utils.c.

94  {
95  int size = 0;
96  FILE *f = fopen(filename, "rb");
97  if (f == NULL) {
98  *data = NULL;
99  return -1; // -1 means file opening fail
100  }
101 
102  fseek(f, 0, SEEK_END);
103  size = ftell(f);
104  fseek(f, 0, SEEK_SET);
105 
106  *data = (char *) malloc(size + 1);
107 
108  if (size != fread(*data, sizeof(char), size, f)) {
109  free(*data);
110  return -2; // -2 means file reading fail
111  }
112  fclose(f);
113  (*data)[size] = 0;
114  return size;
115 }
void * malloc(YYSIZE_T)
void free(void *)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15

References f(), free(), and malloc().

Referenced by edit_notify(), and gpips_file_view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: